제출 #983340

#제출 시각아이디문제언어결과실행 시간메모리
983340crispxx사이버랜드 (APIO23_cyberland)C++17
15 / 100
87 ms5912 KiB
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef long double ld; typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef pair<double, int> pii; #define nl '\n' #define vt vector #define ar array #define pb push_back #define ff first #define ss second const int INF = INT_MAX; double solve(int N, int M, int K, int H, vt<int> x, vt<int> y, vt<int> c, vt<int> arr) { int n = N, m = M, k = K, h = H; vt<pair<int, int>> adj[n]; for(int i = 0; i < M; i++) { adj[x[i]].pb({y[i], c[i]}); adj[y[i]].pb({x[i], c[i]}); } vector<double> d(N, numeric_limits<double>::max()); priority_queue<pii, vt<pii>, greater<pii>> q; d[0] = 0; q.push({0, 0}); while(!q.empty()) { int u = q.top().ss; double res = q.top().ff; q.pop(); if(u == h) return res; int ch = k; if(arr[u] == 2) ch--, res/=2; for(auto &edge : adj[u]) { int v = edge.ff; int c = edge.ss; double nw = res + c; if(arr[v] == 0) nw = res; if(arr[v] == 2 && ch) { nw = res + c / 2.; ch--; } if(nw < d[v]) { d[v] = nw; q.push({nw, v}); } } } return -1; }

컴파일 시 표준 에러 (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:20:13: warning: unused variable 'm' [-Wunused-variable]
   20 |  int n = N, m = M, k = K, h = H;
      |             ^
#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...