# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102660 | 2019-03-26T13:59:18 Z | sean9892 | None (KOI18_robot) | C++14 | 1000 ms | 188000 KB |
#include<bits/stdc++.h> using namespace std; int main(void){ int n,s,e; scanf("%d%d%d",&n,&s,&e); map<pair<int,int>,int> adj; for(int i=0;i<n-1;i++){ int a,b,c; scanf("%d%d%d",&a,&b,&c); adj[{a,b}]=adj[{b,a}]=c; } stack<int> st; st.push(s);st.push(0); int root[n+1]; memset(root,0,sizeof(root)); while(!st.empty()){ int b=st.top();st.pop(); int t=st.top();st.pop(); root[t]=b; if(e==t){ break; } for(int i=1;i<=n;i++){ if(!root[i]&&adj[{i,t}]){ st.push(i);st.push(t); } } } int p=e; int m=0; int rl=0; for(;p!=s;p=root[p]){ int x=adj[{p,root[p]}]; m=m>x?m:x; rl+=x; } printf("%d",rl-m); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1057 ms | 188000 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1060 ms | 96336 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 97 ms | 17400 KB | Output is correct |
2 | Correct | 180 ms | 29332 KB | Output is correct |
3 | Correct | 673 ms | 46584 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Execution timed out | 1091 ms | 88668 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1061 ms | 102360 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |