제출 #732728

#제출 시각아이디문제언어결과실행 시간메모리
732728raul2008487Connecting Supertrees (IOI20_supertrees)C++17
컴파일 에러
0 ms0 KiB
#include "supertrees.h" #include <vector> int construct(std::vector<std::vector<int>> p) { int n = p.size(); std::vector<int> answer[n]; std::vector<std::vector<bool>> vis; for (int i = 0; i < n; i++) { std::vector<int> row; ans[i].resize(n); for(int j=0;j<n;j++){ if(j==i+1 && p[i][j]){ ans[i][j]=1; } else if(j==i-1 && p[i][j]){ ans[i][j]=1; } else{ ans[i][j]=0; } } } build(answer); return 1; }

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:11:3: error: 'ans' was not declared in this scope
   11 |   ans[i].resize(n);
      |   ^~~
supertrees.cpp:24:8: error: could not convert '(std::vector<int>*)(& answer)' from 'std::vector<int>*' to 'std::vector<std::vector<int> >'
   24 |  build(answer);
      |        ^~~~~~
      |        |
      |        std::vector<int>*