Submission #905131

#TimeUsernameProblemLanguageResultExecution timeMemory
905131MackerCrocodile's Underground City (IOI11_crocodile)C++14
100 / 100
555 ms69712 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() //#pragma GCC optimize("Ofast") //#pragma GCC target("avx2") int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector<vector<pair<int, int>>> adj(N); vector<bool> bl(N, 0); vector<int> dist(N, INT_MAX/2); for (int i = 0; i < M; i++) { adj[R[i][0]].push_back({R[i][1], L[i]}); adj[R[i][1]].push_back({R[i][0], L[i]}); } priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q; for (int i = 0; i < K; i++) { q.push({0, P[i]}); bl[P[i]] = 1; } while(q.size()){ auto [d, a] = q.top(); q.pop(); if(!bl[a]){ bl[a] = 1; continue; } if(d < dist[a]){ dist[a] = d; for (auto &[b, c] : adj[a]) { if(dist[b] > dist[a] + c){ //dist[b] = dist[a] + c; q.push({dist[a] + c, b}); } } } } return dist[0]; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:30:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |         auto [d, a] = q.top(); q.pop();
      |              ^
crocodile.cpp:37:24: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   37 |             for (auto &[b, c] : adj[a]) {
      |                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...