답안 #224061

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
224061 2020-04-17T06:55:41 Z lyc Collecting Stamps 3 (JOI20_ho_t3) C++14
15 / 100
2000 ms 34296 KB
#include <bits/stdc++.h>
using namespace std;

#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)

const int MX_N = 205;
const int MX_T = 1e9+5;

int N, L;
int X[MX_N], T[MX_N];

int atL[MX_N][MX_N][MX_N];
int atR[MX_N][MX_N][MX_N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> L;
    FOR(i,1,N){
        cin >> X[i];
    }
    FOR(i,1,N){
        cin >> T[i];
    }

    X[0] = 0; X[N+1] = L;
    T[0] = T[N+1] = -1;
    //atL[N+1][0][0] = atR[N+1][0][0] = 0;
    FOR(l,1,N+1){
        FOR(r,0,l-1){
            atL[l][r][0] = min(1LL*MX_T, 2LL*X[r] + L-X[l]);
            atR[l][r][0] = min(1LL*MX_T, 2LL*(L-X[l]) + X[r]);
        }
    }

    int ans = 0;
    FOR(y,1,N){
        FOR(l,1,N+1){
            FOR(r,0,l-1){
                atL[l][r][y] = MX_T;
                FOR(k,l+1,N+1){
                    if (atL[k][r][y-1] + X[k]-X[l] <= T[l]) atL[l][r][y] = min(atL[l][r][y], atL[k][r][y-1] + X[k]-X[l]);
                    if (atR[k][r][y-1] + L-X[l]+X[r] <= T[l]) atL[l][r][y] = min(atL[l][r][y], atR[k][r][y-1] + L-X[l]+X[r]);
                }
                if (atL[l][r][y] < MX_T) ans = max(ans,y);
                atR[l][r][y] = MX_T;
                FOR(k,0,r-1){
                    if (atR[l][k][y-1] + X[r]-X[k] <= T[r]) atR[l][r][y] = min(atR[l][r][y], atR[l][k][y-1] + X[r]-X[k]);
                    if (atL[l][k][y-1] + X[r]+L-X[l] <= T[r]) atR[l][r][y] = min(atR[l][r][y], atL[l][k][y-1] + X[r]+L-X[l]);
                }
                if (atR[l][r][y] < MX_T) ans = max(ans,y);
                //TRACE(l _ r _ y _ atL[l][r][y] _ atR[l][r][y]);
                //cout << flush;
                //assert(atL[l][r][y] >= 0 && atR[l][r][y] >= 0);
            }
        }
    }
    cout << ans << '\n';
}

# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 640 KB Output is correct
13 Correct 5 ms 640 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 5 ms 512 KB Output is correct
16 Correct 5 ms 512 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 640 KB Output is correct
13 Correct 5 ms 640 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 5 ms 512 KB Output is correct
16 Correct 5 ms 512 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 5 ms 640 KB Output is correct
19 Correct 5 ms 512 KB Output is correct
20 Correct 5 ms 640 KB Output is correct
21 Correct 5 ms 640 KB Output is correct
22 Correct 4 ms 512 KB Output is correct
23 Correct 5 ms 640 KB Output is correct
24 Correct 5 ms 640 KB Output is correct
25 Correct 5 ms 640 KB Output is correct
26 Correct 5 ms 640 KB Output is correct
27 Correct 5 ms 512 KB Output is correct
28 Correct 5 ms 512 KB Output is correct
29 Correct 5 ms 640 KB Output is correct
30 Correct 5 ms 640 KB Output is correct
31 Correct 5 ms 640 KB Output is correct
32 Correct 5 ms 640 KB Output is correct
33 Correct 5 ms 640 KB Output is correct
34 Correct 5 ms 640 KB Output is correct
35 Correct 5 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 640 KB Output is correct
13 Correct 5 ms 640 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 5 ms 512 KB Output is correct
16 Correct 5 ms 512 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 1497 ms 28024 KB Output is correct
19 Correct 556 ms 17272 KB Output is correct
20 Correct 108 ms 9592 KB Output is correct
21 Correct 447 ms 16484 KB Output is correct
22 Correct 833 ms 21232 KB Output is correct
23 Correct 85 ms 8192 KB Output is correct
24 Correct 44 ms 6528 KB Output is correct
25 Correct 80 ms 8088 KB Output is correct
26 Correct 14 ms 3456 KB Output is correct
27 Correct 93 ms 8440 KB Output is correct
28 Correct 44 ms 6208 KB Output is correct
29 Correct 89 ms 8584 KB Output is correct
30 Correct 51 ms 6784 KB Output is correct
31 Correct 77 ms 8064 KB Output is correct
32 Correct 22 ms 4480 KB Output is correct
33 Correct 81 ms 8064 KB Output is correct
34 Correct 13 ms 3200 KB Output is correct
35 Correct 67 ms 7928 KB Output is correct
36 Correct 19 ms 4096 KB Output is correct
37 Correct 84 ms 8320 KB Output is correct
38 Correct 26 ms 4864 KB Output is correct
39 Correct 84 ms 8704 KB Output is correct
40 Correct 36 ms 5496 KB Output is correct
41 Execution timed out 2099 ms 34296 KB Time limit exceeded
42 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 640 KB Output is correct
13 Correct 5 ms 640 KB Output is correct
14 Correct 5 ms 512 KB Output is correct
15 Correct 5 ms 512 KB Output is correct
16 Correct 5 ms 512 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 5 ms 640 KB Output is correct
19 Correct 5 ms 512 KB Output is correct
20 Correct 5 ms 640 KB Output is correct
21 Correct 5 ms 640 KB Output is correct
22 Correct 4 ms 512 KB Output is correct
23 Correct 5 ms 640 KB Output is correct
24 Correct 5 ms 640 KB Output is correct
25 Correct 5 ms 640 KB Output is correct
26 Correct 5 ms 640 KB Output is correct
27 Correct 5 ms 512 KB Output is correct
28 Correct 5 ms 512 KB Output is correct
29 Correct 5 ms 640 KB Output is correct
30 Correct 5 ms 640 KB Output is correct
31 Correct 5 ms 640 KB Output is correct
32 Correct 5 ms 640 KB Output is correct
33 Correct 5 ms 640 KB Output is correct
34 Correct 5 ms 640 KB Output is correct
35 Correct 5 ms 640 KB Output is correct
36 Correct 1497 ms 28024 KB Output is correct
37 Correct 556 ms 17272 KB Output is correct
38 Correct 108 ms 9592 KB Output is correct
39 Correct 447 ms 16484 KB Output is correct
40 Correct 833 ms 21232 KB Output is correct
41 Correct 85 ms 8192 KB Output is correct
42 Correct 44 ms 6528 KB Output is correct
43 Correct 80 ms 8088 KB Output is correct
44 Correct 14 ms 3456 KB Output is correct
45 Correct 93 ms 8440 KB Output is correct
46 Correct 44 ms 6208 KB Output is correct
47 Correct 89 ms 8584 KB Output is correct
48 Correct 51 ms 6784 KB Output is correct
49 Correct 77 ms 8064 KB Output is correct
50 Correct 22 ms 4480 KB Output is correct
51 Correct 81 ms 8064 KB Output is correct
52 Correct 13 ms 3200 KB Output is correct
53 Correct 67 ms 7928 KB Output is correct
54 Correct 19 ms 4096 KB Output is correct
55 Correct 84 ms 8320 KB Output is correct
56 Correct 26 ms 4864 KB Output is correct
57 Correct 84 ms 8704 KB Output is correct
58 Correct 36 ms 5496 KB Output is correct
59 Execution timed out 2099 ms 34296 KB Time limit exceeded
60 Halted 0 ms 0 KB -