Submission #136532

# Submission time Handle Problem Language Result Execution time Memory
136532 2019-07-25T12:32:56 Z miguel Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
10 ms 1016 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;
    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];
}
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -