Submission #29498

# Submission time Handle Problem Language Result Execution time Memory
29498 2017-07-19T13:53:36 Z Nikefor Crocodile's Underground City (IOI11_crocodile) C++
0 / 100
956 ms 218944 KB
#include "crocodile.h"
#include<bits/stdc++.h>
#define ii pair<int,int>
#define ll pair<long,long>
using namespace std;
int visit[100002];
int res;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    priority_queue<ll, vector<ll>, greater<ll> > q;
    vector<ll> adj[N+2];
    for(int i=0; i<M; i++) {
        int v1 = R[i][0], v2 = R[i][1];
        adj[v1].push_back(make_pair(v2,i));
        adj[v2].push_back(make_pair(v1,i));
    }
    for(int i=0; i<K; i++) { q.push(make_pair(0,P[i])); visit[P[i]]++; }
    while(!q.empty()) {
         ll e = q.top();
         long v = e.second;
     //    printf("%d deyim\n", v);
         q.pop();
         if(!visit[v]) {
            visit[v]++;
            continue;
         }
         visit[v]++;
        if(!v){
            res = e.first;
            break;
        }
        for(long i=0; i<adj[v].size(); i++) {
            if(visit[adj[v][i].first]<2) q.push(make_pair(e.first+L[adj[v][i].second], adj[v][i].first ));
        }

    }
  return res;
}


Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:32:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(long i=0; i<adj[v].size(); i++) {
                        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 119796 KB Output is correct
2 Correct 0 ms 119796 KB Output is correct
3 Incorrect 0 ms 119796 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 120332 KB Output is correct
2 Correct 0 ms 119796 KB Output is correct
3 Incorrect 0 ms 120108 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 956 ms 218944 KB Output isn't correct
2 Halted 0 ms 0 KB -