Submission #583283

#TimeUsernameProblemLanguageResultExecution timeMemory
583283alirezasamimi100Escape Route (JOI21_escape_route)C++17
5 / 100
9048 ms111908 KiB
#pragma GCC optimize("Ofast,unroll-loops") #pragma comment(linker, "/stack:200000000") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #include "escape_route.h" #include <bits/stdc++.h> #define pb push_back #define F first #define S second using namespace std; using ll = long long int; using pll = pair<ll, ll>; using pii = pair<int, int>; const ll INF = 4e18; vector<ll> calculate_necessary_time(int N, int M, ll S, int Q, vector<int> A, vector<int> B, vector<ll> L, vector<ll> C, vector<int> U, vector<int> V, vector<ll> T) { vector<pair<int, int>> adj[N]; vector<ll> ans(Q); for(int i = 0; i < M; i++){ adj[A[i]].pb({B[i], i}); adj[B[i]].pb({A[i], i}); } for(int i = 0; i < Q; i++){ ll d[N]; bool f[N]; memset(d, 63, sizeof d); memset(f, 0, sizeof f); d[U[i]] = T[i]; while(true){ int v = -1; for(int i = 0; i < N; i++){ if(!f[i] && (v == -1 || d[i] < d[v])) v = i; } if(v == -1) break; f[v] = 1; ll x = d[v], y = x % S; if(x != d[v]) continue; for(auto [u, i] : adj[v]){ ll w = L[i], c = C[i]; if(y + w > c) w += S - y; if(d[u] > x + w){ d[u] = x + w; } } } ans[i] = d[V[i]] - d[U[i]]; } return ans; }

Compilation message (stderr)

escape_route.cpp:2: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    2 | #pragma comment(linker, "/stack:200000000")
      |
#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...