Submission #1105306

#TimeUsernameProblemLanguageResultExecution timeMemory
1105306Zone_zoneeCrocodile's Underground City (IOI11_crocodile)C++14
0 / 100
2 ms6736 KiB
#include <bits/stdc++.h> #include "crocodile.h" using namespace std; #define MAX_N 50000 #define MAX_M 10000000 vector<pair<int, long long>> adj[MAX_N]; long long dis[MAX_N]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ for(int i = 0; i < M; ++i){ adj[R[i][0]].emplace_back(R[i][1], L[i]); adj[R[i][1]].emplace_back(R[i][0], L[i]); } memset(dis, 0x3f, sizeof dis); priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> pq; pq.emplace(0, 0); dis[0] = 0; while(!pq.empty()){ auto [d, u] = pq.top(); pq.pop(); for(auto [v, w] : adj[u]){ if(dis[v] > d + w){ pq.emplace(dis[v] = d + w, v); } } } long long res = 0; for(int i = 0; i < K; ++i) res = max(res, dis[P[i]]); return res; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:19:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   19 |     auto [d, u] = pq.top(); pq.pop();
      |          ^
crocodile.cpp:20:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   20 |     for(auto [v, w] : adj[u]){
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...