답안 #133090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
133090 2019-07-20T07:15:21 Z tinjyu 악어의 지하 도시 (IOI11_crocodile) C++14
컴파일 오류
0 ms 0 KB
#include "race.h"
#include <iostream>
using namespace std;
int tag[200005],road[200005],map[400005][3],n,k;
short a=255,ans[200005][205];
int find(int x)
{
	tag[x]=1;
	int g=road[x];
	//cout<<x<<endl;
	while(g!=-1)
	{
		int now=map[g][0];
		if(tag[now]!=1)
		{
			find(now);
			//cout<<x<<" "<<now<<endl;
			for(int i=map[g][2];i<=k;i++)
			{
				a=min(short(ans[now][i-map[g][2]]+ans[x][k-i]+1),a);
				//cout<<ans[now][i-map[g][2]]<<" "<<ans[x][k-i]<<" "<<k-i-map[g][2]<<"  ";
				
			}
			//cout<<endl;
			for(int i=0;i<=k;i++)ans[x][i+map[g][2]]=min(short(ans[now][i]+1),ans[x][i+map[g][2]]);
		}
		g=map[g][1];
	}
}
int best_path(int N, int K, int H[][2], int L[])
{
	n=N,k=K;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<=k;j++)ans[i][j]=255;
	}
	
	for(int i=0;i<n;i++)
	{
		road[i]=-1;
	}
	for(int i=0;i<n-1;i++)
	{
		int x=H[i][0],y=H[i][1];
		map[i*2][0]=y;
		map[i*2][1]=road[x];
		map[i*2][2]=L[i];
		road[x]=i*2;
		map[i*2+1][0]=x;
		map[i*2+1][1]=road[y];
		map[i*2+1][2]=L[i];
		road[y]=i*2+1;
	}
	find(0);
	for(int i=0;i<n;i++)a=min(ans[i][k],a);
	if(a==255)a=-1;
  	return a;
}

Compilation message

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