제출 #1175000

#제출 시각아이디문제언어결과실행 시간메모리
1175000achinhchin악어의 지하 도시 (IOI11_crocodile)C++17
100 / 100
462 ms84228 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define f first #define s second vector<pair<ll, ll> > a[100000]; priority_queue<pair<ll, ll>, vector<pair<ll, ll> >, greater<pair<ll, ll> > > b; ll c[100000], i, t, t2; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { while (M--) a[R[M][0]].push_back(make_pair(L[M], R[M][1])), a[R[M][1]].push_back(make_pair(L[M], R[M][0])); while (N--) c[N] = -1; while (K--) c[P[K]] = -2, b.push(make_pair(0, P[K])); while (!b.empty()) { t = b.top().s, t2 = b.top().f, b.pop(); if (c[t] > -2) { if (c[t] == -1) c[t]--; continue; }c[t] = t2; for (auto i: a[t]) if (c[i.s] < 0) b.push(make_pair(c[t] + i.f, i.s)); }return c[0]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...