# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
813476 | 2023-08-07T18:38:43 Z | annabeth9680 | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 392 ms | 53532 KB |
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5+5; vector<pair<int,int>> adj[MAXN]; vector<int> dist[MAXN]; int vis[MAXN]; int travel_plan(int N, int M, int R[][2], int L[], int K, int exits[]){ for(int i = 0;i<M;++i){ adj[R[i][0]].push_back({L[i],R[i][1]}); adj[R[i][1]].push_back({L[i],R[i][0]}); } priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq; for(int i = 0;i<K;++i){ dist[exits[i]].push_back(0); dist[exits[i]].push_back(0); vis[exits[i]]++; pq.push({0,exits[i]}); } while(!pq.empty()){ int u = pq.top().second, cdist = pq.top().first; pq.pop(); if(vis[u] >= 2) continue; vis[u]++; if(vis[u] != 2) continue; if(u == 0) return cdist; for(auto p : adj[u]){ int cur = cdist+p.first, v = p.second; if(dist[v].size() < 2){ dist[v].push_back(cur); pq.push({cur,v}); } else if(dist[v].size() == 2){ if(dist[v][0] > dist[v][1]) swap(dist[v][0],dist[v][1]); if(dist[v][1] > cur){ dist[v].pop_back(); dist[v].push_back(cur); pq.push({cur,v}); } } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 4 ms | 4948 KB | Output is correct |
3 | Correct | 4 ms | 4948 KB | Output is correct |
4 | Correct | 3 ms | 5076 KB | Output is correct |
5 | Correct | 3 ms | 5076 KB | Output is correct |
6 | Correct | 3 ms | 5076 KB | Output is correct |
7 | Correct | 3 ms | 5076 KB | Output is correct |
8 | Correct | 3 ms | 5024 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 4 ms | 4948 KB | Output is correct |
3 | Correct | 4 ms | 4948 KB | Output is correct |
4 | Correct | 3 ms | 5076 KB | Output is correct |
5 | Correct | 3 ms | 5076 KB | Output is correct |
6 | Correct | 3 ms | 5076 KB | Output is correct |
7 | Correct | 3 ms | 5076 KB | Output is correct |
8 | Correct | 3 ms | 5024 KB | Output is correct |
9 | Correct | 4 ms | 5204 KB | Output is correct |
10 | Correct | 2 ms | 5012 KB | Output is correct |
11 | Correct | 3 ms | 5076 KB | Output is correct |
12 | Correct | 5 ms | 5460 KB | Output is correct |
13 | Correct | 4 ms | 5460 KB | Output is correct |
14 | Correct | 3 ms | 4948 KB | Output is correct |
15 | Correct | 3 ms | 5076 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 4 ms | 4948 KB | Output is correct |
3 | Correct | 4 ms | 4948 KB | Output is correct |
4 | Correct | 3 ms | 5076 KB | Output is correct |
5 | Correct | 3 ms | 5076 KB | Output is correct |
6 | Correct | 3 ms | 5076 KB | Output is correct |
7 | Correct | 3 ms | 5076 KB | Output is correct |
8 | Correct | 3 ms | 5024 KB | Output is correct |
9 | Correct | 4 ms | 5204 KB | Output is correct |
10 | Correct | 2 ms | 5012 KB | Output is correct |
11 | Correct | 3 ms | 5076 KB | Output is correct |
12 | Correct | 5 ms | 5460 KB | Output is correct |
13 | Correct | 4 ms | 5460 KB | Output is correct |
14 | Correct | 3 ms | 4948 KB | Output is correct |
15 | Correct | 3 ms | 5076 KB | Output is correct |
16 | Correct | 315 ms | 51252 KB | Output is correct |
17 | Correct | 66 ms | 18828 KB | Output is correct |
18 | Correct | 71 ms | 18448 KB | Output is correct |
19 | Correct | 392 ms | 53532 KB | Output is correct |
20 | Correct | 216 ms | 45772 KB | Output is correct |
21 | Correct | 31 ms | 10864 KB | Output is correct |
22 | Correct | 241 ms | 41668 KB | Output is correct |