# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
984322 | 2024-05-16T13:22:48 Z | IUA_Hasin | 사이버랜드 (APIO23_cyberland) | C++17 | 29 ms | 20072 KB |
#include "cyberland.h" #include <bits/stdc++.h> #define endl "\n" #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define ll long long #define ld long double using namespace std; const ll N = 3e5+5; const ll INF = 1e16+10; vector<pair<ll, ll>> graph[N]; vector<ll> dist(N, INF); ll vis[N]; vector<ll> arr2; void dijkstra(ll source){ set<pair<ll, ll>> s; s.insert({0, source}); dist[source] = 0; while(s.size()>0){ auto node = *s.begin(); ll v = node.second; ll v_dist = node.first; s.erase(s.begin()); if(vis[v]==0){ for(auto child : graph[v]){ ll v2 = child.first; ll wt = child.second; if(arr2[v2]==0){ wt = 0; } if((dist[v]+wt)<(dist[v2])){ dist[v2] = dist[v]+wt; s.insert({dist[v2], v2}); } } vis[v] = 1; } } } void dfs(ll wt, ll source){ if(vis[source]==0){ vis[source] = 1; for(auto u : graph[source]){ ll v = u.first; ll v_dist = u.second; if(vis[v]==0){ if(arr2[v]==0){ dist[v] = 0; dfs(0, v); } else { dist[v] = wt+v_dist; dfs(wt+v_dist, v); } } } } } 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) { arr2.clear(); for(int i=0; i<=N; i++){ graph[i].clear(); vis[i] = 0; dist[i] = INF; } for(int i=0; i<N; i++){ ll a = arr[i]; arr2.push_back(a); } for(int i=0; i<x.size(); i++){ ll a = x[i]; ll b = y[i]; ll wt = c[i]; graph[a].push_back({b, wt}); graph[b].push_back({a, wt}); } dist[0] = 0; dfs(0, 0); ld ans = dist[H]; // for(int i=0; i<N; i++){ // cout << dist[i] << " "; // } cout<<endl; return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 10076 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 10072 KB | Correct. |
2 | Correct | 19 ms | 10148 KB | Correct. |
3 | Correct | 19 ms | 10072 KB | Correct. |
4 | Correct | 22 ms | 10076 KB | Correct. |
5 | Correct | 18 ms | 10076 KB | Correct. |
6 | Correct | 16 ms | 10844 KB | Correct. |
7 | Correct | 21 ms | 11016 KB | Correct. |
8 | Correct | 11 ms | 11680 KB | Correct. |
9 | Correct | 19 ms | 9820 KB | Correct. |
10 | Correct | 18 ms | 9820 KB | Correct. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 20 ms | 10076 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 20072 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 10076 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 10140 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 10072 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 10104 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |