Submission #169659
Source Code Expand
// {{{ Boilerplate Code <-------------------------------------------------- // vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}} #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <utility> #include <vector> #define FOR(I,A,B) for(int I = (A); I < (B); ++I) #define ALL(A) (A).begin(), (A).end() using namespace std; // }}} int main(){ int W,H; int N; cin>>W>>H>>N if(N>8) return 0; if(W>80) return 0; if(H>80) return 0; vector <int> xs; vector <int> ys; FOR(i,0,N){ int tx,ty; cin>>tx>>ty; tx--;ty--; xs.push_back(tx); ys.push_back(ty); } vector<int> perm; int ret=0; FOR(i,0,N) perm.push_back(i); do{ int kmap[80][80]; FOR(i,0,80) FOR(j,0,80) kmap[i][j]=1; FOR(i,0,N){ kmap[xs[perm[i]]][ys[perm[i]]]=0; int x,y; x=xs[perm[i]]; y=ys[perm[i]]; while(x>0){ x--; if(kmap[x][y]==0) break; kmap[x][y]=0; } x=xs[perm[i]]; y=ys[perm[i]]; while(y>0){ y--; if(kmap[x][y]==0) break; kmap[x][y]=0; } x=xs[perm[i]]; y=ys[perm[i]]; while(x<W-1){ x++; if(kmap[x][y]==0) break; kmap[x][y]=0; } x=xs[perm[i]]; y=ys[perm[i]]; while(y<H-1){ y++; if(kmap[x][y]==0) break; kmap[x][y]=0; } } int tmp=0; FOR(i,0,W){ FOR(j,0,H){ if(kmap[i][j]==0) tmp++; } } ret=max(ret,tmp); }while(next_permutation(ALL(perm))); cout<<ret<<endl; }
Submission Info
Submission Time | |
---|---|
Task | D - 金塊ゲーム |
User | nhirokinet |
Language | C++ (G++ 4.6.4) |
Score | 0 |
Code Size | 1840 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:39:2: error: expected ‘;’ before ‘if’