답안 #361713

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361713 2021-01-31T11:14:50 Z David_M 꿈 (IOI13_dreaming) C++14
컴파일 오류
0 ms 0 KB
#include "dreaming.h"
int d[3][1<<17],e,D,F,S,i;
vector<int>v[1<<17];
void dfs(int x,int o){
	f[x]++;
	if(o<2&&d[o][x]>=D)e=x,D=d[o][x];
	if(o>1)D=min(D,max(d[1][x],d[2][x]));
	for(auto y:v[x])if(f[y.first]<o)d[o][y.first]=x+y.second,dfs(y.first,o);
}
int travelTime(int N,int M,int L,int A[],int B[],int T[]){
    while(M--)v[A[i]].pb({B[i],T[i]}),v[B[i]].pb({A[i],T[i]});
    while(N--)if(!f[N])dfs(N,0),dfs(e,1),dfs(e,2),F=min(D,F),S=max(D,S),D=0;
	return F+S+L;
}

Compilation message

dreaming.cpp:3:1: error: 'vector' does not name a type
    3 | vector<int>v[1<<17];
      | ^~~~~~
dreaming.cpp: In function 'void dfs(int, int)':
dreaming.cpp:5:2: error: 'f' was not declared in this scope
    5 |  f[x]++;
      |  ^
dreaming.cpp:7:17: error: 'max' was not declared in this scope
    7 |  if(o>1)D=min(D,max(d[1][x],d[2][x]));
      |                 ^~~
dreaming.cpp:7:11: error: 'min' was not declared in this scope
    7 |  if(o>1)D=min(D,max(d[1][x],d[2][x]));
      |           ^~~
dreaming.cpp:8:13: error: 'v' was not declared in this scope
    8 |  for(auto y:v[x])if(f[y.first]<o)d[o][y.first]=x+y.second,dfs(y.first,o);
      |             ^
dreaming.cpp: In function 'int travelTime(int, int, int, int*, int*, int*)':
dreaming.cpp:11:15: error: 'v' was not declared in this scope
   11 |     while(M--)v[A[i]].pb({B[i],T[i]}),v[B[i]].pb({A[i],T[i]});
      |               ^
dreaming.cpp:12:19: error: 'f' was not declared in this scope
   12 |     while(N--)if(!f[N])dfs(N,0),dfs(e,1),dfs(e,2),F=min(D,F),S=max(D,S),D=0;
      |                   ^
dreaming.cpp:12:53: error: 'min' was not declared in this scope
   12 |     while(N--)if(!f[N])dfs(N,0),dfs(e,1),dfs(e,2),F=min(D,F),S=max(D,S),D=0;
      |                                                     ^~~
dreaming.cpp:12:64: error: 'max' was not declared in this scope
   12 |     while(N--)if(!f[N])dfs(N,0),dfs(e,1),dfs(e,2),F=min(D,F),S=max(D,S),D=0;
      |                                                                ^~~