Submission #1137008

#TimeUsernameProblemLanguageResultExecution timeMemory
1137008CiprianCrocodile's Underground City (IOI11_crocodile)C++20
Compilation error
0 ms0 KiB
#include "crocodile.h" vector<int>adj[1003], fin(1003); void dfs(int x, int p, vector<vector<int>> t){ if(adj[x].size()==1){ return; } for(auto e: adj[x]){ if(e==p)continue; dfs(e,x, t); }int mn1=1e9, mn2=1e9; for(auto e: adj[x]){ if(e==p)continue; mn1=min(mn1, fin[e]+t[x][e]); }for(auto e: adj[x]){ if(e==p)continue; if(fin[e]+t[x][e]!=mn1){ mn2=min(mn2, fin[e]+t[x][e]); } }fin[x]=mn2; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector<vector<int>> tm(N+3, vector<int>(N+4)); for(int i=0; i<M; i++){ adj[R[i][0]].push_back(R[i][1]); adj[R[i][1]].push_back(R[i][0]); tm[R[i][0]][R[i][1]]=L[i]; tm[R[i][1]][R[i][0]]=L[i]; }dfs(0,0,tm); return fin[0]; }

Compilation message (stderr)

crocodile.cpp:3:1: error: 'vector' does not name a type
    3 | vector<int>adj[1003], fin(1003);
      | ^~~~~~
crocodile.cpp:4:31: error: 'vector' was not declared in this scope
    4 | void dfs(int x, int p, vector<vector<int>> t){
      |                               ^~~~~~
crocodile.cpp:4:31: error: 'vector' was not declared in this scope
crocodile.cpp:4:31: error: 'vector' was not declared in this scope
crocodile.cpp:4:31: error: 'vector' was not declared in this scope
crocodile.cpp:4:24: error: 'vector' has not been declared
    4 | void dfs(int x, int p, vector<vector<int>> t){
      |                        ^~~~~~
crocodile.cpp:4:30: error: expected ',' or '...' before '<' token
    4 | void dfs(int x, int p, vector<vector<int>> t){
      |                              ^
crocodile.cpp: In function 'void dfs(int, int, int)':
crocodile.cpp:5:8: error: 'adj' was not declared in this scope
    5 |     if(adj[x].size()==1){
      |        ^~~
crocodile.cpp:8:17: error: 'adj' was not declared in this scope
    8 |     for(auto e: adj[x]){
      |                 ^~~
crocodile.cpp:10:18: error: 't' was not declared in this scope
   10 |         dfs(e,x, t);
      |                  ^
crocodile.cpp:12:17: error: 'adj' was not declared in this scope
   12 |     for(auto e: adj[x]){
      |                 ^~~
crocodile.cpp:14:22: error: 'fin' was not declared in this scope
   14 |         mn1=min(mn1, fin[e]+t[x][e]);
      |                      ^~~
crocodile.cpp:14:29: error: 't' was not declared in this scope
   14 |         mn1=min(mn1, fin[e]+t[x][e]);
      |                             ^
crocodile.cpp:14:13: error: 'min' was not declared in this scope
   14 |         mn1=min(mn1, fin[e]+t[x][e]);
      |             ^~~
crocodile.cpp:15:18: error: 'adj' was not declared in this scope
   15 |     }for(auto e: adj[x]){
      |                  ^~~
crocodile.cpp:17:12: error: 'fin' was not declared in this scope
   17 |         if(fin[e]+t[x][e]!=mn1){
      |            ^~~
crocodile.cpp:17:19: error: 't' was not declared in this scope
   17 |         if(fin[e]+t[x][e]!=mn1){
      |                   ^
crocodile.cpp:18:17: error: 'min' was not declared in this scope
   18 |             mn2=min(mn2, fin[e]+t[x][e]);
      |                 ^~~
crocodile.cpp:20:6: error: 'fin' was not declared in this scope
   20 |     }fin[x]=mn2;
      |      ^~~
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:24:10: error: 'vector' was not declared in this scope
   24 |   vector<vector<int>> tm(N+3, vector<int>(N+4));
      |          ^~~~~~
crocodile.cpp:24:17: error: expected primary-expression before 'int'
   24 |   vector<vector<int>> tm(N+3, vector<int>(N+4));
      |                 ^~~
crocodile.cpp:26:9: error: 'adj' was not declared in this scope
   26 |         adj[R[i][0]].push_back(R[i][1]);
      |         ^~~
crocodile.cpp:28:9: error: 'tm' was not declared in this scope
   28 |         tm[R[i][0]][R[i][1]]=L[i];
      |         ^~
crocodile.cpp:30:14: error: 'tm' was not declared in this scope
   30 |     }dfs(0,0,tm);
      |              ^~
crocodile.cpp:31:12: error: 'fin' was not declared in this scope
   31 |     return fin[0];
      |            ^~~