Submission #940125

#TimeUsernameProblemLanguageResultExecution timeMemory
940125ezzzayRace (IOI11_race)C++14
Compilation error
0 ms0 KiB
#include "race.h" const int M=2e3+5; int ans=INT_MAX; vector<pair<int,int>>v[M]; #define pb push_back #define ff first #define ss second bool vis[M]; void dfs(int a,int w, int x){ if(w==K){ ans=min(ans,x); } vis[a]=1; for(auto p:v[a]){ int b=p.ff; int c=p.ss; if(vis[b]==0){ dfs(b,w+c,x+1); } } } int best_path(int N, int K, int H[][2], int L[]){ for(int i=0;i<N-1;i++)cin>>H[i][0]>>H[i][1]; for(int i=0;i<N-1;i++)cin>>L[i]; for(int i=0;i<N-1;i++){ int a=H[i][0]; int b=H[i][1]; int c=L[i]; v[a].pb({b,c}); v[b].pb({a,b}); } for(int i=0;i<N;i++){ memset(vis,0,sizeof vis); dfs(i,0,0); } return ans; }

Compilation message (stderr)

race.cpp:3:9: error: 'INT_MAX' was not declared in this scope
    3 | int ans=INT_MAX;
      |         ^~~~~~~
race.cpp:2:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    1 | #include "race.h"
  +++ |+#include <climits>
    2 | const int M=2e3+5;
race.cpp:4:1: error: 'vector' does not name a type
    4 | vector<pair<int,int>>v[M];
      | ^~~~~~
race.cpp: In function 'void dfs(int, int, int)':
race.cpp:10:8: error: 'K' was not declared in this scope
   10 |  if(w==K){
      |        ^
race.cpp:11:7: error: 'min' was not declared in this scope
   11 |   ans=min(ans,x);
      |       ^~~
race.cpp:14:13: error: 'v' was not declared in this scope
   14 |  for(auto p:v[a]){
      |             ^
race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:23:25: error: 'cin' was not declared in this scope
   23 |   for(int i=0;i<N-1;i++)cin>>H[i][0]>>H[i][1];
      |                         ^~~
race.cpp:24:24: error: 'cin' was not declared in this scope
   24 |  for(int i=0;i<N-1;i++)cin>>L[i];
      |                        ^~~
race.cpp:29:3: error: 'v' was not declared in this scope
   29 |   v[a].pb({b,c});
      |   ^
race.cpp:33:3: error: 'memset' was not declared in this scope
   33 |   memset(vis,0,sizeof vis);
      |   ^~~~~~
race.cpp:2:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "race.h"
  +++ |+#include <cstring>
    2 | const int M=2e3+5;