Submission #984754

# Submission time Handle Problem Language Result Execution time Memory
984754 2024-05-17T04:46:09 Z MuhammadSaram Cyberland (APIO23_cyberland) C++17
0 / 100
29 ms 6976 KB
/********************* بسم الله الرحمن الرحيم ***********************/
 /******************** ٱلْحَمْدُ لِلَّٰهِ رَبِّ ٱلْعَالَمِينَ *************************/
/******************* Prophet Muhammad صلى الله عليه وسلم ************/
   /*********************** وَقُل رَّبِّ زِدْنِي عِلْمًا **************************/

#ifdef ONLINE_JUDGE
	#pragma GCC optimize("Ofast")
	#pragma GCC optimize("O3,unroll-loops")
	#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#else

#endif

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define in binary_search
#define ll long long
#define ld long double
#define Hey ios::sync_with_stdio(false);
#define Welcome cin.tie(NULL), cout.tie(NULL);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()

const int M = 1e5 + 1;
const double inf = 1e15;

vector<pair<int,int>> nei[M];

double dijkstra(int h,vector<int> a)
{
	int n=a.size();
	double dis[n];
	dis[0]=0;
	for (int i=1;i<n;i++)
		dis[i]=inf;
	set<pair<int,int>> se;
	se.insert({0,0});
	while (!se.empty())
	{
		auto x=*se.begin();
		int u=x.second,d=x.first;
		se.erase(x);
		if (u==h)
			continue;
		for (auto i:nei[u])
			if (dis[i.first]>(double)(d+i.second)*a[i.first])
			{
				se.erase({dis[i.first],i.first});
				dis[i.first]=(double)(d+i.second)*a[i.first];
				se.insert({dis[i.first],i.first});
			}
	}
	if (dis[h]==inf)
		dis[h]=-1;
	return dis[h];
}

double solve(int N,int m,int k,int H,vector<int> x,vector<int> y,vector<int> c,vector<int> a)
{
	for (int i=0;i<N;i++)
		nei[i].clear();
	for (int i=0;i<m;i++)
	{
		nei[x[i]].push_back({y[i],c[i]});
		nei[y[i]].push_back({x[i],c[i]});
	}
	return dijkstra(H,a);
}
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 2904 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 2908 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2920 KB Double -2.12228e+09 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 6976 KB Double -1.077e+09 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 2908 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2904 KB Double -2.10226e+09 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 2976 KB Double -8.22843e+08 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 2904 KB Double -8.22843e+08 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -