Submission #136533

# Submission time Handle Problem Language Result Execution time Memory
136533 2019-07-25T12:34:40 Z miguel Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include<crocodile.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
const ll mod = 998244353;
vector <pi> g[10001];
int t[10001];

void dfs(int nod, int p){
    for(pi i: g[nod]){
        if(i.x!=p) dfs(i.x, nod);
    }
    vi v;
    if(t[i]==1000000001){
        for(pi i: g[nod]){
            if(i.x!=p) v.pb(t[i.x]+i.y);
        }
        sort(v.begin(), v.end());
        t[nod]=v[1];
    }
}

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){
    for(int i=0; i<n; i++) t[i]=1000000001;
    for(int i=0; i<k; i++) t[p[i]]=0;
    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]});
    }
    dfs(0, -1);
    return t[0];
}

Compilation message

crocodile.cpp: In function 'void dfs(int, int)':
crocodile.cpp:21:10: error: 'i' was not declared in this scope
     if(t[i]==1000000001){
          ^