# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148284 | karma | Crocodile's Underground City (IOI11_crocodile) | C++14 | 641 ms | 37696 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "crocodile.h"
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
const int N = int(1e5) + 2;
const int oo = int(1e9) + 7;
typedef pair<int, int> pii;
pii top;
int8_t vis[N];
vector<int> a[N];
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[])
{
priority_queue<pii, vector<pii>, greater<pii>> pq;
for(int i = 0; i < m; ++i) a[r[i][0]].pb(i), a[r[i][1]].pb(i);
for(int i = 0; i < k; ++i) vis[p[i]] = 1, pq.push(mp(0, p[i]));
int v;
while(!pq.empty()) {
top = pq.top(); pq.pop();
if(!vis[top.se]) ++vis[top.se];
else if(vis[top.se] == 1) {
if(!top.se) return top.fi;
++vis[top.se];
for(int i: a[top.se]) {
Compilation message (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... |