Submission #241617

# Submission time Handle Problem Language Result Execution time Memory
241617 2020-06-24T18:37:56 Z verngutz Collecting Stamps 3 (JOI20_ho_t3) C++14
15 / 100
66 ms 63992 KB
#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;
        }
    }
    return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> l;
    for(int i = 1; i <= n; i++) {
        cin >> x[i];
    }
    for(int i = 1; i <= n; i++) {
        cin >> t[i];
    }
    memset(mem, -1, sizeof mem);
    cout << opt(true, 1, n, 0) << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 38 ms 63872 KB Output is correct
2 Correct 37 ms 63864 KB Output is correct
3 Correct 42 ms 63868 KB Output is correct
4 Correct 37 ms 63864 KB Output is correct
5 Correct 39 ms 63864 KB Output is correct
6 Correct 40 ms 63864 KB Output is correct
7 Correct 37 ms 63864 KB Output is correct
8 Correct 37 ms 63992 KB Output is correct
9 Correct 37 ms 63864 KB Output is correct
10 Correct 37 ms 63864 KB Output is correct
11 Correct 37 ms 63864 KB Output is correct
12 Correct 37 ms 63864 KB Output is correct
13 Correct 37 ms 63864 KB Output is correct
14 Correct 37 ms 63736 KB Output is correct
15 Correct 37 ms 63872 KB Output is correct
16 Correct 42 ms 63940 KB Output is correct
17 Correct 37 ms 63864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 63872 KB Output is correct
2 Correct 37 ms 63864 KB Output is correct
3 Correct 42 ms 63868 KB Output is correct
4 Correct 37 ms 63864 KB Output is correct
5 Correct 39 ms 63864 KB Output is correct
6 Correct 40 ms 63864 KB Output is correct
7 Correct 37 ms 63864 KB Output is correct
8 Correct 37 ms 63992 KB Output is correct
9 Correct 37 ms 63864 KB Output is correct
10 Correct 37 ms 63864 KB Output is correct
11 Correct 37 ms 63864 KB Output is correct
12 Correct 37 ms 63864 KB Output is correct
13 Correct 37 ms 63864 KB Output is correct
14 Correct 37 ms 63736 KB Output is correct
15 Correct 37 ms 63872 KB Output is correct
16 Correct 42 ms 63940 KB Output is correct
17 Correct 37 ms 63864 KB Output is correct
18 Incorrect 36 ms 63864 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 63872 KB Output is correct
2 Correct 37 ms 63864 KB Output is correct
3 Correct 42 ms 63868 KB Output is correct
4 Correct 37 ms 63864 KB Output is correct
5 Correct 39 ms 63864 KB Output is correct
6 Correct 40 ms 63864 KB Output is correct
7 Correct 37 ms 63864 KB Output is correct
8 Correct 37 ms 63992 KB Output is correct
9 Correct 37 ms 63864 KB Output is correct
10 Correct 37 ms 63864 KB Output is correct
11 Correct 37 ms 63864 KB Output is correct
12 Correct 37 ms 63864 KB Output is correct
13 Correct 37 ms 63864 KB Output is correct
14 Correct 37 ms 63736 KB Output is correct
15 Correct 37 ms 63872 KB Output is correct
16 Correct 42 ms 63940 KB Output is correct
17 Correct 37 ms 63864 KB Output is correct
18 Correct 58 ms 63864 KB Output is correct
19 Correct 50 ms 63872 KB Output is correct
20 Correct 44 ms 63872 KB Output is correct
21 Correct 53 ms 63872 KB Output is correct
22 Correct 50 ms 63864 KB Output is correct
23 Correct 44 ms 63872 KB Output is correct
24 Correct 43 ms 63864 KB Output is correct
25 Correct 43 ms 63864 KB Output is correct
26 Correct 39 ms 63864 KB Output is correct
27 Correct 43 ms 63872 KB Output is correct
28 Correct 37 ms 63872 KB Output is correct
29 Correct 44 ms 63864 KB Output is correct
30 Correct 38 ms 63864 KB Output is correct
31 Correct 45 ms 63864 KB Output is correct
32 Correct 42 ms 63872 KB Output is correct
33 Correct 44 ms 63864 KB Output is correct
34 Correct 43 ms 63864 KB Output is correct
35 Correct 48 ms 63864 KB Output is correct
36 Correct 37 ms 63872 KB Output is correct
37 Correct 47 ms 63864 KB Output is correct
38 Correct 43 ms 63864 KB Output is correct
39 Correct 44 ms 63872 KB Output is correct
40 Correct 37 ms 63944 KB Output is correct
41 Correct 64 ms 63968 KB Output is correct
42 Correct 56 ms 63872 KB Output is correct
43 Correct 61 ms 63992 KB Output is correct
44 Correct 57 ms 63852 KB Output is correct
45 Correct 66 ms 63864 KB Output is correct
46 Correct 65 ms 63864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 63872 KB Output is correct
2 Correct 37 ms 63864 KB Output is correct
3 Correct 42 ms 63868 KB Output is correct
4 Correct 37 ms 63864 KB Output is correct
5 Correct 39 ms 63864 KB Output is correct
6 Correct 40 ms 63864 KB Output is correct
7 Correct 37 ms 63864 KB Output is correct
8 Correct 37 ms 63992 KB Output is correct
9 Correct 37 ms 63864 KB Output is correct
10 Correct 37 ms 63864 KB Output is correct
11 Correct 37 ms 63864 KB Output is correct
12 Correct 37 ms 63864 KB Output is correct
13 Correct 37 ms 63864 KB Output is correct
14 Correct 37 ms 63736 KB Output is correct
15 Correct 37 ms 63872 KB Output is correct
16 Correct 42 ms 63940 KB Output is correct
17 Correct 37 ms 63864 KB Output is correct
18 Incorrect 36 ms 63864 KB Output isn't correct
19 Halted 0 ms 0 KB -