# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
669490 | GrandTiger1729 | Collecting Stamps 3 (JOI20_ho_t3) | C++17 | 162 ms | 126148 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
const long long INF = 1e18;
int main(){
int n;
long long L;
cin >> n >> L;
long long a[n], b[n];
for (int i = 0; i < n; i++){
cin >> a[i];
}
for (int i = 0; i < n; i++){
cin >> b[i];
}
auto idx = [&](int i) -> int {
return (i % n + n) % n;
};
auto dis = [&](long long x, long long y) -> long long {
if (x > y) swap(x, y);
return min(y - x, x + L - y);
};
long long dp[n][n][n + 1][2]{}; // [l, r], pickcnt, cur(l, r) => min time
fill_n(&dp[0][0][0][0], sizeof(dp) / sizeof(long long), INF);
for (int i = 0; i < n; i++){
dp[i][i][min(a[i], L - a[i]) <= b[i]][0] = dp[i][i][min(a[i], L - a[i]) <= b[i]][1] = min(a[i], L - a[i]);
}
for (int t = 0; t < n - 1; t++){
for (int l = n - 1; l >= 0; l--){
int r = idx(l + t);
# | 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... |