# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345777 | 2021-01-08T03:58:01 Z | daniel920712 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 40 ms | 11500 KB |
#include "crocodile.h" #include <vector> #include <utility> #include <algorithm> #include <queue> #include <map> using namespace std; vector < pair < long long , long long > > Next[100005]; vector < pair < long long , long long > > Next2[100005]; map < long long , long long > how[100005]; bool is[100005]; long long F(long long fa,long long here) { long long t; vector < long long > tt; if(is[here]) return 0; if(how[here].find(fa)!=how[here].end()) return how[here][fa]; how[here][fa]=-1; for(auto i:Next[here]) { if(i.first!=fa) { t=F(here,i.first); if(t!=-1&&t+i.second<=1000000000) tt.push_back(t+i.second); } } sort(tt.begin(),tt.end()); if(tt.size()>=2) how[here][fa]=tt[1]; else how[here][fa]=-1; return how[here][fa]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { int i; long long a,b,c; 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); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 9708 KB | Output is correct |
2 | Correct | 6 ms | 9708 KB | Output is correct |
3 | Correct | 6 ms | 9708 KB | Output is correct |
4 | Correct | 7 ms | 9836 KB | Output is correct |
5 | Correct | 7 ms | 9836 KB | Output is correct |
6 | Correct | 7 ms | 9836 KB | Output is correct |
7 | Correct | 7 ms | 9836 KB | Output is correct |
8 | Correct | 7 ms | 9836 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 9708 KB | Output is correct |
2 | Correct | 6 ms | 9708 KB | Output is correct |
3 | Correct | 6 ms | 9708 KB | Output is correct |
4 | Correct | 7 ms | 9836 KB | Output is correct |
5 | Correct | 7 ms | 9836 KB | Output is correct |
6 | Correct | 7 ms | 9836 KB | Output is correct |
7 | Correct | 7 ms | 9836 KB | Output is correct |
8 | Correct | 7 ms | 9836 KB | Output is correct |
9 | Correct | 40 ms | 11500 KB | Output is correct |
10 | Incorrect | 7 ms | 9836 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 9708 KB | Output is correct |
2 | Correct | 6 ms | 9708 KB | Output is correct |
3 | Correct | 6 ms | 9708 KB | Output is correct |
4 | Correct | 7 ms | 9836 KB | Output is correct |
5 | Correct | 7 ms | 9836 KB | Output is correct |
6 | Correct | 7 ms | 9836 KB | Output is correct |
7 | Correct | 7 ms | 9836 KB | Output is correct |
8 | Correct | 7 ms | 9836 KB | Output is correct |
9 | Correct | 40 ms | 11500 KB | Output is correct |
10 | Incorrect | 7 ms | 9836 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |