답안 #107105

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
107105 2019-04-22T01:40:18 Z tduong0806 Bali Sculptures (APIO15_sculpture) C++14
71 / 100
63 ms 1024 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define forinc(i,a,b) for(int i=a;i<=b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define forv(a,b) for(auto &a:b)
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define reset(f,x) memset(f,x,sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define onbit(x,i) (x|(1ll<<(i-1)))
#define offbit(x,i) (x&~(1<<(i-1)))
#define read2(a,b) read(a),read(b)
#define read3(a,b,c) read(a),read(b),read(c)
const int N=2010;
int n,A,B,F[N],a[N];
ll f[N][N],s[N],kq;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("SCULPTURE.inp","r",stdin);
    //freopen("SCULPTURE.out","w",stdout);
    cin>>n>>A>>B;
    forinc(i,1,n) cin>>a[i],s[i]=s[i-1]+a[i];
    if(n<=100)
    {
        ll S=0;
        f[0][0]=1;
        fordec(i,41,1)
        {
            ll tg=onbit(S,i);
            forinc(i,1,n) forinc(j,1,B)
            {
                f[i][j]=0;
                forinc(t,0,i-1) if(!(tg&(s[i]-s[t]))&&f[t][j-1]) f[i][j]=1;
            }
            bool ok=0;
            forinc(i,A,B) if(f[n][i]) ok=1;
            if(ok) S=tg;
            else kq=onbit(kq,i);
        }
        return cout<<kq,0;
    }
    ll S=0;
    F[0]=0;
    fordec(i,41,1)
    {
        ll tg=onbit(S,i);
        forinc(i,1,n)
        {
            F[i]=1e6;
            forinc(j,0,i-1) if(!(tg&(s[i]-s[j]))) F[i]=min(F[i],F[j]+1);
        }
        if(F[n]<1e6) S=tg;
        else kq=onbit(kq,i);
    }
    return cout<<kq,0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 412 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 3 ms 512 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 512 KB Output is correct
33 Correct 3 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 512 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 512 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 4 ms 512 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 3 ms 512 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 3 ms 512 KB Output is correct
29 Correct 3 ms 512 KB Output is correct
30 Correct 4 ms 512 KB Output is correct
31 Correct 4 ms 512 KB Output is correct
32 Correct 4 ms 640 KB Output is correct
33 Correct 3 ms 512 KB Output is correct
34 Correct 4 ms 512 KB Output is correct
35 Correct 4 ms 640 KB Output is correct
36 Correct 3 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 3 ms 512 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 512 KB Output is correct
17 Correct 4 ms 512 KB Output is correct
18 Correct 5 ms 512 KB Output is correct
19 Correct 6 ms 512 KB Output is correct
20 Correct 3 ms 512 KB Output is correct
21 Correct 5 ms 512 KB Output is correct
22 Correct 5 ms 512 KB Output is correct
23 Correct 4 ms 640 KB Output is correct
24 Correct 6 ms 512 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 9 ms 640 KB Output is correct
27 Correct 19 ms 768 KB Output is correct
28 Correct 40 ms 896 KB Output is correct
29 Correct 39 ms 768 KB Output is correct
30 Correct 3 ms 768 KB Output is correct
31 Correct 19 ms 768 KB Output is correct
32 Correct 30 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 512 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 512 KB Output is correct
24 Correct 3 ms 588 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 512 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 3 ms 384 KB Output is correct
36 Correct 4 ms 384 KB Output is correct
37 Correct 3 ms 512 KB Output is correct
38 Correct 3 ms 512 KB Output is correct
39 Correct 2 ms 512 KB Output is correct
40 Correct 4 ms 512 KB Output is correct
41 Correct 5 ms 640 KB Output is correct
42 Correct 5 ms 512 KB Output is correct
43 Correct 2 ms 512 KB Output is correct
44 Correct 4 ms 512 KB Output is correct
45 Correct 5 ms 512 KB Output is correct
46 Correct 5 ms 512 KB Output is correct
47 Correct 4 ms 640 KB Output is correct
48 Correct 4 ms 640 KB Output is correct
49 Correct 10 ms 640 KB Output is correct
50 Correct 24 ms 768 KB Output is correct
51 Correct 48 ms 888 KB Output is correct
52 Correct 54 ms 1024 KB Output is correct
53 Correct 3 ms 768 KB Output is correct
54 Correct 20 ms 768 KB Output is correct
55 Correct 33 ms 888 KB Output is correct
56 Correct 4 ms 640 KB Output is correct
57 Correct 8 ms 640 KB Output is correct
58 Correct 18 ms 768 KB Output is correct
59 Correct 39 ms 896 KB Output is correct
60 Correct 38 ms 872 KB Output is correct
61 Correct 2 ms 800 KB Output is correct
62 Correct 40 ms 900 KB Output is correct
63 Correct 36 ms 888 KB Output is correct
64 Correct 29 ms 768 KB Output is correct
65 Correct 4 ms 512 KB Output is correct
66 Correct 4 ms 640 KB Output is correct
67 Correct 7 ms 640 KB Output is correct
68 Correct 18 ms 740 KB Output is correct
69 Correct 33 ms 768 KB Output is correct
70 Correct 23 ms 868 KB Output is correct
71 Correct 4 ms 768 KB Output is correct
72 Correct 50 ms 868 KB Output is correct
73 Correct 35 ms 768 KB Output is correct
74 Correct 25 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 512 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 512 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 3 ms 428 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 3 ms 512 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 512 KB Output is correct
27 Correct 4 ms 512 KB Output is correct
28 Correct 4 ms 512 KB Output is correct
29 Correct 5 ms 512 KB Output is correct
30 Correct 2 ms 512 KB Output is correct
31 Correct 6 ms 640 KB Output is correct
32 Correct 4 ms 512 KB Output is correct
33 Correct 3 ms 512 KB Output is correct
34 Correct 4 ms 512 KB Output is correct
35 Correct 3 ms 640 KB Output is correct
36 Correct 7 ms 640 KB Output is correct
37 Correct 26 ms 768 KB Output is correct
38 Correct 54 ms 768 KB Output is correct
39 Correct 38 ms 768 KB Output is correct
40 Correct 3 ms 768 KB Output is correct
41 Correct 20 ms 824 KB Output is correct
42 Correct 29 ms 768 KB Output is correct
43 Correct 5 ms 640 KB Output is correct
44 Correct 8 ms 768 KB Output is correct
45 Correct 16 ms 768 KB Output is correct
46 Correct 38 ms 896 KB Output is correct
47 Correct 32 ms 900 KB Output is correct
48 Correct 4 ms 768 KB Output is correct
49 Correct 41 ms 900 KB Output is correct
50 Correct 63 ms 896 KB Output is correct
51 Incorrect 3 ms 384 KB Output isn't correct
52 Halted 0 ms 0 KB -