# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
834209 | 2023-08-22T11:55:19 Z | ttamx | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 353 ms | 61232 KB |
#include "crocodile.h" #include<bits/stdc++.h> using namespace std; typedef pair<int,int> p2; const int N=1e5+5; const int inf=2e9; int n; p2 dp[N]; bool vis[N]; vector<p2> adj[N]; priority_queue<p2,vector<p2>,greater<p2>> pq; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ n=N; for(int i=0;i<n;i++)dp[i]={inf,inf}; for(int i=0;i<M;i++){ int u=R[i][0],v=R[i][1],w=L[i]; adj[u].emplace_back(v,w); adj[v].emplace_back(u,w); } for(int i=0;i<K;i++){ dp[P[i]]={0,0}; pq.emplace(0,P[i]); } while(!pq.empty()){ auto [d,u]=pq.top(); pq.pop(); if(vis[u])continue; vis[u]=true; for(auto [v,w]:adj[u]){ if(d+w<dp[v].second){ dp[v].second=d+w; if(dp[v].second<dp[v].first)swap(dp[v].first,dp[v].second); if(dp[v].second<inf)pq.emplace(dp[v].second,v); } } } return dp[0].second; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 1 ms | 2672 KB | Output is correct |
4 | Correct | 2 ms | 2772 KB | Output is correct |
5 | Correct | 2 ms | 2672 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2772 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 1 ms | 2672 KB | Output is correct |
4 | Correct | 2 ms | 2772 KB | Output is correct |
5 | Correct | 2 ms | 2672 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2772 KB | Output is correct |
9 | Correct | 3 ms | 2928 KB | Output is correct |
10 | Correct | 1 ms | 2664 KB | Output is correct |
11 | Correct | 3 ms | 2772 KB | Output is correct |
12 | Correct | 4 ms | 3156 KB | Output is correct |
13 | Correct | 4 ms | 3156 KB | Output is correct |
14 | Correct | 2 ms | 2668 KB | Output is correct |
15 | Correct | 2 ms | 2676 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2644 KB | Output is correct |
2 | Correct | 1 ms | 2644 KB | Output is correct |
3 | Correct | 1 ms | 2672 KB | Output is correct |
4 | Correct | 2 ms | 2772 KB | Output is correct |
5 | Correct | 2 ms | 2672 KB | Output is correct |
6 | Correct | 2 ms | 2644 KB | Output is correct |
7 | Correct | 2 ms | 2772 KB | Output is correct |
8 | Correct | 2 ms | 2772 KB | Output is correct |
9 | Correct | 3 ms | 2928 KB | Output is correct |
10 | Correct | 1 ms | 2664 KB | Output is correct |
11 | Correct | 3 ms | 2772 KB | Output is correct |
12 | Correct | 4 ms | 3156 KB | Output is correct |
13 | Correct | 4 ms | 3156 KB | Output is correct |
14 | Correct | 2 ms | 2668 KB | Output is correct |
15 | Correct | 2 ms | 2676 KB | Output is correct |
16 | Correct | 292 ms | 57192 KB | Output is correct |
17 | Correct | 54 ms | 13772 KB | Output is correct |
18 | Correct | 66 ms | 15220 KB | Output is correct |
19 | Correct | 353 ms | 61232 KB | Output is correct |
20 | Correct | 209 ms | 49528 KB | Output is correct |
21 | Correct | 27 ms | 7608 KB | Output is correct |
22 | Correct | 224 ms | 46056 KB | Output is correct |