제출 #753048

#제출 시각아이디문제언어결과실행 시간메모리
753048MohamedFaresNebili사이버랜드 (APIO23_cyberland)C++17
15 / 100
648 ms20288 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx2") using namespace std; using ll = long long; using pi = pair<double, pair<int, int>>; const ll M = 1000000000000000005; const double epsilon = 0.000001; double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { k = min(k, 70); double d[n][k + 1]; for(int l = 0; l < n; l++) for(int i = 0; i <= k; i++) d[l][i] = M; vector<pair<int, int>> adj[n]; d[0][0] = 0; 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]}); } queue<int> q; vector<bool> vis(n, 0); vis[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); if(arr[u] == 0) d[u][0] = 0; if(u == h) continue; for(auto v : adj[u]) { if(vis[v.first]) continue; vis[v.first] = 1; q.push(v.first); } } for(int l = 0; l < n; l++) if(arr[l] == 0) d[l][0] = 0; for(int l = 0; l <= k; l++) { priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> pq; for(int i = 0; i < n; i++) if(i != h && d[i][l] != M) pq.push({d[i][l], i}); while(!pq.empty()) { double w = pq.top().first; int u = pq.top().second; pq.pop(); if(u == h) continue; for(auto v : adj[u]) { if(arr[v.first] == 2 && l < k) d[v.first][l + 1] = min(d[v.first][l + 1], (d[u][l] + v.second) / 2.0); if(d[u][l] + v.second < d[v.first][l]) { d[v.first][l] = d[u][l] + v.second; pq.push({d[v.first][l], v.first}); } } } } double res = M; for(int l = 0; l <= k; l++) res = min(res, d[h][l]); if(res == M) return -1; return res; }

컴파일 시 표준 에러 (stderr) 메시지

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:44:28: warning: unused variable 'w' [-Wunused-variable]
   44 |                     double w = pq.top().first;
      |                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...