Submission #203871

#TimeUsernameProblemLanguageResultExecution timeMemory
203871medkVision Program (IOI19_vision)C++14
100 / 100
33 ms2552 KiB
#include <bits/stdc++.h> #include "vision.h" #define pb push_back #define ll long long #define x first #define y second using namespace std; int h,w; int id(int y, int x) { return y*w+x; } void construct_network(int H, int W, int k) { h=H, w=W; vector<int> orY, orX, orT, orB; for(int i=0;i<h;i++) { vector<int> ln; for(int j=0;j<w;j++) ln.pb(id(i,j)); orY.pb(add_or(ln)); } for(int i=0;i<w;i++) { vector<int> ln; for(int j=0;j<h;j++) ln.pb(id(j,i)); orX.pb(add_or(ln)); } for(int i=0;i<h+w-1;i++) { vector<int> ln,ln2; for(int j=0;j<=min(i,w-1);j++) { if(i-j<h) ln.pb(id(i-j,j)); if(h-1-i+j>=0) ln2.pb(id(h-1-i+j,j)); } orT.pb(add_or(ln)), orB.pb(add_or(ln2)); } vector<int> poss; for(int i=0;i<h+w-1-k;i++) poss.pb(add_and(vector<int>{orT[i], orT[i+k]})), poss.pb(add_and(vector<int>{orB[i], orB[i+k]})); int fst=add_or(poss); vector<int> wishnot; vector<int> wb,hb; for(int i=w-1;i>=k;i--) wb.pb(orX[i]); for(int i=0;i<w-k-1;i++) { wb.pop_back(); int tmpor=add_or(wb); wishnot.pb(add_and(vector<int>{orX[i],tmpor})); } for(int i=h-1;i>=k;i--) hb.pb(orY[i]); for(int i=0;i<h-k-1;i++) { hb.pop_back(); int tmpor=add_or(hb); wishnot.pb(add_and(vector<int>{orY[i],tmpor})); } int tm=-1; if(int(wishnot.size()))tm=add_or(wishnot); if(tm==-1) { add_or(vector<int>{fst}); return; } int wishn=add_not(tm); add_and(vector<int>{wishn,fst}); return; }
#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...