Submission #425961

#TimeUsernameProblemLanguageResultExecution timeMemory
425961amoo_safarVision Program (IOI19_vision)C++17
100 / 100
21 ms1748 KiB
#include "vision.h" #define pb push_back using namespace std; const int Log = 10; const int N = 202; int X[Log]; int r[N], c[N]; void Plus(int var){ for(int i = 0; i < Log; i++){ int tmp = add_and({var, X[i]}); X[i] = add_xor({var, X[i]}); var = tmp; } } void construct_network(int H, int W, int K) { if(H * W == 2){ int en = add_or({0, 1}); return ; } vector<int> Ns; for(int i = 0; i < Log; i++) X[i] = add_and({0, 1, 2}); for(int i = 0; i < H; i++){ Ns.clear(); for(int j = 0; j < W; j++){ Ns.pb(i * W + j); } r[i] = add_xor(Ns); } for(int i = 0; i < W; i++){ Ns.clear(); for(int j = 0; j < H; j++){ Ns.pb(j * W + i); } c[i] = add_xor(Ns); } for(int i = 1; i < H; i++) r[i] = add_xor({r[i], r[i - 1]}); for(int i = 1; i < W; i++) c[i] = add_xor({c[i], c[i - 1]}); for(int i = 0; i < H; i++) Plus(r[i]); for(int i = 0; i < W; i++) Plus(c[i]); Ns.clear(); for(int i = 0; i < Log; i++){ if(K >> i & 1){ X[i] = add_not(X[i]); } Ns.pb(X[i]); } add_not(add_or(Ns)); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:23:7: warning: unused variable 'en' [-Wunused-variable]
   23 |   int en = add_or({0, 1});
      |       ^~
#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...