제출 #612251

#제출 시각아이디문제언어결과실행 시간메모리
612251l_rehoVision Program (IOI19_vision)C++14
컴파일 에러
0 ms0 KiB
#include "vision.h" void construct_network(int H, int W, int K) { /* std::vector<int> Ns; Ns = {0, 1}; int a = add_and(Ns); Ns = {0, a}; int b = add_or(Ns); Ns = {0, 1, b}; int c = add_xor(Ns); add_not(c); * */ int r1 = -1, c1 = -1, r2 = -1, c2 = -1; int mx = W*H-1; vector<vector<bool>> visited(H, vector<bool>(W, 0)); int ni = 0; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ int curr = i*W+j; for(int a = 0; a < K; a++){ int b = K-a; int pos1 = (i+a)*W+(j+b); int pos2 = (i+-a)*W+(j+b); int pos3 = (i+a)*W+(j+-b); int pos4 = (i+-a)*W+(j+-b); if(pos1 >= 0 && pos1 <= mx) add_and(vector<int>{curr, pos1}), ni++; if(pos2 >= 0 && pos2 <= mx) add_and(vector<int>{curr, pos2}), ni++; if(pos3 >= 0 && pos3 <= mx) add_and(vector<int>{curr, pos3}), ni++; if(pos4 >= 0 && pos4 <= mx) add_and(vector<int>{curr, pos4}), ni++; } // come trovo le posizioni di distanza K da cord } } vector<int> OR; for(int i = W*H; i < W*H+ni; i++){ OR.push_back(i); } if(OR.size() != 0) add_or(OR); else add_not(1); }

컴파일 시 표준 에러 (stderr) 메시지

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:21:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   21 |  vector<vector<bool>> visited(H, vector<bool>(W, 0));
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
vision.cpp:21:16: error: expected primary-expression before 'bool'
   21 |  vector<vector<bool>> visited(H, vector<bool>(W, 0));
      |                ^~~~
vision.cpp:37:48: error: expected primary-expression before 'int'
   37 |     if(pos1 >= 0 && pos1 <= mx) add_and(vector<int>{curr, pos1}), ni++;
      |                                                ^~~
vision.cpp:38:48: error: expected primary-expression before 'int'
   38 |     if(pos2 >= 0 && pos2 <= mx) add_and(vector<int>{curr, pos2}), ni++;
      |                                                ^~~
vision.cpp:39:48: error: expected primary-expression before 'int'
   39 |     if(pos3 >= 0 && pos3 <= mx) add_and(vector<int>{curr, pos3}), ni++;
      |                                                ^~~
vision.cpp:40:48: error: expected primary-expression before 'int'
   40 |     if(pos4 >= 0 && pos4 <= mx) add_and(vector<int>{curr, pos4}), ni++;
      |                                                ^~~
vision.cpp:27:8: warning: unused variable 'curr' [-Wunused-variable]
   27 |    int curr = i*W+j;
      |        ^~~~
vision.cpp:51:9: error: expected primary-expression before 'int'
   51 |  vector<int> OR;
      |         ^~~
vision.cpp:53:3: error: 'OR' was not declared in this scope
   53 |   OR.push_back(i);
      |   ^~
vision.cpp:56:5: error: 'OR' was not declared in this scope
   56 |  if(OR.size() != 0)
      |     ^~
vision.cpp:18:6: warning: unused variable 'r1' [-Wunused-variable]
   18 |  int r1 = -1, c1 = -1, r2 = -1, c2 = -1;
      |      ^~
vision.cpp:18:15: warning: unused variable 'c1' [-Wunused-variable]
   18 |  int r1 = -1, c1 = -1, r2 = -1, c2 = -1;
      |               ^~
vision.cpp:18:24: warning: unused variable 'r2' [-Wunused-variable]
   18 |  int r1 = -1, c1 = -1, r2 = -1, c2 = -1;
      |                        ^~
vision.cpp:18:33: warning: unused variable 'c2' [-Wunused-variable]
   18 |  int r1 = -1, c1 = -1, r2 = -1, c2 = -1;
      |                                 ^~