제출 #848214

#제출 시각아이디문제언어결과실행 시간메모리
848214haxorman추월 (IOI23_overtaking)C++17
39 / 100
3602 ms17744 KiB
#include "overtaking.h" #include <bits/stdc++.h> using namespace std; #define int long long const int mxN = 1007; int n, len, x, m, y, t[mxN][mxN], e[mxN][mxN], gt[mxN][mxN], pref[mxN][mxN]; vector<int> s, vec; vector<pair<int,int>> arr; int cur_ind; bool cmp(int a, int b) { if (t[a][cur_ind] == t[b][cur_ind]) { return arr[a].second < arr[b].second; } return t[a][cur_ind] < t[b][cur_ind]; } void init(int32_t L, int32_t N, std::vector<long long> T, std::vector<int32_t> W, int32_t X, int32_t M, std::vector<int32_t> S) { n = N, len = L, m = M, x = X; vector<int> inds; for (int i = 0; i < n; ++i) { arr.push_back({T[i], W[i]}); vec.push_back(T[i]); inds.push_back(i); } sort(arr.begin(), arr.end()); sort(vec.begin(), vec.end()); for (int i = 0; i < n; ++i) { t[i][0] = arr[i].first; } for (int i = 0; i < m; ++i) { s.push_back(S[i]); } for (int j = 1; j < m; ++j) { for (int i = 0; i < n; ++i) { e[i][j] = t[i][j - 1] + arr[i].second * (s[j] - s[j - 1]); } cur_ind = j - 1; sort(inds.begin(), inds.end(), cmp); int mx = 0; for (auto i : inds) { mx = max(mx, e[i][j]); t[i][j] = mx; } } } long long arrival_time(long long Y) { y = Y; t[n][0] = y; for (int j = 1; j < m; ++j) { e[n][j] = t[n][j - 1] + x * (s[j] - s[j - 1]); t[n][j] = e[n][j]; for (int i = 0; i < n; ++i) { if (t[i][j - 1] < t[n][j - 1]) { t[n][j] = max(t[n][j], e[i][j]); } } } return t[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...