# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
772772 | 2023-07-04T11:10:41 Z | canadavid1 | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 611 ms | 91672 KB |
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; using i32 = int32_t; using u64 = uint64_t; struct Node { vector<Node*> n; vector<int> ew; i32 tte=INT_MAX; i32 min_val_neigh=INT_MAX; }; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector<Node> node(N); for(int i = 0; i < M; i++) { node[R[i][0]].n.push_back(&node[R[i][1]]); node[R[i][0]].ew.push_back(L[i]); node[R[i][1]].n.push_back(&node[R[i][0]]); node[R[i][1]].ew.push_back(L[i]); } priority_queue<pair<i32,Node*>,vector<pair<i32,Node*>>,greater<pair<i32,Node*>>> q; for(int i = 0; i < K; i++) q.push({0,&node[P[i]]}); while(q.size()) { auto[p,a] = q.top(); q.pop(); //cout << a-&node[0] << " " << p << "\n"; if(a->tte!=INT_MAX) continue; a->tte = p; //if(a==&node[0]) return a->tte; for(int i = 0; i < a->n.size();i++) { auto b = a->n[i]; auto w = a->ew[i]; if(b->tte != INT_MAX) continue; if(b->min_val_neigh==INT_MAX) b->min_val_neigh = w+a->tte; else { int ptime; if(b->min_val_neigh > a->tte+w) { ptime = b->min_val_neigh; b->min_val_neigh = a->tte+w; } else ptime = a->tte+w; q.push({ptime,b}); } } } return node[0].tte; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 2 ms | 808 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 5 ms | 1236 KB | Output is correct |
13 | Correct | 4 ms | 1344 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 2 ms | 808 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 468 KB | Output is correct |
12 | Correct | 5 ms | 1236 KB | Output is correct |
13 | Correct | 4 ms | 1344 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 468 KB | Output is correct |
16 | Correct | 536 ms | 83924 KB | Output is correct |
17 | Correct | 72 ms | 19300 KB | Output is correct |
18 | Correct | 80 ms | 20856 KB | Output is correct |
19 | Correct | 611 ms | 91672 KB | Output is correct |
20 | Correct | 369 ms | 74540 KB | Output is correct |
21 | Correct | 32 ms | 8124 KB | Output is correct |
22 | Correct | 333 ms | 54968 KB | Output is correct |