제출 #1238647

#제출 시각아이디문제언어결과실행 시간메모리
1238647nikulid추월 (IOI23_overtaking)C++20
0 / 100
0 ms328 KiB
#include "overtaking.h" #include <iostream> using namespace std; bool debug=false; #define ll long long #define pb push_back #define mp make_pair #define derr if(debug)cerr #define dlist(x) if(debug){cerr<<"dlist "<<#x<<":\n";for(auto e:x){cerr<<e<<" ";}cerr<<"\n";} ll n,l,x,m; vector<ll> t,w,s; vector<ll> arrival_times; // times that bus 0 arrives at i-th sorting station... void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S){ // L,N : length of road, number of busses // T: array for the times at which the non-reserve busses leave the airport. // W: speeds of the busses (time to travel 1km) // X: speed of the reserve bus (time to travel 1km) // M: how many sorting stations there are // S: distances of the sorting stations from the airport. l=L; n=N; for(auto e:T){ t.pb(e); } for(auto e:W){ w.pb(e); } x=X; m=M; for(auto e:S){ s.pb(e); } // 2<=M because i=0 and i=L-1 are both technically sorting stations. for(int i=0; i<M; i++){ arrival_times.pb(T[0] + S[i]*W[0]); } dlist(arrival_times); return; } // the below procedure is called exactly Q times... ll arrival_time(ll Y){ // Y = the time at which the reserve bus leaves // >--- subtask 1: N=1 ---< ll buffer = Y; bool is_infront = (Y<=arrival_times[0]); for(int i=1; i<m; i++){ if(is_infront)break; else if(buffer + s[i]*x <= arrival_times[i]){ buffer = arrival_times[i]-s[i]*x; is_infront=true; } } return buffer + l*x; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...