Submission #568194

# Submission time Handle Problem Language Result Execution time Memory
568194 2022-05-24T21:16:45 Z n0sk1ll Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
1091 ms 92012 KB
#include "crocodile.h"

#include <bits/stdc++.h>

#define xx first
#define yy second

using namespace std;
long long int typedef li;

vector<vector<pair<int,int>>> g(100003);
li dp[100003]; bitset<100003> vis,izlaz;

int travel_plan(int n, int m, int R[][2], int L[], int K, int P[])
{
    for (int i=0;i<m;i++)
    {
        g[R[i][0]].push_back({L[i],R[i][1]});
        g[R[i][1]].push_back({L[i],R[i][0]});
    }

    priority_queue<pair<li,int>,vector<pair<li,int>>,greater<pair<li,int>>> pq;
    for (int i=0;i<K;i++) pq.push({0,P[i]}),vis[P[i]]=1;
    while (!pq.empty())
    {
        li d=pq.top().xx;
        int p=pq.top().yy;
        pq.pop();

        if (dp[p]) continue;
        if (izlaz[p]) continue;
        if (vis[p])
        {
            dp[p]=d,izlaz[p]=1;
            for (auto it : g[p]) pq.push({dp[p]+it.xx,it.yy});
        }
        else vis[p]=1;
    }
    return dp[0];
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2664 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 3 ms 2772 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2664 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 3 ms 2772 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2772 KB Output is correct
9 Correct 4 ms 3284 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2816 KB Output is correct
12 Correct 8 ms 3716 KB Output is correct
13 Correct 7 ms 3792 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 3 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2664 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 3 ms 2772 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2772 KB Output is correct
9 Correct 4 ms 3284 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2816 KB Output is correct
12 Correct 8 ms 3716 KB Output is correct
13 Correct 7 ms 3792 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 3 ms 2772 KB Output is correct
16 Correct 994 ms 89088 KB Output is correct
17 Correct 82 ms 13756 KB Output is correct
18 Correct 114 ms 15256 KB Output is correct
19 Correct 1091 ms 92012 KB Output is correct
20 Correct 622 ms 82540 KB Output is correct
21 Correct 48 ms 7680 KB Output is correct
22 Correct 551 ms 46856 KB Output is correct