제출 #847735

#제출 시각아이디문제언어결과실행 시간메모리
847735vjudge1추월 (IOI23_overtaking)C++17
39 / 100
3538 ms16292 KiB
#include "overtaking.h" #include <bits/stdc++.h> using namespace std; #define int64_t long long vector<int> W, S; vector<int64_t> T; int N, L, M, X; void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S) { ::T = T; ::W = W; ::S = S; ::N = N; ::L = L; ::M = M; ::X = X; ::W.emplace_back(X); ::T.emplace_back(0); ::N++; } long long arrival_time(long long Y) { vector<vector<int64_t>> t(M, vector<int64_t>(N)); vector<vector<int64_t>> e(M, vector<int64_t>(N)); T.back() = Y; for (int i = 0; i < N; i++) t[0][i] = T[i]; vector<int> ord(N); iota(ord.begin(), ord.end(), 0); for (int i = 0; i < M - 1; i++) { for (int j = 0; j < N; j++) { e[i + 1][j] = t[i][j] + 1ll * W[j] * (S[i + 1] - S[i]); } sort(ord.begin(), ord.end(), [&](int a, int b) { return t[i][a] < t[i][b]; }); int64_t time = 0; for (int j = 0; j < N;) { int k = j; while (k < N && t[i][ord[k]] == t[i][ord[j]]) k++; for (int z = j; z < k; z++) t[i + 1][ord[z]] = max(time, e[i + 1][ord[z]]); for (int z = j; z < k; z++) time = max(time, e[i + 1][ord[z]]); j = k; } } return t.back().back(); }
#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...