# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
806974 | 2023-08-04T11:47:54 Z | YassineBenYounes | Escape Route (JOI21_escape_route) | C++17 | 9000 ms | 154968 KB |
#include<bits/stdc++.h> #include<escape_route.h> typedef long long ll; using namespace std; void init(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // ONLINE_JUDGE } #define vi vector<int> #define vl vector<ll> #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second const int mx = 100; const ll inf = 1e18; vector<vl> graph[mx]; vector<vl> queries[mx]; bool vis[mx]; ll s; int n, m, q; ll ans[mx]; void solve(int st, int target, ll t){ priority_queue<pll, vector<pll>, greater<pll>> pq; pq.push({t, st}); memset(vis, 0, sizeof vis); for(int i = 0; i < n;i++){ ans[i] = inf; } int k = 0; ans[st] = t; while(!pq.empty()){ int node = pq.top().ss; ll tm = pq.top().ff; pq.pop(); if(vis[node])continue; vis[node] = 1; for(vl adj : graph[node]){ ll nxt = tm + adj[1]; if(adj[1] > adj[2])continue; ll o = nxt % s; if((nxt/s) > (tm/s) || o > adj[2]){ nxt = (tm / s + 1) * s + adj[1]; } ans[adj[0]] = min(ans[adj[0]], nxt); pq.push({ans[adj[0]], adj[0]}); } } //cout << ans[2] << endl; } 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){ n = N, m = M, s = S, q = Q; for(int i = 0; i < m;i++){ graph[A[i]].pb({B[i], L[i], C[i]}); graph[B[i]].pb({A[i], L[i], C[i]}); } vl res; for(int i = 0; i < q;i++){ solve(U[i], V[i], T[i]); cout << ans[V[i]] - T[i] << endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 26 ms | 64980 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 9033 ms | 154968 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 26 ms | 64980 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 26 ms | 64980 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 26 ms | 64980 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |