Submission #578258

# Submission time Handle Problem Language Result Execution time Memory
578258 2022-06-16T09:30:50 Z Dan4Life Crocodile's Underground City (IOI11_crocodile) C++17
46 / 100
127 ms 262144 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(s) (int)s.size()
#define fi first
#define se second
vector<pair<int,int>> adj[10000];
int n, m;

int dfs(int s, int p){
    multiset<int> S; S.clear();
    for(auto u : adj[s]){
        if(u.fi==p) continue;
        S.insert(dfs(u.fi, s)+u.se);
    }
    if(sz(adj[s])==1) return 0;
    S.erase(S.begin()); return *S.begin();
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    n = N, m = M;
    for(int i = 0; i < n; i++){
        int a = R[i][0], b = R[i][1], c = L[i];
        adj[a].pb({b,c}), adj[b].pb({a,c});
    }
    return dfs(0,-1);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 548 KB Output is correct
4 Correct 1 ms 560 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 688 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 548 KB Output is correct
4 Correct 1 ms 560 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 688 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Runtime error 127 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 548 KB Output is correct
4 Correct 1 ms 560 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 688 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Runtime error 127 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -