Submission #429173

#TimeUsernameProblemLanguageResultExecution timeMemory
429173albertolg101Vision Program (IOI19_vision)C++17
100 / 100
20 ms1680 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; vector<int> g (int a, int b) { return vector<int> {a, b}; } void construct_network(int H, int W, int K) { vector<int> ar; { int last = 0; for(int i = 0 ; i < H - 1 ; i++) { vector<int> q; for(int j = 0 ; j < W ; j++) { q.push_back(i * W + j); } if(last != 0) q.push_back(last); last = add_xor(q); ar.push_back(last); } last = 0; for(int j = 0 ; j < W ; j++) { vector<int> q; for(int i = 0 ; i < H ; i++) { q.push_back(i * W + j); } if(last != 0) q.push_back(last); last = add_xor(q); ar.push_back(last); } } int zero = ar.back(), one = add_not(zero); vector<int> c; for(int i = 0 ; i < 9 ; i++) c.push_back(add_and(g(zero, one))); for(int i = 0 ; i < ar.size() ; i++) { vector<int> new_c; int rest = ar[i]; for(int j = 0 ; j < c.size() ; j++) { new_c.push_back(add_xor(g(c[j], rest))); rest = add_and(g(c[j], rest)); } c = new_c; } vector<int> d, k; for(int i = 0 ; i < 9 ; i++) { if((1<<i) & K) { k.push_back(add_and(g(one, one))); } else { k.push_back(add_and(g(zero, zero))); } } for(int i = 0 ; i < 9 ; i++) { d.push_back(add_xor(g(c[i], k[i]))); } add_not(add_or(d)); return ; }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:58:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |  for(int i = 0 ; i < ar.size() ; i++)
      |                  ~~^~~~~~~~~~~
vision.cpp:63:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   for(int j = 0 ; j < c.size() ; j++)
      |                   ~~^~~~~~~~~~
#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...