Submission #621234

# Submission time Handle Problem Language Result Execution time Memory
621234 2022-08-03T15:19:05 Z daisy2 Bali Sculptures (APIO15_sculpture) C++14
46 / 100
26 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=35;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];
            }
        }
    }
    bool re=0;
    for(long long i=a;i<=b;i++)
    {
       re|=dp[n][i];
      // if(dp[n][i])
       // cout<<num<<" "<<i<<endl;
    }
    return re;
}
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<<36)-1);
    long long totst;
    for(long long i=35;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
*/

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:61:15: warning: unused variable 'totst' [-Wunused-variable]
   61 |     long long totst;
      |               ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4264 KB Output is correct
2 Correct 9 ms 4260 KB Output is correct
3 Correct 7 ms 4260 KB Output is correct
4 Correct 8 ms 4180 KB Output is correct
5 Correct 8 ms 4260 KB Output is correct
6 Correct 9 ms 4180 KB Output is correct
7 Correct 8 ms 4168 KB Output is correct
8 Correct 7 ms 4180 KB Output is correct
9 Correct 9 ms 4256 KB Output is correct
10 Correct 8 ms 4260 KB Output is correct
11 Correct 9 ms 4260 KB Output is correct
12 Correct 8 ms 4172 KB Output is correct
13 Correct 8 ms 4180 KB Output is correct
14 Correct 8 ms 4180 KB Output is correct
15 Correct 12 ms 4304 KB Output is correct
16 Correct 9 ms 4180 KB Output is correct
17 Correct 7 ms 4260 KB Output is correct
18 Correct 8 ms 4264 KB Output is correct
19 Correct 8 ms 4180 KB Output is correct
20 Correct 8 ms 4180 KB Output is correct
21 Correct 8 ms 4180 KB Output is correct
22 Correct 8 ms 4176 KB Output is correct
23 Correct 9 ms 4256 KB Output is correct
24 Correct 9 ms 4180 KB Output is correct
25 Correct 9 ms 4180 KB Output is correct
26 Correct 9 ms 4180 KB Output is correct
27 Correct 8 ms 4176 KB Output is correct
28 Correct 8 ms 4180 KB Output is correct
29 Correct 8 ms 4260 KB Output is correct
30 Correct 11 ms 4176 KB Output is correct
31 Correct 8 ms 4264 KB Output is correct
32 Correct 9 ms 4180 KB Output is correct
33 Correct 8 ms 4176 KB Output is correct
34 Correct 10 ms 4180 KB Output is correct
35 Correct 8 ms 4180 KB Output is correct
36 Correct 9 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4172 KB Output is correct
2 Correct 9 ms 4260 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 9 ms 4256 KB Output is correct
5 Correct 8 ms 4180 KB Output is correct
6 Correct 8 ms 4256 KB Output is correct
7 Correct 8 ms 4180 KB Output is correct
8 Correct 9 ms 4256 KB Output is correct
9 Correct 11 ms 4168 KB Output is correct
10 Correct 8 ms 4260 KB Output is correct
11 Correct 8 ms 4180 KB Output is correct
12 Correct 8 ms 4256 KB Output is correct
13 Correct 9 ms 4180 KB Output is correct
14 Correct 8 ms 4180 KB Output is correct
15 Correct 8 ms 4180 KB Output is correct
16 Correct 8 ms 4176 KB Output is correct
17 Correct 10 ms 4308 KB Output is correct
18 Correct 8 ms 4180 KB Output is correct
19 Correct 8 ms 4180 KB Output is correct
20 Correct 8 ms 4180 KB Output is correct
21 Correct 8 ms 4256 KB Output is correct
22 Correct 9 ms 4180 KB Output is correct
23 Correct 9 ms 4260 KB Output is correct
24 Correct 8 ms 4180 KB Output is correct
25 Correct 9 ms 4172 KB Output is correct
26 Correct 9 ms 4256 KB Output is correct
27 Correct 8 ms 4172 KB Output is correct
28 Correct 9 ms 4264 KB Output is correct
29 Correct 9 ms 4300 KB Output is correct
30 Correct 9 ms 4172 KB Output is correct
31 Correct 11 ms 4180 KB Output is correct
32 Correct 10 ms 4260 KB Output is correct
33 Correct 9 ms 4180 KB Output is correct
34 Correct 13 ms 4180 KB Output is correct
35 Correct 10 ms 4260 KB Output is correct
36 Correct 9 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4256 KB Output is correct
2 Correct 8 ms 4180 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 9 ms 4260 KB Output is correct
5 Correct 8 ms 4180 KB Output is correct
6 Correct 8 ms 4268 KB Output is correct
7 Correct 8 ms 4180 KB Output is correct
8 Correct 10 ms 4168 KB Output is correct
9 Correct 8 ms 4180 KB Output is correct
10 Correct 8 ms 4180 KB Output is correct
11 Correct 9 ms 4176 KB Output is correct
12 Correct 9 ms 4168 KB Output is correct
13 Correct 9 ms 4168 KB Output is correct
14 Correct 11 ms 4256 KB Output is correct
15 Correct 9 ms 4180 KB Output is correct
16 Correct 11 ms 4260 KB Output is correct
17 Correct 10 ms 4176 KB Output is correct
18 Correct 10 ms 4180 KB Output is correct
19 Correct 10 ms 4180 KB Output is correct
20 Correct 10 ms 4264 KB Output is correct
21 Correct 10 ms 4268 KB Output is correct
22 Correct 10 ms 4180 KB Output is correct
23 Correct 10 ms 4180 KB Output is correct
24 Correct 11 ms 4260 KB Output is correct
25 Correct 11 ms 4180 KB Output is correct
26 Correct 13 ms 4180 KB Output is correct
27 Correct 16 ms 4268 KB Output is correct
28 Correct 18 ms 4264 KB Output is correct
29 Correct 17 ms 4180 KB Output is correct
30 Correct 14 ms 4268 KB Output is correct
31 Correct 26 ms 4176 KB Output is correct
32 Correct 18 ms 4268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4168 KB Output is correct
2 Correct 8 ms 4260 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 8 ms 4180 KB Output is correct
5 Correct 9 ms 4256 KB Output is correct
6 Correct 9 ms 4180 KB Output is correct
7 Correct 10 ms 4264 KB Output is correct
8 Correct 8 ms 4260 KB Output is correct
9 Correct 9 ms 4256 KB Output is correct
10 Correct 10 ms 4180 KB Output is correct
11 Correct 11 ms 4172 KB Output is correct
12 Correct 8 ms 4180 KB Output is correct
13 Correct 8 ms 4264 KB Output is correct
14 Correct 9 ms 4180 KB Output is correct
15 Correct 8 ms 4180 KB Output is correct
16 Correct 8 ms 4180 KB Output is correct
17 Correct 9 ms 4184 KB Output is correct
18 Correct 9 ms 4260 KB Output is correct
19 Correct 8 ms 4180 KB Output is correct
20 Correct 8 ms 4260 KB Output is correct
21 Correct 8 ms 4180 KB Output is correct
22 Correct 8 ms 4180 KB Output is correct
23 Correct 9 ms 4256 KB Output is correct
24 Correct 8 ms 4180 KB Output is correct
25 Correct 8 ms 4180 KB Output is correct
26 Correct 8 ms 4256 KB Output is correct
27 Correct 8 ms 4260 KB Output is correct
28 Correct 9 ms 4180 KB Output is correct
29 Correct 8 ms 4180 KB Output is correct
30 Correct 8 ms 4180 KB Output is correct
31 Correct 9 ms 4180 KB Output is correct
32 Correct 8 ms 4168 KB Output is correct
33 Correct 10 ms 4180 KB Output is correct
34 Correct 8 ms 4264 KB Output is correct
35 Correct 10 ms 4256 KB Output is correct
36 Correct 9 ms 4180 KB Output is correct
37 Correct 8 ms 4172 KB Output is correct
38 Correct 9 ms 4180 KB Output is correct
39 Correct 9 ms 4180 KB Output is correct
40 Correct 9 ms 4180 KB Output is correct
41 Correct 10 ms 4264 KB Output is correct
42 Correct 10 ms 4224 KB Output is correct
43 Correct 9 ms 4176 KB Output is correct
44 Correct 10 ms 4172 KB Output is correct
45 Correct 10 ms 4264 KB Output is correct
46 Correct 9 ms 4180 KB Output is correct
47 Correct 10 ms 4180 KB Output is correct
48 Correct 11 ms 4180 KB Output is correct
49 Correct 15 ms 4268 KB Output is correct
50 Correct 16 ms 4172 KB Output is correct
51 Correct 18 ms 4180 KB Output is correct
52 Correct 17 ms 4172 KB Output is correct
53 Correct 15 ms 4264 KB Output is correct
54 Correct 16 ms 4180 KB Output is correct
55 Correct 17 ms 4268 KB Output is correct
56 Correct 8 ms 4180 KB Output is correct
57 Correct 9 ms 4180 KB Output is correct
58 Correct 10 ms 4180 KB Output is correct
59 Correct 10 ms 4180 KB Output is correct
60 Correct 10 ms 4172 KB Output is correct
61 Incorrect 10 ms 4176 KB Output isn't correct
62 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4180 KB Output is correct
2 Correct 12 ms 4260 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 8 ms 4180 KB Output is correct
5 Correct 8 ms 4168 KB Output is correct
6 Correct 8 ms 4180 KB Output is correct
7 Correct 8 ms 4168 KB Output is correct
8 Correct 8 ms 4180 KB Output is correct
9 Correct 8 ms 4180 KB Output is correct
10 Correct 10 ms 4260 KB Output is correct
11 Correct 9 ms 4176 KB Output is correct
12 Correct 8 ms 4180 KB Output is correct
13 Correct 9 ms 4184 KB Output is correct
14 Correct 9 ms 4180 KB Output is correct
15 Correct 8 ms 4180 KB Output is correct
16 Correct 8 ms 4260 KB Output is correct
17 Correct 8 ms 4164 KB Output is correct
18 Correct 8 ms 4180 KB Output is correct
19 Correct 8 ms 4248 KB Output is correct
20 Correct 8 ms 4168 KB Output is correct
21 Correct 8 ms 4168 KB Output is correct
22 Correct 10 ms 4256 KB Output is correct
23 Correct 9 ms 4180 KB Output is correct
24 Correct 8 ms 4264 KB Output is correct
25 Correct 9 ms 4256 KB Output is correct
26 Correct 9 ms 4184 KB Output is correct
27 Correct 9 ms 4180 KB Output is correct
28 Correct 12 ms 4180 KB Output is correct
29 Correct 10 ms 4260 KB Output is correct
30 Correct 10 ms 4180 KB Output is correct
31 Correct 10 ms 4180 KB Output is correct
32 Correct 10 ms 4180 KB Output is correct
33 Correct 10 ms 4172 KB Output is correct
34 Correct 11 ms 4180 KB Output is correct
35 Correct 11 ms 4264 KB Output is correct
36 Correct 13 ms 4180 KB Output is correct
37 Correct 15 ms 4172 KB Output is correct
38 Correct 19 ms 4268 KB Output is correct
39 Correct 17 ms 4180 KB Output is correct
40 Correct 14 ms 4264 KB Output is correct
41 Correct 16 ms 4180 KB Output is correct
42 Correct 17 ms 4268 KB Output is correct
43 Correct 8 ms 4180 KB Output is correct
44 Correct 9 ms 4264 KB Output is correct
45 Correct 9 ms 4260 KB Output is correct
46 Correct 11 ms 4180 KB Output is correct
47 Correct 9 ms 4276 KB Output is correct
48 Incorrect 10 ms 4264 KB Output isn't correct
49 Halted 0 ms 0 KB -