Submission #1020940

#TimeUsernameProblemLanguageResultExecution timeMemory
1020940pawnedVision Program (IOI19_vision)C++17
12 / 100
428 ms2876 KiB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; #include "vision.h" int H, W, K; ii conv(int x) { return {x / W, x % W}; } int convr(ii p) { return (p.fi * W + p.se); } int dist(int x, int y) { ii r1 = conv(x); ii r2 = conv(y); int res = abs(r1.fi - r2.fi) + abs(r1.se - r2.se); return res; } void construct_network(int h, int w, int k) { H = h; W = w; K = k; int ctr = H * W; // next query number vi tq; for (int i = 0; i < H * W; i++) { // cout<<"at "<<i<<endl; ii pos = conv(i); vi v1; for (int j = 0; j < H * W; j++) { ii pos2 = conv(j); if (pos.se - pos.fi == pos2.se - pos2.fi - K) v1.pb(j); } if (v1.size() > 0) { add_or(v1); ctr++; add_and({i, ctr - 1}); tq.pb(ctr); ctr++; } vi v2; for (int j = 0; j < H * W; j++) { ii pos2 = conv(j); if (pos.se + pos.fi == pos2.se + pos2.fi - K) v2.pb(j); } if (v2.size() > 0) { add_or(v2); ctr++; add_and({i, ctr - 1}); tq.pb(ctr); ctr++; } } // cout<<"ctr: "<<ctr<<endl; add_or(tq); }
#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...