# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1052084 | fuad27 | Spy 3 (JOI24_spy3) | C++17 | 1049 ms | 7540 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 "Aoi.h"
#include <bits/stdc++.h>
using namespace std;
std::string aoi(int N, int M, int Q, int K, std::vector<int> A,
std::vector<int> B, std::vector<long long> C,
std::vector<int> T, std::vector<int> X) {
vector<vector<int>> g(N);
for(int i = 0;i<M;i++) {
g[A[i]].push_back(i);
g[B[i]].push_back(i);
}
vector<long long> dist(N, (long long)1e18);
vector<int> pr(N, -1);
dist[0] = 0;
priority_queue<pair<long long, int>> pq;
pq.push({0, 0});
vector<int> bad_edge(M);
for(auto i=0;i<X.size();i++)bad_edge[X[i]]=i+1;
vector<bool> vis(N);
while(pq.size()) {
int at = pq.top().second;
pq.pop();
if(vis[at])continue;
vis[at]=1;
for(int idx:g[at]) {
int to = (at^A[idx]^B[idx]);
long long w = C[idx];
if(dist[to] > dist[at] + w) {
dist[to] = dist[at] + w;
pr[to] = idx;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |