Submission #621238

# Submission time Handle Problem Language Result Execution time Memory
621238 2022-08-03T15:23:29 Z daisy2 Bali Sculptures (APIO15_sculpture) C++14
71 / 100
1000 ms 4308 KB
#include<iostream>
#include<cstring>
#define endl '\n'
using namespace std;
long long n,a,b,m[2005],r,pref[2005],ts;
bool dp[2005][2005];
bool isposs(long long num)
{
    for(long long i=0;i<=2000;i++)
        memset(dp[i],0,sizeof(dp[i]));

    dp[0][0]=1;
    bool is=0;
    for(long long i=1;i<=n;i++)
    {
        for(long long j=i;j>=1;j--)
        {
            ts=pref[i]-pref[j-1];
            is=0;
            //if(ts>num) continue;
            for(long long bit=45;bit>=0;bit--)
            {
                if((((long long)1<<bit)&num)==0 && (((long long)1<<bit)&ts)==((long long)1<<bit))
                {
                    is=1;break;
                }
            }
            if(is==1) continue;

            for(long long brg=1;brg<=min(j,b);brg++)
            {
                dp[i][brg]|=dp[j-1][brg-1];
            }
        }
    }
    for(long long i=a;i<=b;i++)
    {
       if(dp[n][i]==1) return 1;
    }
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>a>>b;

    for(long long i=1;i<=n;i++)
    {
        cin>>m[i];

        pref[i]=pref[i-1]+m[i];
    }

    r=(((long long)1<<46)-1);

    for(long long i=45;i>=0;i--)
    {
        r^=((long long)1<<i);//cout<<i<<" "<<r<<endl;
        if(isposs(r)==0)
        {
            r|=((long long)1<<i);
        }
    }
  cout<<r<<endl;
}
/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4180 KB Output is correct
2 Correct 12 ms 4260 KB Output is correct
3 Correct 11 ms 4180 KB Output is correct
4 Correct 12 ms 4180 KB Output is correct
5 Correct 10 ms 4268 KB Output is correct
6 Correct 10 ms 4260 KB Output is correct
7 Correct 12 ms 4256 KB Output is correct
8 Correct 15 ms 4260 KB Output is correct
9 Correct 12 ms 4180 KB Output is correct
10 Correct 12 ms 4184 KB Output is correct
11 Correct 10 ms 4180 KB Output is correct
12 Correct 10 ms 4256 KB Output is correct
13 Correct 13 ms 4180 KB Output is correct
14 Correct 12 ms 4260 KB Output is correct
15 Correct 15 ms 4180 KB Output is correct
16 Correct 10 ms 4180 KB Output is correct
17 Correct 13 ms 4260 KB Output is correct
18 Correct 15 ms 4172 KB Output is correct
19 Correct 11 ms 4168 KB Output is correct
20 Correct 10 ms 4172 KB Output is correct
21 Correct 13 ms 4172 KB Output is correct
22 Correct 10 ms 4172 KB Output is correct
23 Correct 10 ms 4260 KB Output is correct
24 Correct 10 ms 4172 KB Output is correct
25 Correct 13 ms 4240 KB Output is correct
26 Correct 10 ms 4256 KB Output is correct
27 Correct 12 ms 4172 KB Output is correct
28 Correct 13 ms 4180 KB Output is correct
29 Correct 11 ms 4180 KB Output is correct
30 Correct 11 ms 4180 KB Output is correct
31 Correct 10 ms 4168 KB Output is correct
32 Correct 10 ms 4260 KB Output is correct
33 Correct 10 ms 4156 KB Output is correct
34 Correct 11 ms 4180 KB Output is correct
35 Correct 10 ms 4260 KB Output is correct
36 Correct 9 ms 4260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 4260 KB Output is correct
2 Correct 12 ms 4180 KB Output is correct
3 Correct 11 ms 4260 KB Output is correct
4 Correct 14 ms 4264 KB Output is correct
5 Correct 14 ms 4256 KB Output is correct
6 Correct 12 ms 4180 KB Output is correct
7 Correct 12 ms 4256 KB Output is correct
8 Correct 10 ms 4180 KB Output is correct
9 Correct 10 ms 4260 KB Output is correct
10 Correct 10 ms 4180 KB Output is correct
11 Correct 10 ms 4264 KB Output is correct
12 Correct 10 ms 4180 KB Output is correct
13 Correct 11 ms 4168 KB Output is correct
14 Correct 10 ms 4260 KB Output is correct
15 Correct 9 ms 4180 KB Output is correct
16 Correct 11 ms 4180 KB Output is correct
17 Correct 12 ms 4308 KB Output is correct
18 Correct 10 ms 4180 KB Output is correct
19 Correct 12 ms 4264 KB Output is correct
20 Correct 12 ms 4260 KB Output is correct
21 Correct 10 ms 4180 KB Output is correct
22 Correct 12 ms 4180 KB Output is correct
23 Correct 10 ms 4180 KB Output is correct
24 Correct 13 ms 4180 KB Output is correct
25 Correct 12 ms 4256 KB Output is correct
26 Correct 12 ms 4268 KB Output is correct
27 Correct 11 ms 4180 KB Output is correct
28 Correct 13 ms 4260 KB Output is correct
29 Correct 15 ms 4180 KB Output is correct
30 Correct 15 ms 4256 KB Output is correct
31 Correct 17 ms 4264 KB Output is correct
32 Correct 19 ms 4264 KB Output is correct
33 Correct 12 ms 4180 KB Output is correct
34 Correct 13 ms 4180 KB Output is correct
35 Correct 12 ms 4180 KB Output is correct
36 Correct 12 ms 4264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4180 KB Output is correct
2 Correct 10 ms 4256 KB Output is correct
3 Correct 9 ms 4256 KB Output is correct
4 Correct 10 ms 4180 KB Output is correct
5 Correct 10 ms 4260 KB Output is correct
6 Correct 11 ms 4260 KB Output is correct
7 Correct 11 ms 4180 KB Output is correct
8 Correct 11 ms 4260 KB Output is correct
9 Correct 15 ms 4180 KB Output is correct
10 Correct 12 ms 4256 KB Output is correct
11 Correct 14 ms 4264 KB Output is correct
12 Correct 11 ms 4180 KB Output is correct
13 Correct 12 ms 4172 KB Output is correct
14 Correct 10 ms 4180 KB Output is correct
15 Correct 13 ms 4180 KB Output is correct
16 Correct 12 ms 4180 KB Output is correct
17 Correct 13 ms 4256 KB Output is correct
18 Correct 13 ms 4180 KB Output is correct
19 Correct 12 ms 4180 KB Output is correct
20 Correct 13 ms 4260 KB Output is correct
21 Correct 13 ms 4264 KB Output is correct
22 Correct 17 ms 4308 KB Output is correct
23 Correct 14 ms 4180 KB Output is correct
24 Correct 15 ms 4260 KB Output is correct
25 Correct 17 ms 4180 KB Output is correct
26 Correct 20 ms 4260 KB Output is correct
27 Correct 20 ms 4180 KB Output is correct
28 Correct 23 ms 4268 KB Output is correct
29 Correct 23 ms 4180 KB Output is correct
30 Correct 20 ms 4264 KB Output is correct
31 Correct 23 ms 4240 KB Output is correct
32 Correct 22 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4256 KB Output is correct
2 Correct 11 ms 4260 KB Output is correct
3 Correct 12 ms 4180 KB Output is correct
4 Correct 10 ms 4264 KB Output is correct
5 Correct 11 ms 4180 KB Output is correct
6 Correct 11 ms 4172 KB Output is correct
7 Correct 11 ms 4180 KB Output is correct
8 Correct 12 ms 4180 KB Output is correct
9 Correct 13 ms 4252 KB Output is correct
10 Correct 13 ms 4180 KB Output is correct
11 Correct 10 ms 4180 KB Output is correct
12 Correct 11 ms 4256 KB Output is correct
13 Correct 10 ms 4256 KB Output is correct
14 Correct 10 ms 4264 KB Output is correct
15 Correct 10 ms 4260 KB Output is correct
16 Correct 12 ms 4176 KB Output is correct
17 Correct 14 ms 4260 KB Output is correct
18 Correct 10 ms 4180 KB Output is correct
19 Correct 11 ms 4180 KB Output is correct
20 Correct 13 ms 4260 KB Output is correct
21 Correct 11 ms 4264 KB Output is correct
22 Correct 10 ms 4260 KB Output is correct
23 Correct 10 ms 4180 KB Output is correct
24 Correct 10 ms 4180 KB Output is correct
25 Correct 11 ms 4260 KB Output is correct
26 Correct 12 ms 4180 KB Output is correct
27 Correct 11 ms 4172 KB Output is correct
28 Correct 10 ms 4256 KB Output is correct
29 Correct 10 ms 4180 KB Output is correct
30 Correct 10 ms 4256 KB Output is correct
31 Correct 12 ms 4256 KB Output is correct
32 Correct 11 ms 4308 KB Output is correct
33 Correct 11 ms 4180 KB Output is correct
34 Correct 11 ms 4180 KB Output is correct
35 Correct 10 ms 4180 KB Output is correct
36 Correct 10 ms 4260 KB Output is correct
37 Correct 11 ms 4180 KB Output is correct
38 Correct 12 ms 4180 KB Output is correct
39 Correct 12 ms 4180 KB Output is correct
40 Correct 16 ms 4180 KB Output is correct
41 Correct 14 ms 4180 KB Output is correct
42 Correct 12 ms 4180 KB Output is correct
43 Correct 12 ms 4180 KB Output is correct
44 Correct 15 ms 4172 KB Output is correct
45 Correct 14 ms 4256 KB Output is correct
46 Correct 13 ms 4180 KB Output is correct
47 Correct 14 ms 4264 KB Output is correct
48 Correct 13 ms 4180 KB Output is correct
49 Correct 17 ms 4252 KB Output is correct
50 Correct 20 ms 4180 KB Output is correct
51 Correct 25 ms 4256 KB Output is correct
52 Correct 24 ms 4172 KB Output is correct
53 Correct 18 ms 4268 KB Output is correct
54 Correct 22 ms 4264 KB Output is correct
55 Correct 21 ms 4268 KB Output is correct
56 Correct 12 ms 4180 KB Output is correct
57 Correct 17 ms 4256 KB Output is correct
58 Correct 20 ms 4180 KB Output is correct
59 Correct 17 ms 4180 KB Output is correct
60 Correct 21 ms 4256 KB Output is correct
61 Correct 17 ms 4180 KB Output is correct
62 Correct 18 ms 4176 KB Output is correct
63 Correct 20 ms 4180 KB Output is correct
64 Correct 28 ms 4256 KB Output is correct
65 Correct 12 ms 4268 KB Output is correct
66 Correct 12 ms 4260 KB Output is correct
67 Correct 14 ms 4272 KB Output is correct
68 Correct 15 ms 4180 KB Output is correct
69 Correct 17 ms 4260 KB Output is correct
70 Correct 18 ms 4240 KB Output is correct
71 Correct 15 ms 4272 KB Output is correct
72 Correct 22 ms 4300 KB Output is correct
73 Correct 23 ms 4268 KB Output is correct
74 Correct 21 ms 4268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4180 KB Output is correct
2 Correct 11 ms 4268 KB Output is correct
3 Correct 10 ms 4180 KB Output is correct
4 Correct 15 ms 4260 KB Output is correct
5 Correct 10 ms 4180 KB Output is correct
6 Correct 13 ms 4256 KB Output is correct
7 Correct 13 ms 4180 KB Output is correct
8 Correct 12 ms 4180 KB Output is correct
9 Correct 11 ms 4180 KB Output is correct
10 Correct 13 ms 4260 KB Output is correct
11 Correct 12 ms 4180 KB Output is correct
12 Correct 10 ms 4260 KB Output is correct
13 Correct 10 ms 4308 KB Output is correct
14 Correct 10 ms 4260 KB Output is correct
15 Correct 11 ms 4256 KB Output is correct
16 Correct 10 ms 4172 KB Output is correct
17 Correct 10 ms 4180 KB Output is correct
18 Correct 10 ms 4264 KB Output is correct
19 Correct 10 ms 4260 KB Output is correct
20 Correct 12 ms 4180 KB Output is correct
21 Correct 11 ms 4180 KB Output is correct
22 Correct 11 ms 4180 KB Output is correct
23 Correct 13 ms 4172 KB Output is correct
24 Correct 10 ms 4256 KB Output is correct
25 Correct 10 ms 4260 KB Output is correct
26 Correct 11 ms 4260 KB Output is correct
27 Correct 11 ms 4180 KB Output is correct
28 Correct 13 ms 4264 KB Output is correct
29 Correct 13 ms 4180 KB Output is correct
30 Correct 12 ms 4180 KB Output is correct
31 Correct 13 ms 4256 KB Output is correct
32 Correct 18 ms 4256 KB Output is correct
33 Correct 16 ms 4172 KB Output is correct
34 Correct 13 ms 4256 KB Output is correct
35 Correct 15 ms 4256 KB Output is correct
36 Correct 18 ms 4180 KB Output is correct
37 Correct 20 ms 4180 KB Output is correct
38 Correct 23 ms 4180 KB Output is correct
39 Correct 22 ms 4268 KB Output is correct
40 Correct 18 ms 4264 KB Output is correct
41 Correct 21 ms 4264 KB Output is correct
42 Correct 25 ms 4260 KB Output is correct
43 Correct 11 ms 4256 KB Output is correct
44 Correct 13 ms 4260 KB Output is correct
45 Correct 16 ms 4180 KB Output is correct
46 Correct 17 ms 4180 KB Output is correct
47 Correct 22 ms 4264 KB Output is correct
48 Correct 17 ms 4264 KB Output is correct
49 Correct 19 ms 4180 KB Output is correct
50 Correct 18 ms 4264 KB Output is correct
51 Correct 15 ms 4264 KB Output is correct
52 Correct 217 ms 4256 KB Output is correct
53 Correct 589 ms 4260 KB Output is correct
54 Correct 395 ms 4276 KB Output is correct
55 Correct 515 ms 4268 KB Output is correct
56 Execution timed out 1074 ms 4180 KB Time limit exceeded
57 Halted 0 ms 0 KB -