답안 #300248

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
300248 2020-09-17T03:02:25 Z easrui 슈퍼트리 잇기 (IOI20_supertrees) C++14
컴파일 오류
0 ms 0 KB
#include "supertrees.h"

int construct(std::vector<std::vector<int>> p) {
    int n = p.size();
	vector<vector<int>> ans(n);
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			ans[i].push_back(i==j+1||i==j-1);
		}
	}
	build(ans);
	return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:5:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |  vector<vector<int>> ans(n);
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/9/vector:67,
                 from supertrees.h:1,
                 from supertrees.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
supertrees.cpp:5:16: error: expected primary-expression before 'int'
    5 |  vector<vector<int>> ans(n);
      |                ^~~
supertrees.cpp:8:4: error: 'ans' was not declared in this scope
    8 |    ans[i].push_back(i==j+1||i==j-1);
      |    ^~~
supertrees.cpp:11:8: error: 'ans' was not declared in this scope
   11 |  build(ans);
      |        ^~~