Submission #1061391

# Submission time Handle Problem Language Result Execution time Memory
1061391 2024-08-16T08:34:23 Z Muhammet Cyberland (APIO23_cyberland) C++17
0 / 100
17 ms 8792 KB
#include <bits/stdc++.h>
#include "cyberland.h"

using namespace std;

#define ff first
#define ss second

vector <pair<int,int>> v[200005];

double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
    for(int i = 0; i <= n; i++){
        v[i].clear();
    }
    for(int i = 0; i < m; i++){
        v[x[i]].push_back({y[i],c[i]});
        v[y[i]].push_back({x[i],c[i]});
    }
    vector <int> d(n,1e9);
    d[0] = 0;
    priority_queue <pair<int,int>> q;
    q.push({0,0});
    while(!q.empty()){
        pair <int,int> w1 = q.top();
        q.pop();
        w1.ff *= (-1);
        if(w1.ff != d[w1.ss]) continue;
        for(auto i : v[w1.ss]){
            if(d[i.ff] > d[w1.ss] + i.ss){
                d[i.ff] = d[w1.ss] + i.ss;
                q.push({-d[i.ff],i.ff});
            }
        }
    }
    if(d[h] == 1e9) d[h] = -1;
    return d[h];
}
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 5464 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 5212 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 5212 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 8792 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 5208 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 5208 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 5468 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 5720 KB Wrong Answer.
2 Halted 0 ms 0 KB -