이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* Ignut
started: 14.08.2024
now: 14.08.2024
████████████████████████████████████████████████████████████████████
████████████████████████████████    ████████████████████████████████
██████████████████████████████        ██████████████████████████████
██████      ██████████████████        ██████████████████      ██████
██████          ██████████████        ██████████████          ██████
██████      ██    ████████████        ████████████    ██      ██████
██████      ████    ██████████        ██████████    ████      ██████
██████      ████      ██████████    ██████████      ████      ██████
██████      ████      ██████████    ██████████    ██████      ██████
██████      ██████    ██████████    ██████████    ██████      ██████
██████      ██████    ████████        ████████    ██████      ██████
██████      ██████      ██████        ██████      ██████      ██████
██████      ████        ████            ████        ████      ██████
██████            ██████████    ████    ██████████            ██████
██████      ██      ██████    ████████    ██████      ██      ██████
██████      ██████            ████████            ██████      ██████
██████                    ██            ██                    ██████
██████████████████████      ████    ████      ██████████████████████
████████████████████████      ██    ██      ████████████████████████
██████████████████████████                ██████████████████████████
██████████████████████████████        ██████████████████████████████
████████████████████████████████████████████████████████████████████
*/
 
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
int l;
int n, m;
vector<ll> t;
vector<int> w;
vector<int> s;
int x;
// <time, speed, next_time>
vector<vector<tuple<ll, int, ll>>> vec;
void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S) {
    l = L; n = N; m = M; w = W; s = S; x = X; t = T;
    // <tm, speed>
    vector<pair<ll, int>> v;
    for (int i = 0; i < n; i ++) if (w[i] > x) v.push_back({t[i], w[i]});
    sort(v.begin(), v.end());
    for (int i = 1; i < m; i ++) {
        vector<pair<ll, int>> next;
        vector<tuple<ll, int, ll>> add;
        ll maxTime = 0;
        for (auto [tm, sp] : v) {
            ll e = tm + 1ll * (s[i] - s[i - 1]) * sp;
            next.push_back({max(e, maxTime), sp});
            maxTime = max(e, maxTime);
            add.push_back({tm, sp, maxTime});
        }
        vec.push_back(add);
        v = next;
        sort(v.begin(), v.end());
    }
}
ll arrival_time(ll Y) {
    ll tm = Y, sp = x;
    for (int i = 1; i < m; i ++) {
        int lo = 0, hi = int(vec[0].size()) - 1;
        while (lo < hi) {
            int mid = lo + (hi - lo + 1) / 2;
            if (get<0>(vec[i - 1][mid]) < tm)
                lo = mid;
            else
                hi = mid - 1;
        }
        ll mx = tm + 1ll * (s[i] - s[i - 1]) * sp;
        if (lo < vec[i - 1].size() && get<0>(vec[i - 1][lo]) < tm) {
            mx = max(mx, get<2>(vec[i - 1][lo]));
        }
        tm = mx;
    }
    return tm;
}
컴파일 시 표준 에러 (stderr) 메시지
overtaking.cpp: In function 'll arrival_time(ll)':
overtaking.cpp:77:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |         if (lo < vec[i - 1].size() && get<0>(vec[i - 1][lo]) < tm) {
      |             ~~~^~~~~~~~~~~~~~~~~~~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |