Submission #421981

# Submission time Handle Problem Language Result Execution time Memory
421981 2021-06-09T14:26:04 Z jamezzz Escape Route (JOI21_escape_route) C++17
0 / 100
304 ms 112344 KB
#include "escape_route.h"
#include <bits/stdc++.h>
using namespace std;

#define sf scanf
#define pf printf
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,int> li;
typedef vector<int> vi;
typedef vector<ll> vll;

struct edge{int v;ll l,c;};

vector<edge> AL[100];
ll d[100];
vll ans;
priority_queue<li,vector<li>,greater<li>> pq;

vll calculate_necessary_time(int N, int M, ll S, int Q, vi A, vi B, vll L, vll C, vi U, vi V, vll T) {
	for(int i=0;i<M;++i){
		AL[A[i]].pb({B[i],L[i],C[i]});
		AL[B[i]].pb({A[i],L[i],C[i]});
	}
	for(int i=0;i<Q;++i){
		pq.push({T[i],U[i]});
		while(!pq.empty()){
			ll t;int u;tie(t,u)=pq.top();pq.pop();
			if(t>d[u])continue;
			for(edge e:AL[u]){
				ll reach;
				if(t%S<e.c&&(t+e.l)%S<e.c){
					reach=t+e.l;
				}
				else{
					reach=(t+S-1)/S*S+e.l;
				}
				if(d[e.v]<=reach)continue;
				d[e.v]=reach;
				pq.push({d[e.v],e.v});
			}
		}
		ans.pb(d[V[i]]);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 64964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 304 ms 112344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 64964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 64964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 64964 KB Output isn't correct
2 Halted 0 ms 0 KB -