# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
670838 | 2022-12-10T19:52:38 Z | Stavab | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 440 ms | 67244 KB |
#include "crocodile.h" #include <vector> #include <queue> #include <utility> using namespace std; #define INF 1999999999 vector<vector<pair<int, int>>> city; vector<int> times; vector<int> visited; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { city.assign(N, vector<pair<int, int>>()); times.assign(N, INF); visited.assign(N, 0); for (int i = 0; i < M; i++) { city[R[i][0]].push_back(make_pair(R[i][1], L[i])); city[R[i][1]].push_back(make_pair(R[i][0], L[i])); } priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; for (int i = 0; i < K; i++) { times[P[i]] = 0; visited[P[i]] = 1; for(int j = 0; j < city[P[i]].size(); j++) { if(!visited[city[P[i]][j].first]) pq.push(make_pair(city[P[i]][j].second, city[P[i]][j].first)); } } while(!pq.empty()) { int curTime = pq.top().first; int curNode = pq.top().second; if(times[curNode] == INF) times[curNode] = curTime; else { if(!visited[curNode]) { for(int j = 0; j < city[curNode].size(); j++) { if(!visited[city[curNode][j].first]) pq.push(make_pair(curTime + city[curNode][j].second, city[curNode][j].first)); } visited[curNode] = 1; times[curNode] = curTime; if(curNode == 0) return curTime; } } pq.pop(); } return -1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 3 ms | 524 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 440 KB | Output is correct |
12 | Correct | 4 ms | 948 KB | Output is correct |
13 | Correct | 3 ms | 828 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 3 ms | 524 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 440 KB | Output is correct |
12 | Correct | 4 ms | 948 KB | Output is correct |
13 | Correct | 3 ms | 828 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 413 ms | 62988 KB | Output is correct |
17 | Correct | 70 ms | 13644 KB | Output is correct |
18 | Correct | 79 ms | 15184 KB | Output is correct |
19 | Correct | 440 ms | 67244 KB | Output is correct |
20 | Correct | 255 ms | 47180 KB | Output is correct |
21 | Correct | 36 ms | 6016 KB | Output is correct |
22 | Correct | 365 ms | 44580 KB | Output is correct |