답안 #732865

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
732865 2023-04-29T11:01:35 Z vjudge1 식물 비교 (IOI20_plants) C++17
컴파일 오류
0 ms 0 KB
#include "supertrees.h"
#include<algorithm>
#include <vector>
std::vector<std::vector<int>> ans;
std::vector<bool> vis;
std::vector<std::vector<int>> dp;
std::vector<std::pair<int,int>> pp;
void dfs(int i, int j, int n){
    vis[j]=1;
    pp.push_back({i,j});
    for(int k1=0;k1<n;k1++){
        if(dp[j][k1] && !vis[k1]){
            ans[j][k1]=ans[k1][j]=1;
            dfs(j,k1,n);
        }
    }
}	
int construct(std::vector<std::vector<int>> p) {
	int n = p.size();
	vis.resize(n,false);
	for(int i=0;i<n;i++){
	    std::vector<int> row;
	    row.resize(n,0);
	    ans.push_back(row);
	}
	for(int i=0;i<n;i++){
	    std::vector<int> d;
	    for(int j=0;j<n;j++){
	        d.push_back(p[i][j]);
	    }
	    dp.push_back(d);
	}
	for (int i = 0; i < n; i++) {
	    if(!vis[i]){
	        vis[i]=1;
	        for(int j=i+1;j<n;j++){
		        if(p[i][j] && !vis[j]){ 
		            ans[i][j]=ans[j][i]=1;
		            dfs(i,j,n);
		        }
		    }
	    }
	}
	for(int i=0;i<pp.size();i++){
	    for(int j=0;j<n;j++){
	        if((p[pp[i].first][j] && !p[pp[i].second][j]) || (!p[pp[i].first][j] && p[pp[i].second][j])){
	            return 0;
	        }
	    }
	}
	build(ans);
	return 1;
}

Compilation message

plants.cpp:1:10: fatal error: supertrees.h: No such file or directory
    1 | #include "supertrees.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.