# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
337098 | 2020-12-18T11:06:13 Z | enerelt14 | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 785 ms | 67420 KB |
#include "crocodile.h" #include<bits/stdc++.h> #define pb push_back #define mp make_pair #define ff first #define ss second using namespace std; vector<pair<int, int> >adj[100005]; priority_queue<pair<int, int> >pq; bool vis[100005]={0}; int viz[100005]={0}; int path[100005]; void dijkstra(){ while(!pq.empty()){ int u=pq.top().ss; int cost=-pq.top().ff; pq.pop(); if (viz[u]==1){ vis[u]=1; path[u]=cost; for (int i=0;i<adj[u].size();i++){ int v=adj[u][i].ff; int cst=adj[u][i].ss; if (!vis[v])pq.push(mp(-(cost+cst), v)); } } viz[u]++; } } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for (int i=0;i<M;i++){ adj[R[i][0]].pb(mp(R[i][1], L[i])); adj[R[i][1]].pb(mp(R[i][0], L[i])); } for (int i=0;i<K;i++){ pq.push(mp(0, P[i])); viz[P[i]]=1; } while(!pq.empty()){ int u=pq.top().ss; int cost=-pq.top().ff; pq.pop(); if (viz[u]==1){ vis[u]=1; path[u]=cost; for (int i=0;i<adj[u].size();i++){ int v=adj[u][i].ff; int cst=adj[u][i].ss; if (!vis[v])pq.push(mp(-(cost+cst), v)); } } viz[u]++; } return path[0]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2668 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Correct | 2 ms | 2668 KB | Output is correct |
4 | Correct | 3 ms | 2796 KB | Output is correct |
5 | Correct | 3 ms | 2796 KB | Output is correct |
6 | Correct | 3 ms | 2688 KB | Output is correct |
7 | Correct | 3 ms | 2796 KB | Output is correct |
8 | Correct | 3 ms | 2796 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2668 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Correct | 2 ms | 2668 KB | Output is correct |
4 | Correct | 3 ms | 2796 KB | Output is correct |
5 | Correct | 3 ms | 2796 KB | Output is correct |
6 | Correct | 3 ms | 2688 KB | Output is correct |
7 | Correct | 3 ms | 2796 KB | Output is correct |
8 | Correct | 3 ms | 2796 KB | Output is correct |
9 | Correct | 5 ms | 3052 KB | Output is correct |
10 | Correct | 2 ms | 2668 KB | Output is correct |
11 | Correct | 3 ms | 2796 KB | Output is correct |
12 | Correct | 7 ms | 3436 KB | Output is correct |
13 | Correct | 7 ms | 3436 KB | Output is correct |
14 | Correct | 2 ms | 2796 KB | Output is correct |
15 | Correct | 3 ms | 2796 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2668 KB | Output is correct |
2 | Correct | 2 ms | 2668 KB | Output is correct |
3 | Correct | 2 ms | 2668 KB | Output is correct |
4 | Correct | 3 ms | 2796 KB | Output is correct |
5 | Correct | 3 ms | 2796 KB | Output is correct |
6 | Correct | 3 ms | 2688 KB | Output is correct |
7 | Correct | 3 ms | 2796 KB | Output is correct |
8 | Correct | 3 ms | 2796 KB | Output is correct |
9 | Correct | 5 ms | 3052 KB | Output is correct |
10 | Correct | 2 ms | 2668 KB | Output is correct |
11 | Correct | 3 ms | 2796 KB | Output is correct |
12 | Correct | 7 ms | 3436 KB | Output is correct |
13 | Correct | 7 ms | 3436 KB | Output is correct |
14 | Correct | 2 ms | 2796 KB | Output is correct |
15 | Correct | 3 ms | 2796 KB | Output is correct |
16 | Correct | 692 ms | 64600 KB | Output is correct |
17 | Correct | 80 ms | 13932 KB | Output is correct |
18 | Correct | 110 ms | 15340 KB | Output is correct |
19 | Correct | 785 ms | 67420 KB | Output is correct |
20 | Correct | 452 ms | 57816 KB | Output is correct |
21 | Correct | 44 ms | 7788 KB | Output is correct |
22 | Correct | 426 ms | 46444 KB | Output is correct |