Submission #345707

# Submission time Handle Problem Language Result Execution time Memory
345707 2021-01-08T00:52:09 Z daniel920712 Crocodile's Underground City (IOI11_crocodile) C++14
46 / 100
192 ms 262144 KB
#include "crocodile.h"
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
bool is[100005];
vector < pair < long long , long long > > Next[100005];
long long F(long long fa,long long here)
{
    //printf("%lld %lld\n",fa,here);
    long long t;
    vector < long long > tt;
    if(is[here]) return 0;
    for(auto i:Next[here])
    {
        if(i.first!=fa)
        {
            t=F(here,i.first);
            //printf("%lld %lld\n",i.first,t);
            if(t!=-1) tt.push_back(t+i.second);
        }

    }
    sort(tt.begin(),tt.end());
    if(tt.size()>=2) return tt[1];
    else return -1;
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    int i;
    for(i=0;i<M;i++)
    {
        Next[R[i][0]].push_back(make_pair((long long) R[i][1],(long long) L[i]));
        Next[R[i][1]].push_back(make_pair((long long) R[i][0],(long long) L[i]));
    }
    for(i=0;i<K;i++) is[P[i]]=1;
    return (int) F(-1,0);
}


# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 3 ms 2944 KB Output is correct
5 Correct 3 ms 2796 KB Output is correct
6 Correct 2 ms 2796 KB Output is correct
7 Correct 3 ms 2796 KB Output is correct
8 Correct 3 ms 2796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 3 ms 2944 KB Output is correct
5 Correct 3 ms 2796 KB Output is correct
6 Correct 2 ms 2796 KB Output is correct
7 Correct 3 ms 2796 KB Output is correct
8 Correct 3 ms 2796 KB Output is correct
9 Runtime error 192 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 3 ms 2944 KB Output is correct
5 Correct 3 ms 2796 KB Output is correct
6 Correct 2 ms 2796 KB Output is correct
7 Correct 3 ms 2796 KB Output is correct
8 Correct 3 ms 2796 KB Output is correct
9 Runtime error 192 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -