Submission #120929

# Submission time Handle Problem Language Result Execution time Memory
120929 2019-06-25T18:21:38 Z Runtime_error_ Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
714 ms 56408 KB
#include <vector>
#include <queue>
#include <utility>
#include "crocodile.h"
using namespace std;
typedef pair<int,int> pi;
 
int v0[100005], v1[100005];
priority_queue<pi,vector<pi>,greater<pi> > pq;
vector<pi> graph[100005];
 
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    for (int i=0; i<M; i++) {
        graph[R[i][0]].push_back(pi(L[i],R[i][1]));
        graph[R[i][1]].push_back(pi(L[i],R[i][0]));
    }
    for (int i=0; i<K; i++) {
        v0[P[i]] = 1;
        pq.push(pi(0,P[i]));
    }
    while (!pq.empty()) {
        pi x = pq.top();
        pq.pop();
        if(v0[x.second] == 0){
            v0[x.second] = 1;
            continue;
        }
        if(v1[x.second]) continue;
        v1[x.second] = 1;
        if(x.second == 0) return x.first;
        for (int i=0; i<graph[x.second].size(); i++) {
            pi t = graph[x.second][i];
            pq.push(pi(t.first + x.first,t.second));
        }
    }
    return -1;
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:31:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i<graph[x.second].size(); i++) {
                       ~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 4 ms 2688 KB Output is correct
3 Correct 4 ms 2660 KB Output is correct
4 Correct 4 ms 2688 KB Output is correct
5 Correct 5 ms 2816 KB Output is correct
6 Correct 4 ms 2816 KB Output is correct
7 Correct 4 ms 2688 KB Output is correct
8 Correct 4 ms 2688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 4 ms 2688 KB Output is correct
3 Correct 4 ms 2660 KB Output is correct
4 Correct 4 ms 2688 KB Output is correct
5 Correct 5 ms 2816 KB Output is correct
6 Correct 4 ms 2816 KB Output is correct
7 Correct 4 ms 2688 KB Output is correct
8 Correct 4 ms 2688 KB Output is correct
9 Correct 5 ms 2944 KB Output is correct
10 Correct 4 ms 2688 KB Output is correct
11 Correct 4 ms 2816 KB Output is correct
12 Correct 9 ms 3456 KB Output is correct
13 Correct 6 ms 3044 KB Output is correct
14 Correct 4 ms 2688 KB Output is correct
15 Correct 4 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 4 ms 2688 KB Output is correct
3 Correct 4 ms 2660 KB Output is correct
4 Correct 4 ms 2688 KB Output is correct
5 Correct 5 ms 2816 KB Output is correct
6 Correct 4 ms 2816 KB Output is correct
7 Correct 4 ms 2688 KB Output is correct
8 Correct 4 ms 2688 KB Output is correct
9 Correct 5 ms 2944 KB Output is correct
10 Correct 4 ms 2688 KB Output is correct
11 Correct 4 ms 2816 KB Output is correct
12 Correct 9 ms 3456 KB Output is correct
13 Correct 6 ms 3044 KB Output is correct
14 Correct 4 ms 2688 KB Output is correct
15 Correct 4 ms 2816 KB Output is correct
16 Correct 595 ms 56408 KB Output is correct
17 Correct 94 ms 10488 KB Output is correct
18 Correct 110 ms 11864 KB Output is correct
19 Correct 714 ms 51156 KB Output is correct
20 Correct 297 ms 36600 KB Output is correct
21 Correct 51 ms 6264 KB Output is correct
22 Correct 587 ms 32344 KB Output is correct