제출 #244177

#제출 시각아이디문제언어결과실행 시간메모리
244177bigg경주 (Race) (IOI11_race)C++14
컴파일 에러
0 ms0 KiB
#include "race.h" using namespace std; vector<pair<int,int> > grafo[212345]; int marc[212345]; int dp[212345][112]; int k; void dfs(int x){ marc[x] = 1; dp[x][0] = 0; for(int i = 0; i < grafo[x].size(); i++){ int viz = grafo[x][i].first; if(marc[viz]) continue; dfs(viz); for(int j = grafo[x][i].second; j <= k; j++){ // printf("%d %d %d\n",x, j, dp[x][j] ); dp[x][j] = min(dp[x][j], dp[viz][j - grafo[x][i].second] + 1); } } } int INF = 1e9; int n; int best_path(int N, int K, int H[][2], int L[]) { n = N; k = K; for(int i = 0; i < N - 1; i++){ int u, v, w; // scanf("%d %d %d", &u, &v, &w); u = H[i][0]; v = H[i][1]; w = L[i]; grafo[u].push_back(make_pair(v, w)); grafo[v].push_back(make_pair(u, w)); } for(int i = 0; i < n; i++){ for(int j = 1; j <= 100; j++){ dp[i][j] = INF; } } dfs(0); int ans = 1e9; for(int i = 0; i < n; i++){ //printf("%d\n",dp[i][k] ); ans = min(ans, dp[i][k]); } if(ans >= INF) ans = -1; return ans; }

컴파일 시 표준 에러 (stderr) 메시지

race.cpp:3:1: error: 'vector' does not name a type
 vector<pair<int,int> > grafo[212345];
 ^~~~~~
race.cpp: In function 'void dfs(int)':
race.cpp:10:21: error: 'grafo' was not declared in this scope
  for(int i = 0; i < grafo[x].size(); i++){
                     ^~~~~
race.cpp:16:15: error: 'min' was not declared in this scope
    dp[x][j] = min(dp[x][j], dp[viz][j - grafo[x][i].second] + 1);
               ^~~
race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:34:3: error: 'grafo' was not declared in this scope
   grafo[u].push_back(make_pair(v, w));
   ^~~~~
race.cpp:34:22: error: 'make_pair' was not declared in this scope
   grafo[u].push_back(make_pair(v, w));
                      ^~~~~~~~~
race.cpp:47:9: error: 'min' was not declared in this scope
   ans = min(ans, dp[i][k]);
         ^~~