Submission #298551

#TimeUsernameProblemLanguageResultExecution timeMemory
298551square1001Vision Program (IOI19_vision)C++14
0 / 100
6 ms1404 KiB
#include "vision.h" #include <vector> using namespace std; void construct_network(int H, int W, int K) { for(int i = 0; i < H; ++i) { vector<int> elems; for(int j = 0; j < W; ++j) { elems.push_back(i * W + j); } add_xor(elems); } for(int i = 0; i < W; ++i) { vector<int> elems; for(int j = 0; j < H; ++j) { elems.push_back(j * W + i); } add_xor(elems); } vector<int> ax, ay; for(int i = 0; i < H; ++i) { for(int j = i + 1; j < H; ++j) { add_and({H * W + i, H * W + j}); ax.push_back(j - i); } } for(int i = 0; i < W; ++i) { for(int j = i + 1; j < W; ++j) { add_and({H * W + H + i, H * W + H + j}); ay.push_back(j - i); } } int qs = H * W + H + W + H * (H - 1) / 2 + W * (W - 1) / 2; for(int i = 0; i < H; ++i) { if(i == 0) { vector<int> elems; for(int j = 0; j < int(ax.size()); ++j) { elems.push_back(H * W + H + W + j); } add_or(elems); add_not(qs); } else { vector<int> elems; for(int j = 0; j < int(ax.size()); ++j) { if(ax[j] == i) { elems.push_back(H * W + H + W + j); } } add_or(elems); } } for(int i = 0; i < W; ++i) { if(i == 0) { vector<int> elems; for(int j = 0; j < int(ay.size()); ++j) { elems.push_back(H * W + H + W + H * (H - 1) / 2 + j); } add_or(elems); add_not(qs + (H + 1)); } else { vector<int> elems; for(int j = 0; j < int(ay.size()); ++j) { if(ay[j] == i) { elems.push_back(H * W + H + W + H * (H - 1) / 2 + j); } } add_or(elems); } } int cnt = 0; for(int i = 0; i < H; ++i) { for(int j = 0; j < W; ++j) { if(i + j == K) { add_and({qs + i + 1, qs + (H + 1) + j + 1}); ++cnt; } } } vector<int> felems; for(int i = 0; i < cnt; ++i) { felems.push_back(qs + (H + 1) + (W + 1) + i); } add_or(felems); }
#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...