제출 #1119186

#제출 시각아이디문제언어결과실행 시간메모리
1119186blackslex추월 (IOI23_overtaking)C++17
39 / 100
3566 ms24220 KiB
#include "overtaking.h"
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<ll, ll>;

ll l, n, m, x;
vector<ll> w, s;
vector<ll> t;
vector<vector<ll>> e, ct;

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; m = M;
    w.resize(n); s.resize(m);
    for (int i = 0; i < n; i++) w[i] = W[i];
    for (int i = 0; i < m; i++) s[i] = S[i];
    return;
}

long long arrival_time(long long Y){
    e = vector<vector<ll>>(n + 1, vector<ll>(m));
    ct = vector<vector<ll>>(n + 1, vector<ll>(m));
    for (int i = 0; i < n; i++) ct[i][0] = t[i];
    ct[n][0] = Y;
    for (int j = 1; j < m; j++) {
        map<ll, vector<ll>> mp;
        ll cmx = 0;
        for (int i = 0; i < n; i++) {
            e[i][j] = ct[i][j - 1] + w[i] * (s[j] - s[j - 1]);
            mp[ct[i][j - 1]].emplace_back(i);
        }
        e[n][j] = ct[n][j - 1] + x * (s[j] - s[j - 1]);
        mp[ct[n][j - 1]].emplace_back(n);
        for (auto &[x, y]: mp) {
            for (auto &E: y) ct[E][j] = max(e[E][j], cmx);
            for (auto &E: y) cmx = max(cmx, e[E][j]);
        }
    }
    return ct[n][m - 1];
}
#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...