# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1082066 | CELD_07 | Crocodile's Underground City (IOI11_crocodile) | C++17 | 362 ms | 93356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define ll long long
#define endl "\n"
#define inf 1e15
#define vll vector<ll>
#define sd second
#define ft first
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define pll pair<ll, ll>
#define mod 1000000007
#define _set tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
vector<vector<pair<ll, ll>>> adj;
vector<pair<ll, ll>> dist;
vector<bool> visited;
inline void dijkstra(int g[], int k){
priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
for(int i=0; i<k; i++)pq.push({0, g[i]}), dist[g[i]]={0, 0};
while(!pq.empty()){
ll o, o1;
tie(o, o1)=pq.top();
pq.pop();
if(visited[o1])continue;
visited[o1]=1;
for(auto& [y, w]: adj[o1]){
if(o+w<dist[y].ft){
dist[y].sd=dist[y].ft;
dist[y].ft=o+w;
pq.push({dist[y].sd, y});
}else if(dist[y].sd>o+w){
dist[y].sd=o+w;
pq.push({dist[y].sd, y});
}
}
}
}
int travel_plan(int N, int M, int R[][2], int W[], int K, int E[]){
ll a, b, c, d, e;
adj.clear();
dist.clear();
visited.clear();
visited.assign(N+1, 0);
adj.resize(N+1);
dist.assign(N+1, {inf, inf});
for(int i=0; i<M; i++){
adj[R[i][0]].push_back({R[i][1], W[i]});
adj[R[i][1]].push_back({R[i][0], W[i]});
}
dijkstra(E, K);
return dist[0].sd;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |