# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
241617 | verngutz | Collecting Stamps 3 (JOI20_ho_t3) | C++14 | 66 ms | 63992 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 <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <typename X, typename Y> istream& operator>>(istream& is, pair<X, Y>& p) { return is >> p.first >> p.second; }
const int N = 200, MAX_T = 201;
int n, l, x[N+2], t[N+2];
int mem[2][N+1][N+1][N+1];
int d(int i, int j) {
return (x[j] - x[i] + l) % l;
}
int opt(bool at_L, int L, int R, int T) {
int& ans = mem[at_L][L][R][T];
if(ans == -1) {
if(L <= R) {
int TL, TR;
ans = max(
((TL = d(at_L ? L - 1 : R + 1, L) + T) <= t[L]) + opt(1, L + 1, R, min(TL, MAX_T)),
((TR = d(R, at_L ? L - 1 : R + 1) + T) <= t[R]) + opt(0, L, R - 1, min(TR, MAX_T))
);
} else {
ans = 0;
}
}
# | 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... |