Submission #732728

#TimeUsernameProblemLanguageResultExecution timeMemory
732728raul2008487Connecting Supertrees (IOI20_supertrees)C++17
Compilation error
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;
}

Compilation message (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>*