Submission #778420

#TimeUsernameProblemLanguageResultExecution timeMemory
778420EliasVision Program (IOI19_vision)C++17
0 / 100
17 ms2428 KiB
#ifndef _DEBUG #include "vision.h" #endif #include <bits/stdc++.h> using namespace std; void construct_network(int H, int W, int K) { int nott = add_not(0); int def_zero = add_and({0, nott}); vector<int> xor_single; for (int i = 0; i < H; i++) { vector<int> indices; for (int j = 0; j < W; j++) { indices.push_back(i * W + j); } xor_single.push_back(add_xor(indices)); } for (int j = 0; j < W; j++) { vector<int> indices; for (int i = 0; i < H; i++) { indices.push_back(i * W + j); } xor_single.push_back(add_xor(indices)); } assert(xor_single.size() == W + H); vector<int> xor_prefix; vector<int> indices; for (int i = 0; i < W + H; i++) { indices.push_back(xor_single[i]); xor_prefix.push_back(add_xor(indices)); } assert(xor_prefix.size() == W + H); vector<int> bits; for (int k = 0; k <= 8; k++) { int carry = def_zero; if (K & (1 << k)) bits.push_back(add_xor(xor_prefix)); else bits.push_back(add_not(add_xor(xor_prefix))); vector<int> new_xor_prefix; for (int i = 0; i < W + H; i++) { new_xor_prefix.push_back(add_and({carry, xor_prefix[i]})); carry = add_xor({carry, xor_prefix[i]}); } xor_prefix = new_xor_prefix; } cout << "bits: "; for (int i = 0; i < bits.size(); i++) cout << bits[i] << " "; cout << "\n"; add_and(bits); }

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from vision.cpp:5:
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:34:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |  assert(xor_single.size() == W + H);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~
vision.cpp:44:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |  assert(xor_prefix.size() == W + H);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~
vision.cpp:65:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |  for (int i = 0; i < bits.size(); i++)
      |                  ~~^~~~~~~~~~~~~
#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...