Submission #283156

#TimeUsernameProblemLanguageResultExecution timeMemory
283156aymanrsVision Program (IOI19_vision)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include "vision.h" bool valid(int H, int W, int i, int j){ return i >= 0 && i < H && j >= 0 && j < W; } void construct_network(int H, int W, int K){ int ind = H*W; for(int i = 0;i < H;i++){ for(int j = 0;j < W;j++){ std::vector<int> pos; for(int x = -K; x <= K;x++){ int y = K - abs(x); if(valid(H, W, i+y, j+x)){ pos.push_back((i+y)*W + j+x); } } if(!pos.empty()){ add_or(pos); add_and({(i+y)*W, ind}); ind+=2; } } } std::vector<int> vec; for(int i = H*W+1;i < ind;i+=2){ vec.push_back(i); } add_or(vec); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:20:17: error: 'y' was not declared in this scope
   20 |     add_and({(i+y)*W, ind});
      |                 ^
vision.cpp:20:27: error: could not convert '{<expression error>, ind}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   20 |     add_and({(i+y)*W, ind});
      |                           ^
      |                           |
      |                           <brace-enclosed initializer list>