# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398985 | 2021-05-05T00:41:24 Z | jlallas384 | Dreaming (IOI13_dreaming) | C++14 | 1000 ms | 8516 KB |
#include <bits/stdc++.h> #include "dreaming.h" using namespace std; int travelTime(int n, int m, int l, int A[], int B[], int T[]) { vector<vector<pair<int,int>>> g(n); for(int i = 0; i < m; i++){ g[A[i]].emplace_back(B[i],T[i]); g[B[i]].emplace_back(A[i],T[i]); } vector<int> vis(n),mins; for(int i = 0; i < n; i++) if(!vis[i]){ queue<int> q; q.push(i); vis[i] = 1; vector<int> comp; while(q.size()){ int v = q.front(); q.pop(); comp.push_back(v); for(auto [u,w]: g[v]) if(!vis[u]){ q.push(u); vis[u] = 1; } } int mn = 1e9; for(int st: comp){ queue<tuple<int,int,int>> q; q.emplace(st,-1,0); int mx = 0; while(q.size()){ auto [v,p,dst] = q.front(); q.pop(); mx = max(mx,dst); for(auto [u,w]: g[v]) if(u != p){ q.emplace(u,v,w+dst); } } mn = min(mn,mx); } mins.push_back(mn); } sort(mins.rbegin(), mins.rend()); int maxP = mins[0]; int ans = maxP; for(int i = 1; i < mins.size(); i++){ ans = max(ans,maxP + l + mins[i]); maxP = max(maxP,mins[i] + l); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 8516 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 8516 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 5900 KB | Output is correct |
2 | Correct | 36 ms | 5940 KB | Output is correct |
3 | Correct | 37 ms | 5956 KB | Output is correct |
4 | Correct | 35 ms | 5944 KB | Output is correct |
5 | Correct | 37 ms | 6000 KB | Output is correct |
6 | Correct | 39 ms | 6596 KB | Output is correct |
7 | Correct | 36 ms | 6164 KB | Output is correct |
8 | Correct | 33 ms | 5836 KB | Output is correct |
9 | Correct | 34 ms | 5808 KB | Output is correct |
10 | Correct | 36 ms | 6168 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 16 ms | 3672 KB | Output is correct |
13 | Correct | 18 ms | 3656 KB | Output is correct |
14 | Correct | 16 ms | 3656 KB | Output is correct |
15 | Correct | 16 ms | 3740 KB | Output is correct |
16 | Correct | 16 ms | 3656 KB | Output is correct |
17 | Correct | 17 ms | 3656 KB | Output is correct |
18 | Correct | 18 ms | 3720 KB | Output is correct |
19 | Correct | 16 ms | 3656 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 432 KB | Output is correct |
23 | Correct | 16 ms | 3656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 8516 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |