Submission #940126

#TimeUsernameProblemLanguageResultExecution timeMemory
940126ezzzayRace (IOI11_race)C++14
Compilation error
0 ms0 KiB
#include "race.h" #include<bits/stdc++.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:5:1: error: 'vector' does not name a type
    5 | vector<pair<int,int>>v[M];
      | ^~~~~~
race.cpp: In function 'void dfs(int, int, int)':
race.cpp:11:8: error: 'K' was not declared in this scope
   11 |  if(w==K){
      |        ^
race.cpp:12:7: error: 'min' was not declared in this scope; did you mean 'std::min'?
   12 |   ans=min(ans,x);
      |       ^~~
      |       std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from race.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
race.cpp:15:13: error: 'v' was not declared in this scope
   15 |  for(auto p:v[a]){
      |             ^
race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:24:25: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   24 |   for(int i=0;i<N-1;i++)cin>>H[i][0]>>H[i][1];
      |                         ^~~
      |                         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from race.cpp:2:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
race.cpp:25:24: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   25 |  for(int i=0;i<N-1;i++)cin>>L[i];
      |                        ^~~
      |                        std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from race.cpp:2:
/usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
race.cpp:30:3: error: 'v' was not declared in this scope
   30 |   v[a].pb({b,c});
      |   ^