Submission #1044558

#TimeUsernameProblemLanguageResultExecution timeMemory
1044558idasVision Program (IOI19_vision)C++17
100 / 100
14 ms3160 KiB
#include "vision.h" #include "bits/stdc++.h" #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define pb push_back #define s second #define f first using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; const int MxN=210; int h, w, k, g[MxN][MxN], l[2*MxN], r[2*MxN], l_sz, r_sz; void construct_network(int H, int W, int K) { h=H; w=W; k=K; int in=0; FOR(i, 0, h) { FOR(j, 0, w) { g[i][j]=in++; } } in=0; for(int i=h-1; i>=0; i--) { int j=0; vi ar; FOR(k, 0, max(h, w)) { if(i+k>=h || j+k>=w) break; ar.pb(g[i+k][j+k]); } l[in++]=add_or(ar); } FOR(j, 1, w) { int i=0; vi ar; FOR(k, 0, max(h, w)) { if(i+k>=h || j+k>=w) break; ar.pb(g[i+k][j+k]); } l[in++]=add_or(ar); } l_sz=in; in=0; FOR(j, 0, w) { int i=0; vi ar; FOR(k, 0, max(h,w)) { if(i+k>=h || j-k<0) break; ar.pb(g[i+k][j-k]); } r[in++]=add_or(ar); } FOR(i, 1, h) { int j=w-1; vi ar; FOR(k, 0, max(h, w)) { if(i+k>=h || j-k<0) break; ar.pb(g[i+k][j-k]); } r[in++]=add_or(ar); } r_sz=in; vi tmp; FOR(i, 0, l_sz) { if(i+k>=l_sz) break; tmp.pb(add_and({l[i], l[i+k]})); } int l_ok=add_or(tmp); tmp.clear(); FOR(i, 0, r_sz) { if(i+k>=r_sz) break; tmp.pb(add_and({r[i], r[i+k]})); } int r_ok=add_or(tmp); tmp.clear(); FOR(i, 0, l_sz) { if(i+k>=l_sz) break; vi ins; FOR(j, i, i+k+1) { ins.pb(l[j]); } ins.pb(add_or(ins)); tmp.pb(add_xor(ins)); } int l_block=add_or(tmp); tmp.clear(); FOR(i, 0, r_sz) { if(i+k>=r_sz) break; vi ins; FOR(j, i, i+k+1) { ins.pb(r[j]); } ins.pb(add_or(ins)); tmp.pb(add_xor(ins)); } int r_block=add_or(tmp); tmp.clear(); FOR(i, 0, l_sz) tmp.pb(l[i]); int l_single=add_xor(tmp); tmp.clear(); FOR(i, 0, r_sz) tmp.pb(r[i]); int r_single=add_xor(tmp); int x=add_and({l_ok, r_block}), y=add_and({r_ok, l_block}), z=add_and({r_ok, l_single}), w=add_and({l_ok, r_single}); add_or({x, y, z, w}); } /* */
#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...