# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
519950 | 2022-01-27T22:09:24 Z | sliviu | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 461 ms | 71084 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) { vector<vector<pair<int, int>>> G(n); vector<int> seen(n); for (int i = 0;i < m;++i) { int x, y; G[r[i][0]].emplace_back(r[i][1], l[i]); G[r[i][1]].emplace_back(r[i][0], l[i]); } auto comp = [&](pi a, pi b) { return a.second > b.second; }; priority_queue<pi, vector<pi>, decltype(comp)> PQ(comp); for (int i = 0;i < k;++i) { PQ.emplace(p[i], 0); ++seen[p[i]]; } while (!PQ.empty()) { int node, cost; tie(node, cost) = PQ.top(); PQ.pop(); if (++seen[node] == 2) { if (node == 0) return cost; for (auto x : G[node]) PQ.emplace(x.first, x.second + cost); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 296 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 296 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 588 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 460 KB | Output is correct |
12 | Correct | 5 ms | 1100 KB | Output is correct |
13 | Correct | 3 ms | 1228 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 296 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 588 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 460 KB | Output is correct |
12 | Correct | 5 ms | 1100 KB | Output is correct |
13 | Correct | 3 ms | 1228 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 312 KB | Output is correct |
16 | Correct | 449 ms | 71084 KB | Output is correct |
17 | Correct | 81 ms | 13340 KB | Output is correct |
18 | Correct | 89 ms | 14756 KB | Output is correct |
19 | Correct | 461 ms | 66836 KB | Output is correct |
20 | Correct | 266 ms | 55224 KB | Output is correct |
21 | Correct | 39 ms | 5916 KB | Output is correct |
22 | Correct | 452 ms | 44740 KB | Output is correct |