Submission #782736

# Submission time Handle Problem Language Result Execution time Memory
782736 2023-07-14T08:40:12 Z vjudge1 Cyberland (APIO23_cyberland) C++17
15 / 100
35 ms 7212 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define pb push_back
#define uwu 100005 
vector<pair<int,int>>adj[uwu];
double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){

	int father[N];
	ll int yol[N];
	for(int i=0;i<N;i++){
		father[i]=-1;
		yol[i]=1000000000000;
	}
	for(int i=0;i<M;i++){
		adj[x[i]].pb({y[i],c[i]});
		adj[y[i]].pb({x[i],c[i]});
	}
	priority_queue<tuple<ll int,int,int>> pq;
	pq.push({(ll int)0,0,-1});
	while(pq.size()){
		ll int node,once, deg;
		tie(deg,node,once)=pq.top();deg=-deg;
		pq.pop();
		//cout<<node<<" "<<once<<" "<<" "<<deg<<" "<<endl;
		if(arr[node]==0){
			deg=0;
		}
		if(yol[node]<=deg)continue;
		yol[node]=deg;

		father[node]=once;
		for(auto u:adj[node]){
			ll int kim=u.first, lira=u.second+deg;
			pq.push({-lira,kim,node});
			
		}
	}
	/*for(int i=0;i<N;i++)cout<<yol[i]<<" ";
	cout<<endl;
	for(int i=0;i<N;i++)cout<<father[i]<<" ";
	cout<<endl;*/
	for(int i=0;i<N;i++)adj[i].clear();
	if(yol[H]==1000000000000)yol[H]=-1;
	return (1.0)*yol[H];
}

Compilation message

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:11:6: warning: variable 'father' set but not used [-Wunused-but-set-variable]
   11 |  int father[N];
      |      ^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 2900 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 3044 KB Correct.
2 Correct 24 ms 3084 KB Correct.
3 Correct 23 ms 3044 KB Correct.
4 Correct 24 ms 3100 KB Correct.
5 Correct 24 ms 3028 KB Correct.
6 Correct 25 ms 3912 KB Correct.
7 Correct 28 ms 3752 KB Correct.
8 Correct 13 ms 4572 KB Correct.
9 Correct 22 ms 2880 KB Correct.
10 Correct 22 ms 2964 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 3020 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 7212 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 3164 KB Correct.
2 Correct 23 ms 3000 KB Correct.
3 Correct 24 ms 3000 KB Correct.
4 Correct 26 ms 4212 KB Correct.
5 Correct 19 ms 2864 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 3140 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 3124 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 3132 KB Wrong Answer.
2 Halted 0 ms 0 KB -