Submission #297394

#TimeUsernameProblemLanguageResultExecution timeMemory
297394mode149256Vision Program (IOI19_vision)C++14
44 / 100
46 ms3544 KiB
#include<bits/stdc++.h> #include "vision.h" using namespace std; #define x first #define y second using vi = vector<int>; using ll = long long; using vii = vector<vi>; using pi = pair<int, int>; const int MX_IN = 10000; int j = 0; int h, w, k; int con(pi a) { return a.x * w + a.y; } pi con(int a) { return {a / w, a % w}; } int valid(pi a) { return int(0 <= a.x and a.x < h and 0 <= a.y and a.y < w); } int valid(int a) { return valid(con(a)); } void findKit(int i, vi &kit) { pi prad = con(i); pi c = prad; c.y += k; if (valid(c)) kit.emplace_back(con(c)); for (int i = 0; i <= k; ++i) { pi nc = prad; nc.y += i; nc.x += k - i; if (valid(nc)) kit.emplace_back(con(nc)); nc = prad; if (i != k) { nc.y -= i; nc.x += k - i; if (valid(nc)) kit.emplace_back(con(nc)); } } } mt19937 rng(chrono::steady_clock().now().time_since_epoch().count()); void construct_network(int H, int W, int K) { h = H; w = W; k = K; vi andai; vi inds(H * W); for (int i = 0; i < H * W; ++i) inds[i] = i; shuffle(inds.begin(), inds.end(), rng); for (int h = 0; h < H * W; ++h) { int i = inds[h]; vi kit; findKit(i, kit); if (kit.empty()) continue; if (j + 2 + 1 <= MX_IN) { int n = add_or(kit); andai.emplace_back(add_and({i, n})); j += 2; } } add_or(andai); // std::vector<int> Ns; // Ns = {0, 1}; // int a = add_and(Ns); // Ns = {0, a}; // int b = add_or(Ns); // Ns = {0, 1, b}; // int c = add_xor(Ns); // add_not(c); }
#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...