Submission #169273

#TimeUsernameProblemLanguageResultExecution timeMemory
169273Osama_AlkhodairyVision Program (IOI19_vision)C++17
100 / 100
16 ms1908 KiB
#include <bits/stdc++.h> #include "vision.h" //~ #include "grader.cpp" using namespace std; int H, W, K; vector <int> kb(9); int id(int i, int j){ return i * W + j; } void add(int c){ for(auto &i : kb){ int old = i; i = add_xor({c, i}); c = add_and({c, old}); } } void construct_network(int h, int w, int k) { H = h; W = w; K = k; if(H * W == 2){ add_or({0}); return; } int zero = add_and({0, 1, 2}); int one = add_not(zero); for(auto &i : kb){ i = add_not(one); } int c = add_not(one); for(int i = 0 ; i < H ; i++){ vector <int> Ns; Ns.push_back(c); for(int j = 0 ; j < W ; j++){ Ns.push_back(id(i, j)); } c = add_xor(Ns); add(c); } for(int j = 0 ; j < W ; j++){ vector <int> Ns; Ns.push_back(c); for(int i = 0 ; i < H ; i++){ Ns.push_back(id(i, j)); } c = add_xor(Ns); add(c); } vector <int> f; for(int i = 0 ; i < 9 ; i++){ int cur; if((k >> i) & 1) cur = one; else cur = zero; cur = add_xor({cur, kb[i]}); cur = add_not(cur); f.push_back(cur); } add_and(f); }
#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...