제출 #848321

#제출 시각아이디문제언어결과실행 시간메모리
848321math_rabbit_1028추월 (IOI23_overtaking)C++17
0 / 100
53 ms2556 KiB
#include "overtaking.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int l, n, x, m; vector<ll> t; vector<int> w, s; void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S) { l = L; n = N; t = T; w = W; x = X; m = M; s = S; return; } ll est[1010][1010], arr[1010][1010]; ll arrival_time(ll Y) { for (int i = 0; i < n; i++) est[0][i] = t[i]; for (int i = 0; i < n; i++) arr[0][i] = t[i]; est[0][n] = Y; arr[0][n] = Y; for (int j = 1; j < m; j++) { for (int i = 0; i < n; i++) est[j][i] = est[j - 1][i] + (ll)w[i] * (s[j] - s[j - 1]); est[j][n] = est[j - 1][n] + (ll)x * (s[j] - s[j - 1]); vector<pll> elist; for (int i = 0; i <= n; i++) elist.push_back({est[j - 1][i], i}); sort(elist.begin(), elist.end()); ll last = 0; for (int i = 0; i <= n; i++) { arr[j][elist[i].second] = max(last, est[j][elist[i].second]); last = max(last, est[j][elist[i].second]); } } return arr[m - 1][n]; }
#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...