# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
696114 | jiahng | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 1529 ms | 105860 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pi;
typedef vector <int> vi;
typedef vector <pi> vpi;
typedef pair<pi, ll> pii;
typedef set <ll> si;
typedef long double ld;
#define f first
#define s second
#define mp make_pair
#define FOR(i,s,e) for(int i=s;i<=int(e);++i)
#define DEC(i,s,e) for(int i=s;i>=int(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define maxn 200010
#define INF (ll)1e18
#define MOD 1000000007
typedef pair <vi, int> pvi;
typedef pair <int,pi> ipi;
typedef vector <pii> vpii;
#define DEBUG 0
vpi adj[maxn];
ll dist[maxn];
multiset <int> cost[maxn];
int32_t travel_plan(int32_t N, int32_t M, int32_t R[][2], int32_t L[], int32_t K, int32_t P[])
{
FOR(i,0,M-1){
adj[R[i][0]].pb(pi(R[i][1], L[i]));
adj[R[i][1]].pb(pi(R[i][0], L[i]));
}
set <pi> st;
mem(dist, -1);
mem(cost, INF);
FOR(i,0,K-1){
st.insert(pi(0, P[i]));
dist[P[i]] = 0;
}
FOR(i,0,N-1) cost[i].insert(INF);
while (!st.empty()){
pi cur = *st.begin(); st.erase(st.begin());
//cout << cur.f << ' ' << cur.s << '\n';
//if (cur.f == 4 && cur.s == 4) break;
dist[cur.s] = cur.f;
aFOR(i, adj[cur.s]) if (dist[i.f] == -1){
st.erase(pi(*cost[i.f].rbegin(), i.f));
cost[i.f].insert(cur.f + i.s);
while (cost[i.f].size() > 2) cost[i.f].erase(--cost[i.f].end());
st.insert(pi(*cost[i.f].rbegin(), i.f));
}
}
return dist[0];
}
컴파일 시 표준 에러 (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... |