# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
876040 | 2023-11-21T07:03:55 Z | Regulus | Escape Route (JOI21_escape_route) | C++17 | 138 ms | 136708 KB |
#include <bits/stdc++.h> // pA #include "escape_route.h" #define IO ios::sync_with_stdio(false);cin.tie(0); #define debug(x) cerr << #x << " = " << (x) << ' ' #define endl cerr << '\n' #define all(v) (v).begin(), (v).end() #define lowbit(x) (x)&-(x) #define pb emplace_back #define F first #define S second using namespace std; using ll = long long; using pll = pair<ll, ll>; using ppl = pair<pll, ll>; const int N = 2e5+5; const int INF = 2e9; pll dis[N]; vector<ll> ans; vector<pll> g[N]; priority_queue<ppl, vector<ppl>, greater<ppl> > pq; std::vector<long long> calculate_necessary_time(int N, int M, long long s, int Q, std::vector<int> A, std::vector<int> B,std::vector<long long> L, std::vector<long long> C, std::vector<int> U, std::vector<int> V, std::vector<long long> T) { int i, j, n=N, m=M; for (i=0; i < m; ++i) g[A[i]].pb(B[i], i), g[B[i]].pb(A[i], i); for (i=0; i < n; ++i) dis[i] = {INF, INF}; dis[0] = {0, 0}, pq.push({pll{0, 0}, 0}); while (!pq.empty()) { int x = pq.top().S; pq.pop(); for (auto p : g[x]) { ll v = p.F, id = p.S; pll tmp = dis[x]; tmp.S += L[id]; if (tmp.S > C[id]) ++tmp.F, tmp.S = 0; if (tmp < dis[v]) { dis[v] = tmp, pq.push({dis[v], v}); } } } for (i=0; i < Q; ++i) { auto p = dis[V[i]]; ans.pb(p.F*s + p.S); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 71260 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 138 ms | 136708 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 71260 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 71260 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 71260 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |