Submission #630178

#TimeUsernameProblemLanguageResultExecution timeMemory
630178NintsiChkhaidzeCrocodile's Underground City (IOI11_crocodile)C++14
0 / 100
2 ms2644 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; #define s second #define pb push_back #define f first const int nn = 100005; vector <pair<int,int> > v[nn]; int dis[nn]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ for (int i = 0; i < M; i++){ v[R[i][0]].pb({R[i][1],L[i]}); v[R[i][1]].pb({R[i][0],L[i]}); } for (int i = 1; i < N; i++) dis[i] = 1e9; priority_queue< pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq; pq.push({0,0}); dis[0] = 0; while(pq.size()){ int x = pq.top().s,d = pq.top().f; pq.pop(); if (dis[x] != d) continue; for (auto [to,w]: v[x]){ if (dis[to] > d + w){ dis[to] = d + w; pq.push({dis[to],to}); } } } int ans = 0; for (int i = 0; i < K; i++) ans = max(ans, dis[P[i]]); return ans; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:29:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   29 |         for (auto [to,w]: v[x]){
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...