Submission #985421

# Submission time Handle Problem Language Result Execution time Memory
985421 2024-05-17T19:42:52 Z kkkkkkkk Cyberland (APIO23_cyberland) C++17
15 / 100
21 ms 7288 KB
#include <bits/stdc++.h>

using namespace std;

vector<pair<int,int> > G[100005];
double rez=0;
int N;
vector<int> arr1;

void dijkstra(int poc) {
    bool vis[N]={0};
    double dist[N];
    for (int i=0;i<N;i++)
        dist[i]=1e15;
    priority_queue<pair<double,int> > pq;
    pq.push({0,poc});
    dist[poc]=0;
    int t=-1;
    while (!pq.empty()) {
        int teme=pq.top().second;
        pq.pop();
        if (vis[teme]) continue;
        vis[teme]=1;
        if (arr1[teme]==0||teme==0) {
            t=teme;
            break;
        }
        for (auto x:G[teme]) {
            int next=x.first, dist_between=x.second;
            if (dist[next]>dist[teme]+dist_between) {
                dist[next]=dist[teme]+dist_between;
                pq.push({-dist[next], next});
            }
        }
    }
    if (t==-1) rez=-1;
    else rez=dist[t];
}

double solve(int n, int m, int k, int h, vector<int> a, vector<int> b, vector<int> c, vector<int> arr) {
    for (int i=0;i<n;i++)
        G[i].clear();
    N=n;
    arr1=arr;
    for (int i=0;i<m;i++) {
        G[a[i]].push_back({b[i],c[i]});
        G[b[i]].push_back({a[i],c[i]});
    }
    dijkstra(h);
    return rez;
}
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 2908 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2904 KB Correct.
2 Correct 18 ms 3164 KB Correct.
3 Correct 14 ms 2908 KB Correct.
4 Correct 15 ms 2908 KB Correct.
5 Correct 15 ms 2832 KB Correct.
6 Correct 13 ms 3420 KB Correct.
7 Correct 17 ms 3420 KB Correct.
8 Correct 10 ms 4188 KB Correct.
9 Correct 15 ms 2652 KB Correct.
10 Correct 15 ms 2652 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 2908 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 7288 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 2908 KB Correct.
2 Correct 21 ms 2996 KB Correct.
3 Correct 20 ms 2968 KB Correct.
4 Correct 17 ms 3672 KB Correct.
5 Correct 15 ms 2852 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 2908 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 2908 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 3180 KB Wrong Answer.
2 Halted 0 ms 0 KB -