Submission #104251

# Submission time Handle Problem Language Result Execution time Memory
104251 2019-04-04T12:33:31 Z LittleFlowers__ Bali Sculptures (APIO15_sculpture) C++14
0 / 100
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr);
#define task "SCULPTURES"
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))

int ret;
int n,a,b;
int y[2010];

main()
{
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    n=in,a=in,b=in;
    forinc(i,1,n) y[i]=in;

    fordec(i,40,0)
    {
        bitset<2002> f[n+2];
        f[1]=1;
        forinc(j,1,n)
        {
            int cur=0;
            forinc(t,j,n)
            {
                cur+=y[t];
                if((cur>>(i+1)|ret)==ret && !bit(cur,i)&1)
                    f[t+1]|=f[j]<<1;
            }
        }
        ret<<=1;
        int ok=0;
        forinc(j,a,b) ok=ok||f[n+1][j+1];
        ret+=!ok;
    }
    cout<<ret;
}

Compilation message

sculpture.cpp:26:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Incorrect 3 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -