# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
226563 | 2020-04-24T10:19:00 Z | a_player | Crocodile's Underground City (IOI11_crocodile) | C++14 | 711 ms | 89576 KB |
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair using namespace std; typedef long long ll; vector<pair<int, ll>> grafo[100002]; pair<ll, ll> dist[100002]; priority_queue<pair<ll, int>> q; int v[100002]; bitset<100002> vis; long long travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for (int i = 0; i < N; i++) { dist[i].f = LLONG_MAX; dist[i].s = LLONG_MAX; v[i] = 0; } for (int i = 0; i < M; i++) { grafo[R[i][0]].push_back(mp(R[i][1], (ll)L[i])); grafo[R[i][1]].push_back(mp(R[i][0], (ll)L[i])); } for (int i = 0; i < K; i++) { int a = P[i]; v[a] = 2; dist[a].f = 0; dist[a].s = 0; q.push(mp(0, a)); } while (!q.empty()) { int co = q.top().s; q.pop(); if (vis[co]) continue; vis[co] = 1; for (int i = 0; i < grafo[co].size(); i++) { int no = grafo[co][i].f; int w = grafo[co][i].s; if (dist[co].s + w < dist[no].f) { dist[no].s = dist[no].f; dist[no].f = dist[co].s + w; v[no] += 1; if (v[no] >= 2) q.push(mp(-dist[no].s, no)); } else if (dist[co].s + w < dist[no].s) { dist[no].s = dist[co].s + w; v[no] += 1; if (v[no] >= 2) q.push(mp(-dist[no].s, no)); } } } return dist[0].s; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2688 KB | Output is correct |
2 | Correct | 6 ms | 2688 KB | Output is correct |
3 | Correct | 6 ms | 2688 KB | Output is correct |
4 | Correct | 7 ms | 2816 KB | Output is correct |
5 | Correct | 6 ms | 2816 KB | Output is correct |
6 | Correct | 6 ms | 2816 KB | Output is correct |
7 | Correct | 6 ms | 2816 KB | Output is correct |
8 | Correct | 6 ms | 2816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2688 KB | Output is correct |
2 | Correct | 6 ms | 2688 KB | Output is correct |
3 | Correct | 6 ms | 2688 KB | Output is correct |
4 | Correct | 7 ms | 2816 KB | Output is correct |
5 | Correct | 6 ms | 2816 KB | Output is correct |
6 | Correct | 6 ms | 2816 KB | Output is correct |
7 | Correct | 6 ms | 2816 KB | Output is correct |
8 | Correct | 6 ms | 2816 KB | Output is correct |
9 | Correct | 8 ms | 3072 KB | Output is correct |
10 | Correct | 6 ms | 2688 KB | Output is correct |
11 | Correct | 7 ms | 2944 KB | Output is correct |
12 | Correct | 10 ms | 3456 KB | Output is correct |
13 | Correct | 10 ms | 3456 KB | Output is correct |
14 | Correct | 7 ms | 2816 KB | Output is correct |
15 | Correct | 6 ms | 2816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2688 KB | Output is correct |
2 | Correct | 6 ms | 2688 KB | Output is correct |
3 | Correct | 6 ms | 2688 KB | Output is correct |
4 | Correct | 7 ms | 2816 KB | Output is correct |
5 | Correct | 6 ms | 2816 KB | Output is correct |
6 | Correct | 6 ms | 2816 KB | Output is correct |
7 | Correct | 6 ms | 2816 KB | Output is correct |
8 | Correct | 6 ms | 2816 KB | Output is correct |
9 | Correct | 8 ms | 3072 KB | Output is correct |
10 | Correct | 6 ms | 2688 KB | Output is correct |
11 | Correct | 7 ms | 2944 KB | Output is correct |
12 | Correct | 10 ms | 3456 KB | Output is correct |
13 | Correct | 10 ms | 3456 KB | Output is correct |
14 | Correct | 7 ms | 2816 KB | Output is correct |
15 | Correct | 6 ms | 2816 KB | Output is correct |
16 | Correct | 564 ms | 83028 KB | Output is correct |
17 | Correct | 99 ms | 18040 KB | Output is correct |
18 | Correct | 135 ms | 20600 KB | Output is correct |
19 | Correct | 711 ms | 89576 KB | Output is correct |
20 | Correct | 384 ms | 67448 KB | Output is correct |
21 | Correct | 56 ms | 9976 KB | Output is correct |
22 | Correct | 395 ms | 64248 KB | Output is correct |