# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
853821 | 2023-09-25T09:32:46 Z | kthng | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 3 ms | 6748 KB |
#include<iostream> #include<algorithm> #include<vector> #include "crocodile.h" using namespace std; typedef pair<int, int> pii; vector<pii> a[100001]; int d[100001]; int n, m, k; int inf = 1e9 + 100; int f(int x) { if (d[x] != -1) return d[x]; d[x] = inf; vector<pii> tmp; for (int i = 0; i < a[x].size(); i++) { tmp.push_back(pii(f(a[x][i].first) + a[x][i].second, a[x][i].first)); } sort(tmp.begin(), tmp.end()); if (a[x].size() != 1) d[x] = min(d[x], tmp[1].first); return d[x]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { n = N; m = M; for (int i = 0; i < m; i++) { a[R[i][0]].push_back(pii(R[i][1], L[i])); a[R[i][1]].push_back(pii(R[i][0], L[i])); } k = K; for (int i = 0; i < n; i++) d[i] = -1; for (int i = 0; i < K; i++) d[P[i]] = 0; return f(0); } /* int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < m; i++) { int t0, t1, t2; scanf("%d%d%d", &t0, &t1, &t2); a[t0].push_back(pii(t1, t2)); a[t1].push_back(pii(t0, t2)); } for (int i = 0; i < n; i++) d[i] = -1; for (int i = 0; i < k; i++) { int t0; scanf("%d", &t0); d[t0] = 0; } printf("%d\n", f(0)); return 0; } */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 6488 KB | Output is correct |
2 | Correct | 1 ms | 6488 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 2 ms | 6488 KB | Output is correct |
5 | Correct | 2 ms | 6488 KB | Output is correct |
6 | Correct | 1 ms | 6488 KB | Output is correct |
7 | Correct | 2 ms | 6492 KB | Output is correct |
8 | Correct | 2 ms | 6492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 6488 KB | Output is correct |
2 | Correct | 1 ms | 6488 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 2 ms | 6488 KB | Output is correct |
5 | Correct | 2 ms | 6488 KB | Output is correct |
6 | Correct | 1 ms | 6488 KB | Output is correct |
7 | Correct | 2 ms | 6492 KB | Output is correct |
8 | Correct | 2 ms | 6492 KB | Output is correct |
9 | Correct | 3 ms | 6748 KB | Output is correct |
10 | Incorrect | 1 ms | 6492 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 6488 KB | Output is correct |
2 | Correct | 1 ms | 6488 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 2 ms | 6488 KB | Output is correct |
5 | Correct | 2 ms | 6488 KB | Output is correct |
6 | Correct | 1 ms | 6488 KB | Output is correct |
7 | Correct | 2 ms | 6492 KB | Output is correct |
8 | Correct | 2 ms | 6492 KB | Output is correct |
9 | Correct | 3 ms | 6748 KB | Output is correct |
10 | Incorrect | 1 ms | 6492 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |