Submission #202329

# Submission time Handle Problem Language Result Execution time Memory
202329 2020-02-15T10:48:08 Z giorgikob Collecting Stamps 3 (JOI20_ho_t3) C++17
15 / 100
89 ms 103544 KB
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

const int N = 1e6 + 69;

int n,k,l,r,ans;
ll dro,x,L;

ll A[N],T[N];

ll dp[202][202][202][2];

int main(){

    cin>>n>>L;

    for(int i=1;i<=n;i++){
        cin>>A[i];
    }

    A[n+1] = L;

    for(int i=1;i<=n;i++){
        cin>>T[i];
    }

    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=n;k++){
                for(int t=0;t<=1;t++)
                    dp[i][j][k][t] = 1e18;
            }
        }
    }




    dp[0][0][0][1] = dp[0][0][0][0] = 0;

    for(int i=0;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            for(int k=0;k<=i+j;k++){

                x = dp[i][j][k][0];
                if(x<1e18){
                    ans = max(k,ans);
                }

                dro = x + A[i+1] - A[i];
                dp[i+1][j][k+(dro<=T[i+1])][0] = min(dp[i+1][j][k+(dro<=T[i+1])][0],dro);

                dro = x + A[n+1-j] - A[n-j] + A[i];
                dp[i][j+1][k+(dro<=T[n-j])][1] = min(dp[i][j+1][k+(dro<=T[n-j])][1],dro);

                x = dp[i][j][k][1];
                if(x<1e18){
                    ans = max(k,ans);
                }

                dro = x + A[i+1] + A[n+1] - A[n+1-j];
                dp[i+1][j][k+(dro<=T[i+1])][0] = min(dp[i+1][j][k+(dro<=T[i+1])][0],dro);

                dro = x + A[n+1-j] - A[n-j];
                dp[i][j+1][k+(dro<=T[n-j])][1] = min(dp[i][j+1][k+(dro<=T[n-j])][1],dro);

            }
        }
    }

    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 888 KB Output is correct
7 Correct 5 ms 636 KB Output is correct
8 Correct 5 ms 760 KB Output is correct
9 Correct 5 ms 888 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 888 KB Output is correct
13 Correct 6 ms 888 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 632 KB Output is correct
16 Correct 5 ms 888 KB Output is correct
17 Correct 5 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 888 KB Output is correct
7 Correct 5 ms 636 KB Output is correct
8 Correct 5 ms 760 KB Output is correct
9 Correct 5 ms 888 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 888 KB Output is correct
13 Correct 6 ms 888 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 632 KB Output is correct
16 Correct 5 ms 888 KB Output is correct
17 Correct 5 ms 888 KB Output is correct
18 Correct 5 ms 1144 KB Output is correct
19 Correct 5 ms 760 KB Output is correct
20 Correct 5 ms 888 KB Output is correct
21 Correct 5 ms 1088 KB Output is correct
22 Correct 5 ms 632 KB Output is correct
23 Correct 5 ms 1144 KB Output is correct
24 Correct 5 ms 1016 KB Output is correct
25 Correct 5 ms 1016 KB Output is correct
26 Correct 5 ms 1016 KB Output is correct
27 Correct 5 ms 632 KB Output is correct
28 Correct 5 ms 636 KB Output is correct
29 Correct 5 ms 1272 KB Output is correct
30 Correct 5 ms 1148 KB Output is correct
31 Correct 5 ms 1144 KB Output is correct
32 Correct 5 ms 1016 KB Output is correct
33 Correct 5 ms 1144 KB Output is correct
34 Correct 5 ms 1144 KB Output is correct
35 Correct 5 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 888 KB Output is correct
7 Correct 5 ms 636 KB Output is correct
8 Correct 5 ms 760 KB Output is correct
9 Correct 5 ms 888 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 888 KB Output is correct
13 Correct 6 ms 888 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 632 KB Output is correct
16 Correct 5 ms 888 KB Output is correct
17 Correct 5 ms 888 KB Output is correct
18 Correct 89 ms 103544 KB Output is correct
19 Correct 53 ms 62840 KB Output is correct
20 Correct 28 ms 33528 KB Output is correct
21 Correct 50 ms 59256 KB Output is correct
22 Correct 65 ms 76920 KB Output is correct
23 Correct 24 ms 28536 KB Output is correct
24 Correct 20 ms 22396 KB Output is correct
25 Correct 24 ms 28024 KB Output is correct
26 Correct 11 ms 10744 KB Output is correct
27 Correct 25 ms 29176 KB Output is correct
28 Correct 19 ms 20984 KB Output is correct
29 Correct 25 ms 29736 KB Output is correct
30 Correct 20 ms 23420 KB Output is correct
31 Correct 23 ms 28024 KB Output is correct
32 Correct 15 ms 14716 KB Output is correct
33 Incorrect 23 ms 28024 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 888 KB Output is correct
7 Correct 5 ms 636 KB Output is correct
8 Correct 5 ms 760 KB Output is correct
9 Correct 5 ms 888 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 888 KB Output is correct
13 Correct 6 ms 888 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 632 KB Output is correct
16 Correct 5 ms 888 KB Output is correct
17 Correct 5 ms 888 KB Output is correct
18 Correct 5 ms 1144 KB Output is correct
19 Correct 5 ms 760 KB Output is correct
20 Correct 5 ms 888 KB Output is correct
21 Correct 5 ms 1088 KB Output is correct
22 Correct 5 ms 632 KB Output is correct
23 Correct 5 ms 1144 KB Output is correct
24 Correct 5 ms 1016 KB Output is correct
25 Correct 5 ms 1016 KB Output is correct
26 Correct 5 ms 1016 KB Output is correct
27 Correct 5 ms 632 KB Output is correct
28 Correct 5 ms 636 KB Output is correct
29 Correct 5 ms 1272 KB Output is correct
30 Correct 5 ms 1148 KB Output is correct
31 Correct 5 ms 1144 KB Output is correct
32 Correct 5 ms 1016 KB Output is correct
33 Correct 5 ms 1144 KB Output is correct
34 Correct 5 ms 1144 KB Output is correct
35 Correct 5 ms 1144 KB Output is correct
36 Correct 89 ms 103544 KB Output is correct
37 Correct 53 ms 62840 KB Output is correct
38 Correct 28 ms 33528 KB Output is correct
39 Correct 50 ms 59256 KB Output is correct
40 Correct 65 ms 76920 KB Output is correct
41 Correct 24 ms 28536 KB Output is correct
42 Correct 20 ms 22396 KB Output is correct
43 Correct 24 ms 28024 KB Output is correct
44 Correct 11 ms 10744 KB Output is correct
45 Correct 25 ms 29176 KB Output is correct
46 Correct 19 ms 20984 KB Output is correct
47 Correct 25 ms 29736 KB Output is correct
48 Correct 20 ms 23420 KB Output is correct
49 Correct 23 ms 28024 KB Output is correct
50 Correct 15 ms 14716 KB Output is correct
51 Incorrect 23 ms 28024 KB Output isn't correct
52 Halted 0 ms 0 KB -