Submission #147084

#TimeUsernameProblemLanguageResultExecution timeMemory
147084Bodo171Vision Program (IOI19_vision)C++14
100 / 100
14 ms2012 KiB
#include "vision.h" #include <iostream> using namespace std; const int nmax=1005; vector<int> d1[nmax],d2[nmax]; int wh1[nmax],wh2[nmax],ps1[nmax],ps2[nmax]; int nr,n,m,i,j; int enc(int i,int j) { return m*i+j; } int solve(int k) { vector<int> arg; for(i=k;i<=n+m-2;i++) arg.push_back(add_and({wh1[i],ps1[i-k]})); for(i=k;i<=n+m-2;i++) arg.push_back(add_and({wh2[i],ps2[i-k]})); return add_or(arg); } void construct_network(int H, int W, int K) { vector<int> Ns; nr=H*W-1; n=H,m=W; for(i=0;i<H;i++) for(j=0;j<W;j++) { d1[i+j].push_back(enc(i,j)); d2[j-i+H-1].push_back(enc(i,j)); } for(i=0;i<=H+W-2;i++) { wh1[i]=add_or(d1[i]); if(i==0) ps1[i]=wh1[i]; else ps1[i]=add_or({ps1[i-1],wh1[i]}); } for(i=0;i<=H+W-2;i++) { wh2[i]=add_or(d2[i]); if(i==0) ps2[i]=wh2[i]; else ps2[i]=add_or({ps2[i-1],wh2[i]}); } Ns.push_back(solve(K)); if(K+1<=H+W-2)Ns.push_back(solve(K+1)); if(Ns.size()>1)add_xor(Ns); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...