Submission #240216

# Submission time Handle Problem Language Result Execution time Memory
240216 2020-06-18T21:48:23 Z oscarsierra12 Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std ;

const int N = 1010 ;

int dp[N];
vector <int> G[N] ;

int go ( int u, int p ) {
    int frMn = INT_MAX, scMn ;
    for ( auto v:G[u] ) {
        if ( p == v.ff ) continue ;
        go ( v.ff, u ) ;
        if ( dp[v.ff] + v.ss <= frMn ) frMn = dp[v.ff] + v.ss, scMn = frMn ;
        else if ( dp[v.ff] + v.ss < scMn ) scMn = dp[v.ff] + v.ss ;
    }
    dp[u] = scMn ;
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
  for ( int i = 0 ; i < M; ++i ) G[R[i][0]].pb ( { R[i][1], L[i] } ), G[R[i][1]].pb({R[i][0],L[i]}) ;
  return go(0,-1);
}


Compilation message

crocodile.cpp: In function 'int go(int, int)':
crocodile.cpp:13:21: error: request for member 'ff' in 'v', which is of non-class type 'int'
         if ( p == v.ff ) continue ;
                     ^~
crocodile.cpp:14:16: error: request for member 'ff' in 'v', which is of non-class type 'int'
         go ( v.ff, u ) ;
                ^~
crocodile.cpp:15:19: error: request for member 'ff' in 'v', which is of non-class type 'int'
         if ( dp[v.ff] + v.ss <= frMn ) frMn = dp[v.ff] + v.ss, scMn = frMn ;
                   ^~
crocodile.cpp:15:27: error: request for member 'ss' in 'v', which is of non-class type 'int'
         if ( dp[v.ff] + v.ss <= frMn ) frMn = dp[v.ff] + v.ss, scMn = frMn ;
                           ^~
crocodile.cpp:15:52: error: request for member 'ff' in 'v', which is of non-class type 'int'
         if ( dp[v.ff] + v.ss <= frMn ) frMn = dp[v.ff] + v.ss, scMn = frMn ;
                                                    ^~
crocodile.cpp:15:60: error: request for member 'ss' in 'v', which is of non-class type 'int'
         if ( dp[v.ff] + v.ss <= frMn ) frMn = dp[v.ff] + v.ss, scMn = frMn ;
                                                            ^~
crocodile.cpp:16:24: error: request for member 'ff' in 'v', which is of non-class type 'int'
         else if ( dp[v.ff] + v.ss < scMn ) scMn = dp[v.ff] + v.ss ;
                        ^~
crocodile.cpp:16:32: error: request for member 'ss' in 'v', which is of non-class type 'int'
         else if ( dp[v.ff] + v.ss < scMn ) scMn = dp[v.ff] + v.ss ;
                                ^~
crocodile.cpp:16:56: error: request for member 'ff' in 'v', which is of non-class type 'int'
         else if ( dp[v.ff] + v.ss < scMn ) scMn = dp[v.ff] + v.ss ;
                                                        ^~
crocodile.cpp:16:64: error: request for member 'ss' in 'v', which is of non-class type 'int'
         else if ( dp[v.ff] + v.ss < scMn ) scMn = dp[v.ff] + v.ss ;
                                                                ^~
crocodile.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:23:45: error: 'class std::vector<int>' has no member named 'pb'
   for ( int i = 0 ; i < M; ++i ) G[R[i][0]].pb ( { R[i][1], L[i] } ), G[R[i][1]].pb({R[i][0],L[i]}) ;
                                             ^~
crocodile.cpp:23:82: error: 'class std::vector<int>' has no member named 'pb'
   for ( int i = 0 ; i < M; ++i ) G[R[i][0]].pb ( { R[i][1], L[i] } ), G[R[i][1]].pb({R[i][0],L[i]}) ;
                                                                                  ^~