Submission #222585

#TimeUsernameProblemLanguageResultExecution timeMemory
222585VEGAnnVision Program (IOI19_vision)C++14
52 / 100
66 ms5872 KiB
#include <bits/stdc++.h> #include "vision.h" #define all(x) x.begin(),x.end() #define sz(x) ((int)x.size()) #define pii pair<int,int> #define ft first #define sd second #define MP make_pair #define PB push_back using namespace std; const int N = 100100; vector<int> vc, res, ids; int n, m; bool ok(int x, int y){ return (x >= 0 && y >= 0 && x < n && y < m); } mt19937 rnd(chrono::system_clock().now().time_since_epoch().count()); void construct_network(int H, int W, int K) { n = H; m = W; res.clear(); if (max(H, W) > 100 && min(W, H) > 1){ vc.clear(); int i = 0, j = 0; int x = 0, y = -K; while (x != i - K){ if (ok(x, y)) vc.PB(x * m + y); x--; y++; } while (x != i){ if (ok(x, y)) vc.PB(x * m + y); x++; y++; } while (x != i + K){ if (ok(x, y)) vc.PB(x * m + y); x++; y--; } while (x != i){ if (ok(x, y)) vc.PB(x * m + y); x--; y--; } if (!sz(vc)) { add_and({0}); return; } int id = add_or(vc); add_and({id, i * m + j}); return; } ids.clear(); for (int i = 0; i < n * m; i++) ids.PB(i); shuffle(all(ids), rnd); int kol = 0; for (int it = 0; it < n * m; it++){ int i = ids[it] / m, j = ids[it] % m; vc.clear(); int x = i, y = j - K; while (x != i - K){ if (ok(x, y)) vc.PB(x * m + y); x--; y++; } while (x != i){ if (ok(x, y)) vc.PB(x * m + y); x++; y++; } while (x != i + K){ if (ok(x, y)) vc.PB(x * m + y); x++; y--; } while (x != i){ if (ok(x, y)) vc.PB(x * m + y); x--; y--; } if (!sz(vc)) continue; int id = add_or(vc); res.PB(add_and({id, i * m + j})); kol += 2; if (kol + 3 > 10000) break; } add_or(res); }
#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...