Submission #1063671

#TimeUsernameProblemLanguageResultExecution timeMemory
1063671aaaaaarrozVision Program (IOI19_vision)C++17
Compilation error
0 ms0 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; bool limites(int x, int y, int h, int w) { return x >= 0 && x < h && y >= 0 && y < w; } void construct_network(int H, int W, int K) { map<pair<int, int>, int> numero; int pos = 0; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { numero[{i, j}] = pos; pos++; } } vector<int> dx, dy; for (int restar = 0; restar <= K; restar++) { int c_x = restar; int c_y = K - restar; dx.push_back(c_x); dy.push_back(c_y); if (c_x != 0) { dx.push_back(-c_x); dy.push_back(c_y); } if (c_y != 0) { dx.push_back(c_x); dy.push_back(-c_y); } if (c_x != 0 && c_y != 0) { dx.push_back(-c_x); dy.push_back(-c_y); } } map<pair<pair<int, int>, pair<int, int>>, bool> marked; int pos=1; vector<int>xd; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { for (int itr = 0; itr < dx.size(); itr++) { int x = i + dx[itr]; int y = j + dy[itr]; vector<int>vecinos; if (limites(x, y, H, W)) { if (!marked[{{i, j}, {x, y}}] && !marked[{{x, y}, {i, j}}]) { vecinos.push_back({numero[{x,y}]}); marked[{{i, j}, {x, y}}] = true; } } if(!vecinos.empty()){ xd.push_back(add_and({numeros[{i,j}],add_or(vecinos)})); } } } } add_or(xd); return; }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:38:6: error: redeclaration of 'int pos'
   38 |  int pos=1;
      |      ^~~
vision.cpp:9:6: note: 'int pos' previously declared here
    9 |  int pos = 0;
      |      ^~~
vision.cpp:42:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |    for (int itr = 0; itr < dx.size(); itr++) {
      |                      ~~~~^~~~~~~~~~~
vision.cpp:53:28: error: 'numeros' was not declared in this scope; did you mean 'numero'?
   53 |      xd.push_back(add_and({numeros[{i,j}],add_or(vecinos)}));
      |                            ^~~~~~~
      |                            numero
vision.cpp:53:59: error: could not convert '{<expression error>, add_or(std::vector<int>(vecinos))}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   53 |      xd.push_back(add_and({numeros[{i,j}],add_or(vecinos)}));
      |                                                           ^
      |                                                           |
      |                                                           <brace-enclosed initializer list>