| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1346981 | Born_To_Laugh | 악어의 지하 도시 (IOI11_crocodile) | C++17 | 222 ms | 84092 KiB |
// Born_To_Laugh - Hughie Do
#include "crocodile.h"
#include <bits/stdc++.h>
#define alle(AC) AC.begin(), AC.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
[[maybe_unused]] const int MOD = 998244353, INF = 1e9 + 7;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
vector<vector<pair<int, ll>>> adj(N);
for (int i = 0; i < M; i++) {
int u = R[i][0];
int v = R[i][1];
ll w = L[i];
adj[u].push_back({v, w});
adj[v].push_back({u, w});
}
vector<int> vis(N, 0);
priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> pq;
for (int i = 0; i < K; i++) {
vis[P[i]] = 1;
pq.push({0, P[i]});
}
while (!pq.empty()) {
ll d = pq.top().first;
int u = pq.top().second;
pq.pop();
vis[u]++;
if (vis[u] > 2) continue;
else if (vis[u] == 1) continue;
if (u == 0) return d;
for (auto edge : adj[u]) {
int v = edge.first;
ll w = edge.second;
if (vis[v] < 2) {
pq.push({d + w, v});
}
}
}
}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... | ||||
