Submission #202325

# Submission time Handle Problem Language Result Execution time Memory
202325 2020-02-15T10:42:51 Z giorgikob Collecting Stamps 3 (JOI20_ho_t3) C++17
15 / 100
91 ms 103416 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,L,ans;
ll dro,x;

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] = 1e9;
            }
        }
    }




    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!=1e9){
                    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!=1e9){
                    ans = max(k,ans);
                }

                dro = x + A[i+1] - A[i] + 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 632 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 5 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 632 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 5 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 1144 KB Output is correct
22 Correct 5 ms 760 KB Output is correct
23 Correct 6 ms 1272 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 632 KB Output is correct
29 Correct 5 ms 1144 KB Output is correct
30 Correct 5 ms 1144 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 632 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 5 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 91 ms 103416 KB Output is correct
19 Correct 53 ms 62712 KB Output is correct
20 Correct 26 ms 33528 KB Output is correct
21 Correct 49 ms 59256 KB Output is correct
22 Correct 65 ms 76920 KB Output is correct
23 Correct 23 ms 28536 KB Output is correct
24 Correct 18 ms 22392 KB Output is correct
25 Correct 25 ms 27900 KB Output is correct
26 Correct 10 ms 10744 KB Output is correct
27 Correct 23 ms 29180 KB Output is correct
28 Correct 17 ms 20856 KB Output is correct
29 Incorrect 24 ms 29816 KB Output isn't correct
30 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 632 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 5 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 1144 KB Output is correct
22 Correct 5 ms 760 KB Output is correct
23 Correct 6 ms 1272 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 632 KB Output is correct
29 Correct 5 ms 1144 KB Output is correct
30 Correct 5 ms 1144 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 91 ms 103416 KB Output is correct
37 Correct 53 ms 62712 KB Output is correct
38 Correct 26 ms 33528 KB Output is correct
39 Correct 49 ms 59256 KB Output is correct
40 Correct 65 ms 76920 KB Output is correct
41 Correct 23 ms 28536 KB Output is correct
42 Correct 18 ms 22392 KB Output is correct
43 Correct 25 ms 27900 KB Output is correct
44 Correct 10 ms 10744 KB Output is correct
45 Correct 23 ms 29180 KB Output is correct
46 Correct 17 ms 20856 KB Output is correct
47 Incorrect 24 ms 29816 KB Output isn't correct
48 Halted 0 ms 0 KB -