Submission #628226

# Submission time Handle Problem Language Result Execution time Memory
628226 2022-08-13T08:27:34 Z abcvuitunggio Crocodile's Underground City (IOI11_crocodile) C++17
89 / 100
538 ms 93372 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    ll INF=1e18,d[N][2];
    vector <pair <ll, ll> > ke[N];
    priority_queue<pair <ll, ll>, vector <pair <ll, ll> >, greater <pair <ll, ll> > > q;
    for (int i=0;i<M;i++)
        for (int j=0;j<2;j++)
            ke[R[i][j]].push_back({R[i][j^1],L[i]});
    for (int i=0;i<N;i++)
        d[i][0]=d[i][1]=INF;
    for (int i=0;i<K;i++){
        q.push({0,P[i]});
        d[P[i]][0]=d[P[i]][1]=0;
    }
    while (!q.empty()){
        ll u=q.top().second,du=q.top().first;
        q.pop();
        if (du!=d[u][1])
            continue;
        for (auto [v,w]:ke[u]){
            if (d[v][0]>d[u][1]+w){
                d[v][1]=d[v][0];
                d[v][0]=d[u][1]+w;
                q.push({d[v][1],v});
                continue;
            }
            if (d[v][1]>d[u][1]+w){
                d[v][1]=d[u][1]+w;
                q.push({d[v][1],v});
            }
        }
    }
    return d[0][1];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 448 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 448 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 724 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 3 ms 956 KB Output is correct
13 Correct 3 ms 1108 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 448 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 724 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 3 ms 956 KB Output is correct
13 Correct 3 ms 1108 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 425 ms 83588 KB Output is correct
17 Correct 86 ms 19852 KB Output is correct
18 Correct 110 ms 22244 KB Output is correct
19 Correct 538 ms 93372 KB Output is correct
20 Correct 259 ms 65708 KB Output is correct
21 Correct 52 ms 8680 KB Output is correct
22 Incorrect 284 ms 62996 KB Output isn't correct
23 Halted 0 ms 0 KB -