제출 #1335351

#제출 시각아이디문제언어결과실행 시간메모리
1335351nerrrminOvertaking (IOI23_overtaking)C++20
0 / 100
1 ms344 KiB
#include "overtaking.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
long long l, n, m, x, y;
vector <  long long > t;
vector < int > w, s;

void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S)
{
    l = L;
    n = N;
    t = T;
    x = X;
    w = W;
    m = M;
    s = S;
    return;
}

long long arrival_time(long long Y)
{
    y = Y;
    long long worst = y + x * l;
    for (int i = 0; i < n; ++ i)
    {
        if(w[i] > x)continue;
        worst = max(worst, w[i] * l + t[i]);
    }
    return worst;
    /*long long t1 = t[0];
    long long s1 = w[0];
    if(y <= t1 || (y >= t1 && s1 <= x))
    {
        long long ans = y + x * l;
        return ans;
    }
    
    int lt = 0, rt = s.size()-1, mid, ans = l+1; /// pyrvoto po golqmo ot inter
    while(lt <= rt)
    {
        mid = (lt + rt)/2;
        long long time0 = y + s[mid] * x;
        long long time1 = t1 + s[mid] * s1;
      
        if(time0 <= time1)
        {
            ans = s[mid];
            rt = mid - 1;
        }
        else lt = mid + 1;
    }
    if(ans == l+1)return (l * x )+y;
    long long time = (ans * s1 + t1) + (l - ans) * x;
    return time;*/
}
#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...