Submission #492920

# Submission time Handle Problem Language Result Execution time Memory
492920 2021-12-09T18:15:11 Z Newtech66 Crocodile's Underground City (IOI11_crocodile) C++17
89 / 100
577 ms 93324 KB
#include "crocodile.h"
#include<bits/stdc++.h>
using namespace std;
using lol=long long int;
const lol inf=1e18+8;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    vector<vector<pair<int,lol> > > g(N);
    for(int i=0;i<M;i++)
    {
        g[R[i][0]].push_back({R[i][1],L[i]});
        g[R[i][1]].push_back({R[i][0],L[i]});
    }
    priority_queue<pair<lol,int>,vector<pair<lol,int> >,greater<pair<lol,int> > > pq;
    vector<lol> mn(N,inf);
    vector<lol> smn(N,inf);
    for(int i=0;i<K;i++)
    {
        pq.push({0,P[i]});
        mn[P[i]]=smn[P[i]]=0;
    }
    while(!pq.empty())
    {
        auto [dist,u]=pq.top();
        pq.pop();
        if(dist>smn[u]) continue;
        for(auto [v,w]:g[u])
        {
            lol nxt=w+dist;
            if(nxt<=mn[v])
            {
                smn[v]=mn[v];
                mn[v]=nxt;
                pq.push({smn[v],v});
            }else if(nxt<smn[v])
            {
                smn[v]=nxt;
                pq.push({smn[v],v});
            }
        }
    }
    return smn[0];
}


# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 444 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 444 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 2 ms 728 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 3 ms 972 KB Output is correct
13 Correct 3 ms 1100 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 444 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 2 ms 728 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 3 ms 972 KB Output is correct
13 Correct 3 ms 1100 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 447 ms 81652 KB Output is correct
17 Correct 88 ms 19804 KB Output is correct
18 Correct 116 ms 22256 KB Output is correct
19 Correct 577 ms 93324 KB Output is correct
20 Correct 259 ms 65736 KB Output is correct
21 Correct 40 ms 8696 KB Output is correct
22 Incorrect 280 ms 63044 KB Output isn't correct