Submission #599723

# Submission time Handle Problem Language Result Execution time Memory
599723 2022-07-19T19:36:40 Z Meloric Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
0 ms 212 KB
#include "crocodile.h"
#include <bits/stdc++.h>

#define pb push_back
//#define int int64_t
#define pii pair<int, int>
#define X first
#define Y second
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound

using namespace std;

int travel_plan(int n, int m, int R[][2], int L[], int k, int P[]){
	vector<vector<pii>> g(n, vector<pii>());
	for(int i = 0; i< m; i++){
		int c = R[i][0];
		int d = R[i][1];
		int w = L[i];
		g[c].pb({d, w});
		g[d].pb({c, w});
	}
	vector<int>v1(n,-1), v2(n,-1);
	priority_queue<pii> pq;
	for(int i = 0; i< k; i++){
		int c = P[i];
		v1[i] = 0;
		pq.push({0, c});
	}
	while(pq.size()){
		auto [u, d] = pq.top(); d = -d;
		pq.pop();
		if(v2[u] != -1)continue;
		if(v1[u] == -1){
			v1[u] = d;
			continue;
		}
		v2[u] = d;
		for(auto [v, w] : g[u])pq.push({-(w+d), v});
	}
    return v2[0];
}


Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:32:8: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   32 |   auto [u, d] = pq.top(); d = -d;
      |        ^
crocodile.cpp:40:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   40 |   for(auto [v, w] : g[u])pq.push({-(w+d), v});
      |            ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -