Submission #29186

#TimeUsernameProblemLanguageResultExecution timeMemory
29186kavunCrocodile's Underground City (IOI11_crocodile)C++14
100 / 100
896 ms173196 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; priority_queue <ii> Q; vector<ii> adj[150010]; int mk[150010]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0; i < M; i++) { int v = R[i][0], u = R[i][1], l = L[i]; adj[v].push_back(make_pair(u,l)); adj[u].push_back(make_pair(v,l)); } for(int i = 0; i < K; i++) { Q.push(make_pair(0,P[i])); mk[P[i]] = 1; } while(!Q.empty()) { int v = Q.top().second; int val = -Q.top().first; Q.pop(); if(mk[v] == 1) { for(int i = 0; i < adj[v].size(); i++) Q.push(ii(-(adj[v][i].second + val),adj[v][i].first)); if(v == 0) return val; } mk[v]++; } return -1; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:34:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < adj[v].size(); i++)
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...