Submission #1071269

#TimeUsernameProblemLanguageResultExecution timeMemory
1071269Gromp15Vision Program (IOI19_vision)C++17
0 / 100
14 ms2648 KiB
#include "vision.h" #include <bits/stdc++.h> #define ll long long #define ar array #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() using namespace std; template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } void construct_network(int H, int W, int K) { if (K == 1) { int idx = -1; for (int i = 0; i < H; i++) { vector<int> cur; for (int j = 0; j < W; j++) { cur.push_back(i*W+j); } if (idx == -1) idx = add_or(cur); else idx = add_xor({idx, add_or(cur)}); } for (int i = 0; i < W; i++) { vector<int> cur; for (int j = 0; j < H; j++) { cur.push_back(j*W+i); } assert(~idx); idx = add_xor({idx, add_or(cur)}); } int idx2 = -1; for (int i = 0; i < H-1; i++) { vector<int> cur; for (int j = 0; j < W; j++) { cur.push_back(i*W+j); cur.push_back((i+1)*W+j); } if (idx2 == -1) idx2 = add_or(cur); else idx2 = add_or({idx2, add_or(cur)}); } for (int i = 0; i < W-1; i++) { vector<int> cur; for (int j = 0; j < H; j++) { cur.push_back(j*W+i); cur.push_back(j*W+i+1); } if (idx2 == -1) idx2 = add_or(cur); else idx2 = add_or({idx2, add_or(cur)}); } assert(~idx); assert(~idx2); add_and({idx, idx2}); return; } vector<int> res; if ((H <= 30 && W <= 30) || min(H, W) == 1) { for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { vector<int> cur; for (int k = 0; k < H; k++) { for (int l = 0; l < W; l++) { if (abs(k - i) + abs(j - l) == K) { cur.emplace_back(k*W+l); } } } if (cur.size()) { int idx = add_or(cur); res.emplace_back(add_and({i*W+j, idx})); } } } } else { vector<int> cur; for (int k = 0; k < H; k++) { for (int l = 0; l < W; l++) { if (k + l == K) { cur.emplace_back(k*W+l); } } } if (cur.size()) { int idx = add_or(cur); res.emplace_back(add_and({0, idx})); } } 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...