답안 #752976

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
752976 2023-06-04T11:32:12 Z MohamedFaresNebili 사이버랜드 (APIO23_cyberland) C++17
0 / 100
55 ms 6124 KB
#include <bits/stdc++.h>
 
        using namespace std;
        using ll = long long;
 
        const ll M = 2000000007;
 
        long double solve(int n, int m, int k, int h, vector<int> x,
                     vector<int> y, vector<int> c, vector<int> arr) {
            long double d[n]; d[0] = 0;
            for(int l = 1; l < n; l++) d[l] = M;
            vector<pair<int, int>> adj[n];
            for(int l = 0; l < m; l++) {
                adj[x[l]].push_back({y[l], c[l]});
                adj[y[l]].push_back({x[l], c[l]});
            }
            priority_queue<pair<long double, int>,
            vector<pair<long double, int>>, greater<pair<long double, int>>> pq;
            pq.push({0, 0});
            while(!pq.empty()) {
                long double w = pq.top().first;
                int u = pq.top().second; pq.pop();
                for(auto v : adj[u]) {
                    long double D = w + v.second;
                    if(arr[v.first] == 0) D = 0;
                    if(arr[v.first] == 2) D /= 2.0;
 
                    if(d[v.first] > D) {
                        d[v.first] = D;
                        if(v.first != h) pq.push({d[v.first], v.first});
                    }
                }
            }
            if(d[h] == M) return -1;
            return d[h];
        }
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 340 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 456 KB Double -1.982e+216 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 468 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 6124 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 468 KB Double -7.12986e+195 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 420 KB Double -15886.4 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 648 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 644 KB Wrong Answer.
2 Halted 0 ms 0 KB -