# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
255605 | 2020-08-01T12:24:55 Z | SamAnd | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 715 ms | 57176 KB |
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; #define m_p make_pair #define fi first #define se second #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() const int N = 100005; const int INF = 1000000009; struct ban { int x; int d; ban(){} ban(int x, int d) { this->x = x; this->d = d; } }; int n; vector<ban> g[N]; bool c[N]; int min1[N], min2[N]; bool operator<(const ban& a, const ban& b) { return a.d > b.d; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { n = N; for (int i = 0; i < M; ++i) { int x = R[i][0]; int y = R[i][1]; int z = L[i]; g[x].push_back(ban(y, z)); g[y].push_back(ban(x, z)); } for (int x = 0; x < n; ++x) { min1[x] = min2[x] = INF; } priority_queue<ban> q; for (int i = 0; i < K; ++i) { int x = P[i]; min1[x] = min2[x] = 0; q.push(ban(x, 0)); } while (!q.empty()) { ban t; do { t = q.top(); q.pop(); } while (c[t.x]); c[t.x] = true; if (t.x == 0) return t.d; for (int i = 0; i < g[t.x].size(); ++i) { ban h = g[t.x][i]; h.d += t.d; if (h.d <= min1[h.x]) { min2[h.x] = min1[h.x]; min1[h.x] = h.d; } else if (h.d <= min2[h.x]) { min2[h.x] = h.d; } q.push(ban(h.x, min2[h.x])); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2816 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 2 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2816 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 2 ms | 2816 KB | Output is correct |
7 | Correct | 3 ms | 2816 KB | Output is correct |
8 | Correct | 2 ms | 2816 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2816 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 2 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2816 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 2 ms | 2816 KB | Output is correct |
7 | Correct | 3 ms | 2816 KB | Output is correct |
8 | Correct | 2 ms | 2816 KB | Output is correct |
9 | Correct | 4 ms | 2944 KB | Output is correct |
10 | Correct | 2 ms | 2688 KB | Output is correct |
11 | Correct | 3 ms | 2816 KB | Output is correct |
12 | Correct | 8 ms | 3328 KB | Output is correct |
13 | Correct | 6 ms | 3584 KB | Output is correct |
14 | Correct | 2 ms | 2688 KB | Output is correct |
15 | Correct | 3 ms | 2816 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2816 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Correct | 2 ms | 2688 KB | Output is correct |
4 | Correct | 2 ms | 2816 KB | Output is correct |
5 | Correct | 3 ms | 2816 KB | Output is correct |
6 | Correct | 2 ms | 2816 KB | Output is correct |
7 | Correct | 3 ms | 2816 KB | Output is correct |
8 | Correct | 2 ms | 2816 KB | Output is correct |
9 | Correct | 4 ms | 2944 KB | Output is correct |
10 | Correct | 2 ms | 2688 KB | Output is correct |
11 | Correct | 3 ms | 2816 KB | Output is correct |
12 | Correct | 8 ms | 3328 KB | Output is correct |
13 | Correct | 6 ms | 3584 KB | Output is correct |
14 | Correct | 2 ms | 2688 KB | Output is correct |
15 | Correct | 3 ms | 2816 KB | Output is correct |
16 | Correct | 715 ms | 52188 KB | Output is correct |
17 | Correct | 114 ms | 15096 KB | Output is correct |
18 | Correct | 120 ms | 15960 KB | Output is correct |
19 | Correct | 661 ms | 55128 KB | Output is correct |
20 | Correct | 384 ms | 57176 KB | Output is correct |
21 | Correct | 56 ms | 8056 KB | Output is correct |
22 | Correct | 551 ms | 36344 KB | Output is correct |