Submission #308539

#TimeUsernameProblemLanguageResultExecution timeMemory
308539kylych03Crocodile's Underground City (IOI11_crocodile)C++14
0 / 100
1 ms384 KiB
#include "crocodile.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; vector <pair <int, int > > g[1002]; int inf =1e9+7; pair <int, int> a[100001]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0; i <=N; i++){ a[i].first=inf; a[i].second=inf; } deque <int >deq; for(int i = 0 ; i < M ;i++){ g[R[i][0]].push_back(make_pair (R[i][1], L[i]) ); g[R[i][1]].push_back( make_pair (R[i][0], L[i])); } for(int i = 0; i < K; i++){ deq.push_back(P[i]); a[P[i]] = make_pair (0,0); } while(!deq.empty()){ int v = deq.front(); deq.pop_front(); int len = a[v].second; for(int i= 0 ; i< g[v].size() ; i++ ){ int to = g[v][i].first; int dis = g[v][i].second; if(a[to].second > len + dis){ a[to].second = len + dis; if(a[to].first > a[to].second) swap(a[to].first, a[to].second); if(a[to].second!=inf) deq.push_back(to); } } } return a[0].second; } /* 5 4 3 0 1 2 0 2 3 3 2 1 2 4 4 1 3 4 */

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:28:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int i= 0 ; i< g[v].size() ; i++ ){
      |                        ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...