답안 #146462

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
146462 2019-08-24T08:14:30 Z LittleFlowers__ Bali Sculptures (APIO15_sculpture) C++14
100 / 100
607 ms 1016 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 "SCULPTURE"
#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)))
 
long long ret;
int n,a,b;
int y[2010];
//int f[2010][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<2005> f[n+5];
        f[1][1]=1;
        forinc(j,1,n){
            long long cur=0;
            forinc(t,j,n){
                cur+=y[t];
                if((cur>>(i+1)|ret)==ret && !bit(cur,i))
                    //forinc(k,1,b) if(f[j][k]) f[t+1][k+1]=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:27:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 2 ms 244 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 404 KB Output is correct
23 Correct 3 ms 256 KB Output is correct
24 Correct 3 ms 256 KB Output is correct
25 Correct 3 ms 368 KB Output is correct
26 Correct 3 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 3 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 256 KB Output is correct
36 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 380 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 2 ms 252 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 380 KB Output is correct
26 Correct 3 ms 256 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
29 Correct 4 ms 376 KB Output is correct
30 Correct 4 ms 376 KB Output is correct
31 Correct 5 ms 504 KB Output is correct
32 Correct 5 ms 376 KB Output is correct
33 Correct 6 ms 376 KB Output is correct
34 Correct 5 ms 376 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 3 ms 380 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 252 KB Output is correct
16 Correct 4 ms 376 KB Output is correct
17 Correct 4 ms 380 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 7 ms 376 KB Output is correct
26 Correct 10 ms 376 KB Output is correct
27 Correct 15 ms 424 KB Output is correct
28 Correct 14 ms 376 KB Output is correct
29 Correct 14 ms 376 KB Output is correct
30 Correct 15 ms 376 KB Output is correct
31 Correct 14 ms 376 KB Output is correct
32 Correct 14 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 380 KB Output is correct
13 Correct 3 ms 252 KB Output is correct
14 Correct 2 ms 252 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 380 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 256 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 3 ms 256 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 3 ms 376 KB Output is correct
37 Correct 3 ms 256 KB Output is correct
38 Correct 3 ms 376 KB Output is correct
39 Correct 4 ms 376 KB Output is correct
40 Correct 5 ms 376 KB Output is correct
41 Correct 5 ms 376 KB Output is correct
42 Correct 6 ms 376 KB Output is correct
43 Correct 6 ms 376 KB Output is correct
44 Correct 5 ms 376 KB Output is correct
45 Correct 5 ms 376 KB Output is correct
46 Correct 5 ms 376 KB Output is correct
47 Correct 5 ms 376 KB Output is correct
48 Correct 7 ms 376 KB Output is correct
49 Correct 9 ms 376 KB Output is correct
50 Correct 12 ms 376 KB Output is correct
51 Correct 14 ms 472 KB Output is correct
52 Correct 14 ms 376 KB Output is correct
53 Correct 15 ms 376 KB Output is correct
54 Correct 14 ms 504 KB Output is correct
55 Correct 14 ms 376 KB Output is correct
56 Correct 3 ms 376 KB Output is correct
57 Correct 4 ms 376 KB Output is correct
58 Correct 5 ms 376 KB Output is correct
59 Correct 5 ms 376 KB Output is correct
60 Correct 5 ms 368 KB Output is correct
61 Correct 6 ms 504 KB Output is correct
62 Correct 6 ms 376 KB Output is correct
63 Correct 7 ms 296 KB Output is correct
64 Correct 13 ms 296 KB Output is correct
65 Correct 4 ms 376 KB Output is correct
66 Correct 4 ms 376 KB Output is correct
67 Correct 4 ms 376 KB Output is correct
68 Correct 5 ms 376 KB Output is correct
69 Correct 5 ms 376 KB Output is correct
70 Correct 5 ms 376 KB Output is correct
71 Correct 5 ms 376 KB Output is correct
72 Correct 7 ms 376 KB Output is correct
73 Correct 6 ms 388 KB Output is correct
74 Correct 7 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 252 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 3 ms 256 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 256 KB Output is correct
26 Correct 4 ms 252 KB Output is correct
27 Correct 4 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
29 Correct 5 ms 376 KB Output is correct
30 Correct 6 ms 376 KB Output is correct
31 Correct 5 ms 380 KB Output is correct
32 Correct 5 ms 308 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 5 ms 380 KB Output is correct
35 Correct 7 ms 376 KB Output is correct
36 Correct 9 ms 376 KB Output is correct
37 Correct 12 ms 376 KB Output is correct
38 Correct 14 ms 396 KB Output is correct
39 Correct 13 ms 504 KB Output is correct
40 Correct 14 ms 368 KB Output is correct
41 Correct 14 ms 376 KB Output is correct
42 Correct 14 ms 504 KB Output is correct
43 Correct 3 ms 376 KB Output is correct
44 Correct 4 ms 380 KB Output is correct
45 Correct 5 ms 296 KB Output is correct
46 Correct 5 ms 376 KB Output is correct
47 Correct 5 ms 376 KB Output is correct
48 Correct 5 ms 376 KB Output is correct
49 Correct 7 ms 504 KB Output is correct
50 Correct 7 ms 376 KB Output is correct
51 Correct 6 ms 376 KB Output is correct
52 Correct 69 ms 504 KB Output is correct
53 Correct 105 ms 504 KB Output is correct
54 Correct 185 ms 632 KB Output is correct
55 Correct 177 ms 636 KB Output is correct
56 Correct 515 ms 988 KB Output is correct
57 Correct 503 ms 1016 KB Output is correct
58 Correct 368 ms 1016 KB Output is correct
59 Correct 367 ms 1016 KB Output is correct
60 Correct 607 ms 888 KB Output is correct
61 Correct 7 ms 376 KB Output is correct
62 Correct 101 ms 504 KB Output is correct
63 Correct 185 ms 760 KB Output is correct
64 Correct 157 ms 732 KB Output is correct
65 Correct 263 ms 764 KB Output is correct
66 Correct 366 ms 888 KB Output is correct
67 Correct 505 ms 1016 KB Output is correct
68 Correct 505 ms 924 KB Output is correct
69 Correct 442 ms 888 KB Output is correct