Submission #1061428

# Submission time Handle Problem Language Result Execution time Memory
1061428 2024-08-16T08:58:03 Z Gangsta Cyberland (APIO23_cyberland) C++17
0 / 100
381 ms 16732 KB
#include "bits/stdc++.h"
#define ll long long int
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define sz size()

const int N = 2e5 + 1;

using namespace std;

vector <long double> dis(N,1e15);

priority_queue <pair<long double, int>> pq;

vector <pii> v[N];

void dij(vector<int>arr){
	pq.push({0,0});
	dis[0] = 0;
	while(!pq.empty()){
		int a = pq.top().ss;
		pq.pop();
		for(auto i: v[a]){
			if(arr[i.ff] == 0 and dis[a] < dis[i.ff]){
				dis[i.ff] = dis[a];
				pq.push({-dis[i.ff],i.ff});
			}
			else if(arr[i.ff] == 1 and dis[a] + i.ss < dis[i.ff]){
				dis[i.ff] = dis[a] + i.ss;
				pq.push({-dis[i.ff],i.ff});
			}
			else if(arr[i.ff] == 2 and dis[a] + (long double)(i.ss/2) < dis[i.ff]){
				dis[i.ff] = (long double)(i.ss/2);
				pq.push({-dis[i.ff],i.ff});
			}
		}
	}
}

double solve(int n, int m, int k, int h, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){
	for(int i = 1; i <= m; i++){
		v[x[i]].pb({y[i],c[i]});
		v[y[i]].pb({x[i],c[i]});
	}
	dij(arr);
	return dis[h];
}

// int main(){
//     ios::sync_with_stdio(false); cin.tie(nullptr);
// }
# Verdict Execution time Memory Grader output
1 Incorrect 381 ms 8628 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 16476 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 16476 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 12016 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 16732 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 16476 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 16472 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 16476 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -