Submission #146477

# Submission time Handle Problem Language Result Execution time Memory
146477 2019-08-24T08:53:48 Z LittleFlowers__ Bali Sculptures (APIO15_sculpture) C++14
37 / 100
42 ms 4356 KB
#include<bits/stdc++.h>
using namespace std;

#define in ({ll x=0;int n=0,c=getchar();for(;!isdigit(c);c=getchar()) n=c=='-';for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define inchar ({char c=getchar();while(c==' '||c=='\n') c=getchar();c;})
#define instring ({string s;char c=getchar();while(c==' '||c=='\n') c=getchar();while(c!=' '&&c!='\n') s+=c,c=getchar();s;})

#define ll long long
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define ROF(i,a,b) for(auto i=b;a<=i;i--)
#define rr(x) " "<<#x<<'='<<x<<" "

#define bit(x,i) ((x>>(i-1))&1ll)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1ll<<(i-1)))
#define pow2(x) (1ll<<x)

#define mt make_tuple
#define pi pair<int,int>
#define x first
#define y second

#define VEC(i,a) for(auto&i:a)
#define pb push_back
#define allv(a) a.begin(),a.end()
#define endv(a) (int)a.size()-1

#define ifnot(x) if(!(x))
#define middle(a,b) (a+(b-(a))/2)
#define bp(x) ((x)*(x))
#define bitnum(x) __builtin_popcountll(x)
////////////////////////////////////////// NIRO
int cou=0;

const int N=1005;
int n,A,B;
ll a[N];

int f[N][N];
int s[N];

ll all;
ll SUM(int u,int v){ll res=s[v]-s[u-1];return (res&all)==0;}
main()
{
    //freopen("nr.inp","r",stdin);
    n=in,A=in,B=in;
    FOR(i,1,n) a[i]=in;
    FOR(i,1,n) s[i]=s[i-1]+a[i];
    ROF(bit,1,40)
    {
        memset(f,0,sizeof(f));
        all=on(all,bit);
        FOR(i,1,n) f[i][1]=SUM(1,i);

        if(bit==2) cou=1;
        FOR(i,1,n) FOR(j,2,B) FOR(k,1,i-1) if(f[k][j-1]&&SUM(k+1,i)) f[i][j]=1;

        all=off(all,bit);
        FOR(i,A,B) if(f[n][i]) all=on(all,bit);

    }
    FOR(i,1,40) {if(bit(all,i)) all=off(all,i);else all=on(all,i);}
    cout<<all;
}

Compilation message

sculpture.cpp:44:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Correct 13 ms 4344 KB Output is correct
2 Correct 13 ms 4344 KB Output is correct
3 Correct 13 ms 4344 KB Output is correct
4 Correct 13 ms 4344 KB Output is correct
5 Correct 14 ms 4356 KB Output is correct
6 Correct 13 ms 4344 KB Output is correct
7 Correct 13 ms 4344 KB Output is correct
8 Correct 13 ms 4344 KB Output is correct
9 Correct 13 ms 4344 KB Output is correct
10 Correct 14 ms 4204 KB Output is correct
11 Correct 14 ms 4320 KB Output is correct
12 Correct 13 ms 4216 KB Output is correct
13 Correct 16 ms 4216 KB Output is correct
14 Correct 13 ms 4216 KB Output is correct
15 Correct 13 ms 4216 KB Output is correct
16 Correct 13 ms 4216 KB Output is correct
17 Correct 13 ms 4344 KB Output is correct
18 Correct 13 ms 4344 KB Output is correct
19 Correct 13 ms 4216 KB Output is correct
20 Correct 13 ms 4344 KB Output is correct
21 Correct 13 ms 4344 KB Output is correct
22 Correct 14 ms 4344 KB Output is correct
23 Correct 14 ms 4216 KB Output is correct
24 Correct 13 ms 4344 KB Output is correct
25 Correct 13 ms 4344 KB Output is correct
26 Correct 14 ms 4344 KB Output is correct
27 Correct 13 ms 4344 KB Output is correct
28 Incorrect 14 ms 4344 KB Output isn't correct
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 4216 KB Output is correct
2 Correct 15 ms 4344 KB Output is correct
3 Correct 13 ms 4220 KB Output is correct
4 Correct 15 ms 4344 KB Output is correct
5 Correct 14 ms 4344 KB Output is correct
6 Correct 14 ms 4216 KB Output is correct
7 Correct 14 ms 4324 KB Output is correct
8 Correct 14 ms 4344 KB Output is correct
9 Correct 15 ms 4344 KB Output is correct
10 Correct 13 ms 4216 KB Output is correct
11 Correct 14 ms 4216 KB Output is correct
12 Correct 13 ms 4344 KB Output is correct
13 Correct 14 ms 4216 KB Output is correct
14 Correct 13 ms 4344 KB Output is correct
15 Correct 13 ms 4344 KB Output is correct
16 Correct 14 ms 4344 KB Output is correct
17 Correct 13 ms 4344 KB Output is correct
18 Correct 13 ms 4344 KB Output is correct
19 Correct 13 ms 4344 KB Output is correct
20 Correct 13 ms 4344 KB Output is correct
21 Correct 13 ms 4220 KB Output is correct
22 Correct 14 ms 4216 KB Output is correct
23 Correct 13 ms 4216 KB Output is correct
24 Correct 15 ms 4216 KB Output is correct
25 Correct 13 ms 4216 KB Output is correct
26 Correct 14 ms 4216 KB Output is correct
27 Correct 14 ms 4216 KB Output is correct
28 Correct 14 ms 4216 KB Output is correct
29 Correct 14 ms 4216 KB Output is correct
30 Correct 13 ms 4320 KB Output is correct
31 Correct 15 ms 4216 KB Output is correct
32 Correct 16 ms 4216 KB Output is correct
33 Correct 14 ms 4324 KB Output is correct
34 Correct 15 ms 4216 KB Output is correct
35 Correct 15 ms 4344 KB Output is correct
36 Correct 14 ms 4344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 4344 KB Output is correct
2 Correct 13 ms 4216 KB Output is correct
3 Correct 14 ms 4260 KB Output is correct
4 Correct 13 ms 4352 KB Output is correct
5 Correct 13 ms 4216 KB Output is correct
6 Correct 13 ms 4216 KB Output is correct
7 Correct 14 ms 4344 KB Output is correct
8 Correct 13 ms 4216 KB Output is correct
9 Correct 14 ms 4216 KB Output is correct
10 Correct 14 ms 4344 KB Output is correct
11 Correct 14 ms 4344 KB Output is correct
12 Correct 13 ms 4216 KB Output is correct
13 Correct 14 ms 4220 KB Output is correct
14 Correct 14 ms 4344 KB Output is correct
15 Correct 14 ms 4344 KB Output is correct
16 Correct 14 ms 4216 KB Output is correct
17 Correct 15 ms 4344 KB Output is correct
18 Correct 15 ms 4344 KB Output is correct
19 Correct 15 ms 4344 KB Output is correct
20 Correct 13 ms 4344 KB Output is correct
21 Correct 15 ms 4216 KB Output is correct
22 Correct 15 ms 4344 KB Output is correct
23 Correct 14 ms 4344 KB Output is correct
24 Correct 15 ms 4216 KB Output is correct
25 Correct 15 ms 4216 KB Output is correct
26 Correct 18 ms 4216 KB Output is correct
27 Correct 27 ms 4216 KB Output is correct
28 Correct 42 ms 4216 KB Output is correct
29 Correct 41 ms 4216 KB Output is correct
30 Correct 14 ms 4216 KB Output is correct
31 Correct 28 ms 4344 KB Output is correct
32 Correct 35 ms 4316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 4220 KB Output is correct
2 Correct 14 ms 4344 KB Output is correct
3 Correct 13 ms 4324 KB Output is correct
4 Correct 13 ms 4216 KB Output is correct
5 Correct 13 ms 4216 KB Output is correct
6 Correct 13 ms 4216 KB Output is correct
7 Correct 14 ms 4216 KB Output is correct
8 Correct 14 ms 4216 KB Output is correct
9 Correct 14 ms 4200 KB Output is correct
10 Correct 13 ms 4216 KB Output is correct
11 Correct 13 ms 4344 KB Output is correct
12 Correct 13 ms 4320 KB Output is correct
13 Correct 15 ms 4344 KB Output is correct
14 Correct 15 ms 4344 KB Output is correct
15 Correct 14 ms 4344 KB Output is correct
16 Correct 14 ms 4216 KB Output is correct
17 Correct 13 ms 4216 KB Output is correct
18 Correct 14 ms 4344 KB Output is correct
19 Correct 13 ms 4216 KB Output is correct
20 Correct 14 ms 4344 KB Output is correct
21 Correct 13 ms 4344 KB Output is correct
22 Correct 14 ms 4212 KB Output is correct
23 Correct 14 ms 4344 KB Output is correct
24 Correct 13 ms 4216 KB Output is correct
25 Correct 13 ms 4216 KB Output is correct
26 Correct 14 ms 4216 KB Output is correct
27 Correct 13 ms 4264 KB Output is correct
28 Incorrect 13 ms 4216 KB Output isn't correct
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 4216 KB Output is correct
2 Correct 14 ms 4220 KB Output is correct
3 Correct 13 ms 4216 KB Output is correct
4 Correct 13 ms 4216 KB Output is correct
5 Correct 13 ms 4204 KB Output is correct
6 Correct 13 ms 4216 KB Output is correct
7 Correct 14 ms 4216 KB Output is correct
8 Correct 13 ms 4216 KB Output is correct
9 Correct 14 ms 4216 KB Output is correct
10 Correct 14 ms 4216 KB Output is correct
11 Correct 14 ms 4344 KB Output is correct
12 Correct 14 ms 4220 KB Output is correct
13 Correct 14 ms 4216 KB Output is correct
14 Correct 14 ms 4216 KB Output is correct
15 Incorrect 13 ms 4216 KB Output isn't correct
16 Halted 0 ms 0 KB -