제출 #899659

#제출 시각아이디문제언어결과실행 시간메모리
899659LudisseyOvertaking (IOI23_overtaking)C++17
9 / 100
2 ms504 KiB
#include "overtaking.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
int l,n,x,m;
vector<int> t,w,s;

void init(signed L, signed N, std::vector<long long> T, std::vector<signed> W, signed X, signed M, std::vector<signed> S)
{
    l=L;
    n=N;
    x=X;
    m=M;
    t.assign(T.begin(),T.end());
    s.assign(S.begin(),S.end());
    w.assign(W.begin(),W.end());
    return;
}
long long arrival_time(long long Y) 
{
    if(x>=w[0]||t[0]>=Y) return ((x*l) + Y); // cest plus lent que lautre bus ou commence avant
    int eqPos=m; // ou il se rencontre et dabord a m vu que cest apres lhotel
    for (int i = 1; i < m; i++) // check toute les station
    {
        //cerr << (x*s[i])+Y << "  " << t[0]+(w[0]*s[i]) << "\n";
        if((x*s[i])+Y<=t[0]+(w[0]*s[i])) {eqPos=i; break;} // si 
    }
    //cerr << eqPos << "\n";
    if(eqPos>=m) return ((x*l) + Y);
    if(eqPos==m-1) return ((w[0]*l)+t[0]);
    return ((w[0]*s[eqPos])+t[0])+((l-s[eqPos])*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...