제출 #1242301

#제출 시각아이디문제언어결과실행 시간메모리
1242301bangan추월 (IOI23_overtaking)C++20
9 / 100
2 ms328 KiB
#include "overtaking.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long

#define pb push_back

int n;
vector<ll> t, w;

int m;
vector<ll> s;

void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S) {
    n = N;
    for (auto it : T) t.pb(it);
    t.pb(0);
    for (auto it : W) w.pb(it);
    w.pb(X);

    m = M;
    for (auto it : S) s.pb(it);

    assert(s[0]==0);
    assert(s[m-1]==L);
}

ll arrival_time(ll Y) {
    t[n] = Y;

    ll x = t[0];
    ll y = t[1];
    for (int i=1; i<m; i++) {
        ll new_x = x + (s[i] - s[i-1]) * w[0];
        ll new_y = y + (s[i] - s[i-1]) * w[1];
        
        if (new_x < new_y && y < x) new_x = new_y;
        else if (new_y < new_x && x < y) new_y = new_x;
        
        x = new_x;
        y = new_y;
    }

    return y;
}
#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...