#include "escape_route.h"
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
const int N=101;
int n,m,vis[N];
ll t,P;
pair<int,ll> dist[N];
vector<pair<int,pair<ll,ll>>> g[N];
vector<ll> calculate_necessary_time(int _n,int _m,ll _P,int Q,vector<int> A,vector<int> B,vector<ll> L,vector<ll> C,vector<int> U,vector<int> V,vector<ll> T){
n=_n,m=_m,P=_P;
vector<ll> ans(Q);
f(i,0,m){
g[A[i]].pb({B[i],{C[i]-L[i],L[i]}});
g[B[i]].pb({A[i],{C[i]-L[i],L[i]}});
}
f(C,0,U.size()){
int u=U[C],v=V[C];
ll t=T[C];
f(i,0,n) vis[i]=0,dist[i]={N,0};
dist[u]={0,t};
f(T,0,n){
int id=-1;
f(i,0,n){
if(vis[i]==0 && (id==-1 || dist[i]<dist[id])){
id=i;
}
}
vis[id]=1;
f(i,0,g[id].size()){
int nxt=g[id][i].F;
ll c=g[id][i].S.F,l=g[id][i].S.S;
if(dist[id].S<=c){
minm(dist[nxt],mp(dist[id].F,dist[id].S+l));
}
else{
minm(dist[nxt],mp(dist[id].F+1,l));
}
}
}
ans[C]=P*dist[v].F+dist[v].S-t;
}
return ans;
}
Compilation message
escape_route.cpp: In function 'std::vector<long long int> calculate_necessary_time(int, int, long long int, int, std::vector<int>, std::vector<int>, std::vector<long long int>, std::vector<long long int>, std::vector<int>, std::vector<int>, std::vector<long long int>)':
escape_route.cpp:9:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
9 | #define f(i,a,b) for(int i=a;i<b;i++)
......
38 | f(C,0,U.size()){
| ~~~~~~~~~~~~
escape_route.cpp:38:5: note: in expansion of macro 'f'
38 | f(C,0,U.size()){
| ^
escape_route.cpp:9:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
9 | #define f(i,a,b) for(int i=a;i<b;i++)
......
51 | f(i,0,g[id].size()){
| ~~~~~~~~~~~~~~~~
escape_route.cpp:51:13: note: in expansion of macro 'f'
51 | f(i,0,g[id].size()){
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
64980 KB |
Output is correct |
2 |
Correct |
43 ms |
65028 KB |
Output is correct |
3 |
Correct |
43 ms |
64956 KB |
Output is correct |
4 |
Correct |
28 ms |
65100 KB |
Output is correct |
5 |
Correct |
38 ms |
64972 KB |
Output is correct |
6 |
Correct |
32 ms |
64972 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9023 ms |
112016 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
64980 KB |
Output is correct |
2 |
Correct |
43 ms |
65028 KB |
Output is correct |
3 |
Correct |
43 ms |
64956 KB |
Output is correct |
4 |
Correct |
28 ms |
65100 KB |
Output is correct |
5 |
Correct |
38 ms |
64972 KB |
Output is correct |
6 |
Correct |
32 ms |
64972 KB |
Output is correct |
7 |
Execution timed out |
9023 ms |
112016 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
64980 KB |
Output is correct |
2 |
Correct |
43 ms |
65028 KB |
Output is correct |
3 |
Correct |
43 ms |
64956 KB |
Output is correct |
4 |
Correct |
28 ms |
65100 KB |
Output is correct |
5 |
Correct |
38 ms |
64972 KB |
Output is correct |
6 |
Correct |
32 ms |
64972 KB |
Output is correct |
7 |
Execution timed out |
9023 ms |
112016 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
64980 KB |
Output is correct |
2 |
Correct |
43 ms |
65028 KB |
Output is correct |
3 |
Correct |
43 ms |
64956 KB |
Output is correct |
4 |
Correct |
28 ms |
65100 KB |
Output is correct |
5 |
Correct |
38 ms |
64972 KB |
Output is correct |
6 |
Correct |
32 ms |
64972 KB |
Output is correct |
7 |
Execution timed out |
9023 ms |
112016 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |