Submission #337302

# Submission time Handle Problem Language Result Execution time Memory
337302 2020-12-19T13:39:31 Z r_v_n Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
829 ms 54748 KB
using namespace std;
#include <bits/stdc++.h>
#define ll long long
int n;
int m, k;
vector<pair<int, int>> adj[100001];
int is[100001];
    vector<int> d(100000 + 1, 1e9);
    vector<int> visited(100000 + 1, 0);
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    for (int i = 0; i < M; i++)
    {
        adj[R[i][0]].push_back(make_pair(R[i][1], L[i]));
        adj[R[i][1]].push_back(make_pair(R[i][0], L[i]));
    }


    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
    for (int i = 0; i < K; i++)
    {
        //is[P[i]] = 1;
        q.push({0, P[i]});
        visited[P[i]] = 1;
    }
    while (!q.empty())
    {
        int u = q.top().second;
        int cost = q.top().first;
        q.pop();
        if (visited[u] == 1)
        {
            is[u] = 1;
            d[u] = cost;
            for (int i = 0; i < (int)adj[u].size(); i++)
            {
                int v = adj[u][i].first;
                int cst = adj[u][i].second;
                if (!is[v])
                    q.push(make_pair((cost + cst), v));
            }
        }
        visited[u]++;
    }
    return d[0];
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3436 KB Output is correct
2 Correct 2 ms 3436 KB Output is correct
3 Correct 3 ms 3436 KB Output is correct
4 Correct 3 ms 3584 KB Output is correct
5 Correct 3 ms 3564 KB Output is correct
6 Correct 3 ms 3564 KB Output is correct
7 Correct 3 ms 3564 KB Output is correct
8 Correct 3 ms 3584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3436 KB Output is correct
2 Correct 2 ms 3436 KB Output is correct
3 Correct 3 ms 3436 KB Output is correct
4 Correct 3 ms 3584 KB Output is correct
5 Correct 3 ms 3564 KB Output is correct
6 Correct 3 ms 3564 KB Output is correct
7 Correct 3 ms 3564 KB Output is correct
8 Correct 3 ms 3584 KB Output is correct
9 Correct 5 ms 3820 KB Output is correct
10 Correct 2 ms 3436 KB Output is correct
11 Correct 4 ms 3564 KB Output is correct
12 Correct 7 ms 4204 KB Output is correct
13 Correct 8 ms 4332 KB Output is correct
14 Correct 3 ms 3564 KB Output is correct
15 Correct 3 ms 3564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3436 KB Output is correct
2 Correct 2 ms 3436 KB Output is correct
3 Correct 3 ms 3436 KB Output is correct
4 Correct 3 ms 3584 KB Output is correct
5 Correct 3 ms 3564 KB Output is correct
6 Correct 3 ms 3564 KB Output is correct
7 Correct 3 ms 3564 KB Output is correct
8 Correct 3 ms 3584 KB Output is correct
9 Correct 5 ms 3820 KB Output is correct
10 Correct 2 ms 3436 KB Output is correct
11 Correct 4 ms 3564 KB Output is correct
12 Correct 7 ms 4204 KB Output is correct
13 Correct 8 ms 4332 KB Output is correct
14 Correct 3 ms 3564 KB Output is correct
15 Correct 3 ms 3564 KB Output is correct
16 Correct 758 ms 52312 KB Output is correct
17 Correct 84 ms 14060 KB Output is correct
18 Correct 123 ms 15468 KB Output is correct
19 Correct 829 ms 54748 KB Output is correct
20 Correct 499 ms 48960 KB Output is correct
21 Correct 44 ms 8428 KB Output is correct
22 Correct 452 ms 36076 KB Output is correct