# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599746 | 2022-07-19T20:06:36 Z | Meloric | Crocodile's Underground City (IOI11_crocodile) | C++14 | 922 ms | 75528 KB |
#include "crocodile.h" #include <bits/stdc++.h> #define pb push_back //#define int int64_t #define pii pair<int, int> #define X first #define Y second #define all(x) (x).begin(),(x).end() #define lb lower_bound #define ub upper_bound using namespace std; void p(auto A){ for(auto e : A)cout << e << ' '; cout << '\n'; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ /* int n, m, k; cin >> n >> m >> k; vector<vector<int>>R(m, vector<int>(2)); vector<int>L(m), P(k); for(int i = 0; i< m; i++)cin >> R[i][0] >> R[i][1] >> L[i]; for(int i = 0; i< k; i++)cin >> P[i]; */ int n = N; int m = M; int k = K; vector<vector<pii>> g(n, vector<pii>()); for(int i = 0; i< m; i++){ int c = R[i][0]; int d = R[i][1]; int w = L[i]; g[c].pb({d, w}); g[d].pb({c, w}); } vector<int>v1(n,-1), v2(n,-1); priority_queue<pii> pq; for(int i = 0; i< k; i++){ int c = P[i]; v1[c] = 0; pq.push({0, c}); } while(pq.size()){ auto [d, u] = pq.top(); d = -d; pq.pop(); if(v2[u] != -1)continue; if(v1[u] == -1){ v1[u] = d; continue; } v2[u] = d; for(auto [v, w] : g[u])pq.push({-(w+d), v}); } return v2[0]; } /* void solve(){ cout << travel_plan(); } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; //cin >> t; while(t--)solve(); } */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 3 ms | 724 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 6 ms | 1108 KB | Output is correct |
13 | Correct | 6 ms | 1220 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 3 ms | 724 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 6 ms | 1108 KB | Output is correct |
13 | Correct | 6 ms | 1220 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 817 ms | 71244 KB | Output is correct |
17 | Correct | 84 ms | 13884 KB | Output is correct |
18 | Correct | 123 ms | 15204 KB | Output is correct |
19 | Correct | 922 ms | 75528 KB | Output is correct |
20 | Correct | 577 ms | 63720 KB | Output is correct |
21 | Correct | 42 ms | 5944 KB | Output is correct |
22 | Correct | 516 ms | 44884 KB | Output is correct |