Submission #1002271

# Submission time Handle Problem Language Result Execution time Memory
1002271 2024-06-19T11:45:50 Z ZeroCool Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
0 ms 444 KB
#include "crocodile.h"
#include <bits/stdc++.h>

using namespace std;


#define ll long long
#define ar array

const ll INF = 1e17;

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){
	vector<ar<int, 2> > g[n];
	for(int i = 0;i <m;i++){
		g[r[i][0]].push_back({r[i][1], l[i]});
		g[r[i][1]].push_back({r[i][0], l[i]});
	}
	
	ar<ll, 2> dist[n];
	for(int i = 0;i < n;i++)dist[i] = {INF, INF};
	
	priority_queue<ar<ll, 2> > q;
	for(int i = 0;i < k;i++){
		q.push({0, p[i]});
		dist[p[i]] = {0, 0};
	}
	
	while(q.size()){
		int x = q.top()[1];
		q.pop();
	
		for(auto [u, w]: g[x]){
			if(dist[u][0] > dist[x][1] + w){
				dist[u][1] = dist[u][0];
				dist[u][0] = dist[x][1] +w ;
				q.push({-dist[u][1], u});
			}else if(dist[u][1] > dist[x][1] +w ){
				dist[u][1] = dist[x][1] + w;
				q.push({-dist[u][1], u});
			}
			
		}
	}
	return dist[0][1];
}


Compilation message

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