답안 #984977

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
984977 2024-05-17T08:52:45 Z shjeong 사이버랜드 (APIO23_cyberland) C++17
15 / 100
39 ms 13820 KB
#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <vector>
#include <string>
#include <climits>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <cassert>
#include <list>
using namespace std;
#define all(x) x.begin(), x.end()
#define rll(x) x.rbegin(), x.rend()
#define comp(x) x.erase(unique(all(x)), x.end())
#define MOD 1000000007
#define MOD2 998244353
#define debug(x) cout << #x<<" is "<<x<<"\n";
#define X first
#define Y second
#define DEB cout<<"[DEBUG]"
#define PAIR(a,b) "("<<a<<", "<<b<<")"
#define PRINT1(V) DEB<<#V<<endl; for(auto i : V)DEB<<i<<"\n"
#define PRINT2(V) DEB<<#V<<endl; for(auto [a,b] : V)DEB<<PAIR(a,b)<<"\n";
typedef long long ll;
typedef __int128_t lll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef pair<ld,ll> Pd;
vector<P> adj[202020];
ld dist[202020];
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) {
    for(int i = 0 ; i < N ; i++){
        dist[i] = 1e15;
        adj[i].clear();
    }
    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]});
    }
    priority_queue<Pd,vector<Pd>,greater<Pd>> pq;
    for(int i = 0 ; i < N ; i++)if(arr[i]==0)dist[i]=0, pq.push({0,i});
    dist[0] = 0;
    pq.push({0,0});
    while(pq.size()){
        auto [d,cur] = pq.top(); pq.pop();
        if(dist[cur] < d)continue;
        for(auto [next,w] : adj[cur]){
            if(dist[next] > dist[cur] + w){
                dist[next] = dist[cur]+w;
                pq.push({dist[cur]+w,next});
            }
        }
    }
    if(dist[H]==1e15)return -1;
    return (double)dist[H];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 6284 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 6232 KB Correct.
2 Correct 23 ms 6340 KB Correct.
3 Correct 22 ms 6336 KB Correct.
4 Correct 23 ms 6236 KB Correct.
5 Correct 24 ms 6236 KB Correct.
6 Correct 21 ms 7256 KB Correct.
7 Correct 27 ms 7260 KB Correct.
8 Correct 13 ms 10076 KB Correct.
9 Correct 22 ms 6184 KB Correct.
10 Correct 23 ms 5980 KB Correct.
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 6236 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 13820 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 6236 KB Correct.
2 Correct 21 ms 6620 KB Correct.
3 Correct 23 ms 6392 KB Correct.
4 Correct 21 ms 7432 KB Correct.
5 Correct 18 ms 6196 KB Correct.
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 6232 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 6232 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 6320 KB Wrong Answer.
2 Halted 0 ms 0 KB -