Submission #932017

# Submission time Handle Problem Language Result Execution time Memory
932017 2024-02-22T19:48:49 Z TheComputer Cyberland (APIO23_cyberland) C++17
0 / 100
22 ms 5724 KB
#include <bits/stdc++.h>

double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr){
	
	std::vector<std::vector<std::pair<int,int>>> adj(N);
	for(int i = 0; i < M; i++) adj[x[i]].push_back({y[i],c[i]}),adj[y[i]].push_back({x[i],c[i]});
	
	std::vector<std::pair<double,int>> res;
	
	std::priority_queue<std::pair<int,int>> pq;
	std::vector<double> dist(N,(int)1e20);
	dist[H-1]=0;
	pq.push({0,H-1});
	while(!pq.empty()){
		std::pair<int,int> nd = pq.top();
		nd.first*=-1;
		pq.pop();
		for(int i = 0; i < (int)adj[nd.second].size(); i++){
			if(dist[adj[nd.second][i].first]>nd.first+adj[nd.second][i].second){
				dist[adj[nd.second][i].first] = nd.first+adj[nd.second][i].second;
				if(arr[adj[nd.second][i].first]==1&&adj[nd.second][i].first!=0) pq.push({(nd.first+adj[nd.second][i].second)*-1,adj[nd.second][i].first});
				else res.push_back({nd.first+adj[nd.second][i].second,adj[nd.second][i].first});
			}
		}
	}
	double r = (int)1e20;
	for(int i = 0; i < (int)res.size(); i++){
		r=std::min(res[i].first,r);
	}
	return r;
}
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 476 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 600 KB Double -1.80122e+09 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 344 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 5724 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 604 KB Double -1.88673e+09 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 600 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 516 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1372 KB Wrong Answer.
2 Halted 0 ms 0 KB -