Submission #830266

#TimeUsernameProblemLanguageResultExecution timeMemory
830266pavementVision Program (IOI19_vision)C++17
0 / 100
8 ms4520 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; #define pb push_back void construct_network(int H, int W, int K) { auto conv = [&](int r, int c) { return r * W + c; }; vector<int> row(H, -1), col(W, -1); int ins = H * W; for (int i = 0; i < H; i++) { for (int j = i + 1; j < H; j++) { vector<int> cur1, cur2; for (int k = 0; k < W; k++) { cur1.pb(conv(i, k)); cur2.pb(conv(j, k)); } add_or(cur1); add_or(cur2); add_and({ins, ins + 1}); ins += 3; row[j - i] = ins - 1; } } { vector<int> tmp; for (int i = 1; i < H; i++) { tmp.pb(row[i]); } if (tmp.empty()) { tmp.resize(H * W); iota(tmp.begin(), tmp.end(), 0); } add_or(tmp); add_not({ins}); ins += 2; row[0] = ins - 1; } for (int i = 0; i < W; i++) { for (int j = i + 1; j < W; j++) { vector<int> cur1, cur2; for (int k = 0; k < H; k++) { cur1.pb(conv(k, i)); cur2.pb(conv(k, j)); } add_or(cur1); add_or(cur2); add_and({ins, ins + 1}); ins += 3; col[j - i] = ins - 1; } } { vector<int> tmp; for (int i = 1; i < W; i++) { tmp.pb(col[i]); } if (tmp.empty()) { tmp.resize(H * W); iota(tmp.begin(), tmp.end(), 0); } add_or(tmp); add_not({ins}); ins += 2; col[0] = ins - 1; } vector<int> fin; for (int i = 0; i <= K; i++) { int j = K - i; if (0 <= i && i < H && 0 <= j && j < W) { add_and({row[i], col[j]}); fin.pb(ins); ins++; } } add_or(fin); }
#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...