Submission #882730

# Submission time Handle Problem Language Result Execution time Memory
882730 2023-12-03T14:47:44 Z vjudge1 Bali Sculptures (APIO15_sculpture) C++17
25 / 100
1000 ms 784 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(aa) aa.begin(), aa.end()

int main(){
    ll n, a, b;
    cin>>n>>a>>b;

    vector<ll> v(n);
    for(auto &e:v) cin>>e;

    ll cur=0;
    for(ll i=60; i>=0; i--){
        cur*=2;
        vector<vector<bool>> dp(n, vector<bool>(b+1, 0));
        cur++;
        for(ll j=n-1; j>=0; j--){
            for(ll k=1; k<=b; k++){
                ll s=0;
                for(ll x=j; x<n; x++){
                    s+=v[x];

                    bool f=1;
                    ll tmp=s>>i, tmp2=cur;
                    while(tmp || tmp2){
                        if(tmp%2 && (tmp2%2)) f=0;
                        tmp/=2;
                        tmp2/=2;
                    }

                    if(f && ((x==n-1 && k == 1) || (x != n-1 && dp[x+1][k-1]))) dp[j][k]=1;
                }
            }
        }

        bool f=1;
        for(ll j=a; j<=b; j++)
            f&=(!dp[0][j]);

        if(f) cur--;
    }

    cout<<(1ll<<61) - 1 - cur<<endl;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 604 KB Output is correct
13 Correct 9 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 440 KB Output is correct
19 Correct 5 ms 348 KB Output is correct
20 Correct 1 ms 436 KB Output is correct
21 Correct 4 ms 348 KB Output is correct
22 Correct 4 ms 348 KB Output is correct
23 Correct 4 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 4 ms 348 KB Output is correct
26 Correct 9 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 3 ms 348 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Correct 4 ms 432 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 7 ms 348 KB Output is correct
34 Correct 10 ms 348 KB Output is correct
35 Correct 2 ms 348 KB Output is correct
36 Correct 10 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 4 ms 428 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 10 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 5 ms 432 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 4 ms 348 KB Output is correct
22 Correct 4 ms 348 KB Output is correct
23 Correct 4 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 4 ms 436 KB Output is correct
26 Correct 8 ms 604 KB Output is correct
27 Correct 11 ms 348 KB Output is correct
28 Correct 8 ms 432 KB Output is correct
29 Correct 9 ms 348 KB Output is correct
30 Correct 38 ms 440 KB Output is correct
31 Correct 62 ms 344 KB Output is correct
32 Correct 59 ms 348 KB Output is correct
33 Correct 3 ms 344 KB Output is correct
34 Correct 61 ms 416 KB Output is correct
35 Correct 50 ms 348 KB Output is correct
36 Correct 30 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 4 ms 436 KB Output is correct
7 Correct 1 ms 432 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 9 ms 348 KB Output is correct
14 Correct 13 ms 348 KB Output is correct
15 Correct 8 ms 600 KB Output is correct
16 Correct 9 ms 432 KB Output is correct
17 Correct 38 ms 416 KB Output is correct
18 Correct 59 ms 408 KB Output is correct
19 Correct 60 ms 424 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 58 ms 348 KB Output is correct
22 Correct 56 ms 348 KB Output is correct
23 Correct 30 ms 348 KB Output is correct
24 Correct 63 ms 784 KB Output is correct
25 Correct 50 ms 344 KB Output is correct
26 Correct 168 ms 416 KB Output is correct
27 Correct 526 ms 344 KB Output is correct
28 Execution timed out 1065 ms 348 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 9 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 412 KB Output is correct
18 Correct 1 ms 436 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 4 ms 348 KB Output is correct
22 Correct 4 ms 344 KB Output is correct
23 Correct 4 ms 440 KB Output is correct
24 Correct 2 ms 344 KB Output is correct
25 Correct 4 ms 436 KB Output is correct
26 Correct 7 ms 600 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 3 ms 348 KB Output is correct
30 Correct 2 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 7 ms 440 KB Output is correct
34 Correct 10 ms 424 KB Output is correct
35 Correct 2 ms 348 KB Output is correct
36 Correct 10 ms 348 KB Output is correct
37 Correct 11 ms 432 KB Output is correct
38 Correct 8 ms 348 KB Output is correct
39 Correct 9 ms 348 KB Output is correct
40 Correct 38 ms 348 KB Output is correct
41 Correct 59 ms 412 KB Output is correct
42 Correct 61 ms 416 KB Output is correct
43 Correct 4 ms 344 KB Output is correct
44 Correct 59 ms 412 KB Output is correct
45 Correct 50 ms 348 KB Output is correct
46 Correct 31 ms 592 KB Output is correct
47 Correct 61 ms 348 KB Output is correct
48 Correct 50 ms 344 KB Output is correct
49 Correct 163 ms 416 KB Output is correct
50 Correct 528 ms 416 KB Output is correct
51 Execution timed out 1031 ms 344 KB Time limit exceeded
52 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 9 ms 348 KB Output is correct
14 Correct 0 ms 548 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 3 ms 344 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 4 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 7 ms 392 KB Output is correct
21 Correct 10 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 10 ms 348 KB Output is correct
24 Correct 11 ms 344 KB Output is correct
25 Correct 9 ms 344 KB Output is correct
26 Correct 10 ms 348 KB Output is correct
27 Correct 38 ms 348 KB Output is correct
28 Correct 59 ms 348 KB Output is correct
29 Correct 60 ms 348 KB Output is correct
30 Correct 3 ms 344 KB Output is correct
31 Correct 59 ms 348 KB Output is correct
32 Correct 50 ms 408 KB Output is correct
33 Correct 31 ms 348 KB Output is correct
34 Correct 61 ms 348 KB Output is correct
35 Correct 51 ms 348 KB Output is correct
36 Correct 164 ms 348 KB Output is correct
37 Correct 523 ms 600 KB Output is correct
38 Execution timed out 1059 ms 348 KB Time limit exceeded
39 Halted 0 ms 0 KB -