답안 #107102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
107102 2019-04-22T01:31:26 Z tduong0806 Bali Sculptures (APIO15_sculpture) C++14
71 / 100
54 ms 988 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;
ll f[N][N],F[N],a[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,0)
        {
            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,0)
    {
        ll tg=onbit(S,i);
        forinc(i,1,n)
        {
            F[i]=1e4;
            forinc(j,0,i-1) if(!(tg&(s[i]-s[j]))) F[i]=min(F[i],F[j]+1);
        }
        if(F[n]<1e4) S=tg;
        else kq=onbit(kq,i);
    }
    return cout<<kq,0;
}
# 결과 실행 시간 메모리 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 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 512 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 5 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 512 KB Output is correct
22 Correct 2 ms 512 KB Output is correct
23 Correct 2 ms 512 KB Output is correct
24 Correct 2 ms 512 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 512 KB Output is correct
30 Correct 2 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 2 ms 384 KB Output is correct
34 Correct 3 ms 512 KB Output is correct
35 Correct 3 ms 512 KB Output is correct
36 Correct 2 ms 384 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 3 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 3 ms 512 KB Output is correct
10 Correct 2 ms 512 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 316 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 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 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 384 KB Output is correct
29 Correct 2 ms 512 KB Output is correct
30 Correct 4 ms 512 KB Output is correct
31 Correct 5 ms 640 KB Output is correct
32 Correct 5 ms 640 KB Output is correct
33 Correct 2 ms 512 KB Output is correct
34 Correct 5 ms 560 KB Output is correct
35 Correct 4 ms 512 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 3 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 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 512 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 3 ms 512 KB Output is correct
16 Correct 2 ms 640 KB Output is correct
17 Correct 4 ms 512 KB Output is correct
18 Correct 4 ms 512 KB Output is correct
19 Correct 6 ms 512 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 6 ms 512 KB Output is correct
22 Correct 4 ms 512 KB Output is correct
23 Correct 3 ms 512 KB Output is correct
24 Correct 6 ms 512 KB Output is correct
25 Correct 4 ms 640 KB Output is correct
26 Correct 7 ms 640 KB Output is correct
27 Correct 19 ms 768 KB Output is correct
28 Correct 41 ms 896 KB Output is correct
29 Correct 37 ms 768 KB Output is correct
30 Correct 3 ms 768 KB Output is correct
31 Correct 20 ms 768 KB Output is correct
32 Correct 28 ms 860 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 3 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 2 ms 512 KB Output is correct
10 Correct 2 ms 512 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 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 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 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 2 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 512 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 3 ms 384 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 4 ms 512 KB Output is correct
42 Correct 4 ms 512 KB Output is correct
43 Correct 2 ms 512 KB Output is correct
44 Correct 5 ms 640 KB Output is correct
45 Correct 4 ms 640 KB Output is correct
46 Correct 4 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 7 ms 640 KB Output is correct
50 Correct 18 ms 768 KB Output is correct
51 Correct 35 ms 768 KB Output is correct
52 Correct 35 ms 896 KB Output is correct
53 Correct 3 ms 768 KB Output is correct
54 Correct 17 ms 768 KB Output is correct
55 Correct 26 ms 768 KB Output is correct
56 Correct 4 ms 640 KB Output is correct
57 Correct 8 ms 640 KB Output is correct
58 Correct 16 ms 768 KB Output is correct
59 Correct 33 ms 768 KB Output is correct
60 Correct 31 ms 768 KB Output is correct
61 Correct 3 ms 768 KB Output is correct
62 Correct 42 ms 888 KB Output is correct
63 Correct 38 ms 768 KB Output is correct
64 Correct 27 ms 896 KB Output is correct
65 Correct 4 ms 512 KB Output is correct
66 Correct 4 ms 640 KB Output is correct
67 Correct 8 ms 640 KB Output is correct
68 Correct 18 ms 768 KB Output is correct
69 Correct 35 ms 768 KB Output is correct
70 Correct 35 ms 888 KB Output is correct
71 Correct 3 ms 768 KB Output is correct
72 Correct 46 ms 896 KB Output is correct
73 Correct 29 ms 888 KB Output is correct
74 Correct 26 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 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 3 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 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 2 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 2 ms 384 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 3 ms 512 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 3 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 4 ms 384 KB Output is correct
26 Correct 3 ms 512 KB Output is correct
27 Correct 4 ms 512 KB Output is correct
28 Correct 5 ms 640 KB Output is correct
29 Correct 6 ms 640 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 4 ms 640 KB Output is correct
32 Correct 4 ms 640 KB Output is correct
33 Correct 4 ms 640 KB Output is correct
34 Correct 6 ms 640 KB Output is correct
35 Correct 3 ms 640 KB Output is correct
36 Correct 8 ms 640 KB Output is correct
37 Correct 32 ms 768 KB Output is correct
38 Correct 40 ms 768 KB Output is correct
39 Correct 47 ms 988 KB Output is correct
40 Correct 3 ms 768 KB Output is correct
41 Correct 20 ms 768 KB Output is correct
42 Correct 32 ms 768 KB Output is correct
43 Correct 5 ms 512 KB Output is correct
44 Correct 10 ms 640 KB Output is correct
45 Correct 16 ms 768 KB Output is correct
46 Correct 54 ms 888 KB Output is correct
47 Correct 31 ms 896 KB Output is correct
48 Correct 3 ms 768 KB Output is correct
49 Correct 43 ms 900 KB Output is correct
50 Correct 36 ms 896 KB Output is correct
51 Incorrect 2 ms 384 KB Output isn't correct
52 Halted 0 ms 0 KB -