Submission #43249

# Submission time Handle Problem Language Result Execution time Memory
43249 2018-03-11T15:35:28 Z dqhungdl Bali Sculptures (APIO15_sculpture) C++14
71 / 100
71 ms 19240 KB
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ll long long
#define ii pair<int,int>
using namespace std;

const int N = 2e3 + 100;
int n,l,r;
int a[N];
int t = 0;
ll s = 1;
int f[2100][2100];
int q[N];

bool kt(int vt,int sl){
    if(vt == n+1) return (l <= sl) && (sl <= r);
    if(sl > r) return 0;
    if(f[vt][sl]) return 0;
    if(n > 100 && q[vt] <= sl) return 0;
    f[vt][sl] = 1;
    ll x = 0;
    int ma = 0;
    for(int i = vt; i <= n; ++i){
        x += a[i];
        if((x | s) == s)
            ma = kt(i+1,sl+1);
        if(ma) return 1;
    }
    q[vt] = sl;
    return 0;
}

main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    //freopen(".inp","r",stdin);
    //freopen(".out","w",stdout);
    cin >> n >> l >> r;
    for(int i = 1; i <= n; ++i)
        cin >> a[i],q[i] = n+1;
    s = (1LL << 41) - 1;
    t = 40;
    while(t >= 0){
        memset(f,0,sizeof(f));
        s -= (1LL << t);
        if(!kt(1,0))
            s += (1LL << t);
        --t;
    }
    cout << s;
}

Compilation message

sculpture.cpp:35:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Correct 58 ms 17528 KB Output is correct
2 Correct 62 ms 17636 KB Output is correct
3 Correct 63 ms 17744 KB Output is correct
4 Correct 61 ms 17884 KB Output is correct
5 Correct 68 ms 17884 KB Output is correct
6 Correct 58 ms 17884 KB Output is correct
7 Correct 59 ms 17884 KB Output is correct
8 Correct 59 ms 17884 KB Output is correct
9 Correct 52 ms 18036 KB Output is correct
10 Correct 57 ms 18056 KB Output is correct
11 Correct 54 ms 18056 KB Output is correct
12 Correct 53 ms 18056 KB Output is correct
13 Correct 59 ms 18056 KB Output is correct
14 Correct 57 ms 18056 KB Output is correct
15 Correct 56 ms 18056 KB Output is correct
16 Correct 56 ms 18060 KB Output is correct
17 Correct 56 ms 18060 KB Output is correct
18 Correct 55 ms 18060 KB Output is correct
19 Correct 60 ms 18060 KB Output is correct
20 Correct 51 ms 18072 KB Output is correct
21 Correct 53 ms 18076 KB Output is correct
22 Correct 57 ms 18076 KB Output is correct
23 Correct 53 ms 18076 KB Output is correct
24 Correct 61 ms 18076 KB Output is correct
25 Correct 58 ms 18088 KB Output is correct
26 Correct 59 ms 18100 KB Output is correct
27 Correct 67 ms 18104 KB Output is correct
28 Correct 54 ms 18108 KB Output is correct
29 Correct 60 ms 18108 KB Output is correct
30 Correct 56 ms 18108 KB Output is correct
31 Correct 62 ms 18120 KB Output is correct
32 Correct 57 ms 18120 KB Output is correct
33 Correct 59 ms 18120 KB Output is correct
34 Correct 56 ms 18120 KB Output is correct
35 Correct 53 ms 18120 KB Output is correct
36 Correct 57 ms 18140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 18140 KB Output is correct
2 Correct 51 ms 18140 KB Output is correct
3 Correct 57 ms 18144 KB Output is correct
4 Correct 55 ms 18144 KB Output is correct
5 Correct 53 ms 18160 KB Output is correct
6 Correct 52 ms 18164 KB Output is correct
7 Correct 52 ms 18164 KB Output is correct
8 Correct 58 ms 18172 KB Output is correct
9 Correct 52 ms 18172 KB Output is correct
10 Correct 53 ms 18172 KB Output is correct
11 Correct 55 ms 18172 KB Output is correct
12 Correct 58 ms 18180 KB Output is correct
13 Correct 55 ms 18180 KB Output is correct
14 Correct 57 ms 18184 KB Output is correct
15 Correct 67 ms 18200 KB Output is correct
16 Correct 56 ms 18204 KB Output is correct
17 Correct 55 ms 18204 KB Output is correct
18 Correct 56 ms 18204 KB Output is correct
19 Correct 53 ms 18204 KB Output is correct
20 Correct 62 ms 18220 KB Output is correct
21 Correct 53 ms 18220 KB Output is correct
22 Correct 56 ms 18220 KB Output is correct
23 Correct 56 ms 18220 KB Output is correct
24 Correct 59 ms 18220 KB Output is correct
25 Correct 66 ms 18240 KB Output is correct
26 Correct 59 ms 18248 KB Output is correct
27 Correct 56 ms 18248 KB Output is correct
28 Correct 60 ms 18248 KB Output is correct
29 Correct 63 ms 18260 KB Output is correct
30 Correct 57 ms 18260 KB Output is correct
31 Correct 62 ms 18268 KB Output is correct
32 Correct 60 ms 18268 KB Output is correct
33 Correct 66 ms 18276 KB Output is correct
34 Correct 56 ms 18276 KB Output is correct
35 Correct 62 ms 18276 KB Output is correct
36 Correct 63 ms 18288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 18292 KB Output is correct
2 Correct 59 ms 18296 KB Output is correct
3 Correct 55 ms 18296 KB Output is correct
4 Correct 62 ms 18300 KB Output is correct
5 Correct 63 ms 18308 KB Output is correct
6 Correct 56 ms 18312 KB Output is correct
7 Correct 68 ms 18312 KB Output is correct
8 Correct 59 ms 18320 KB Output is correct
9 Correct 62 ms 18324 KB Output is correct
10 Correct 65 ms 18324 KB Output is correct
11 Correct 56 ms 18324 KB Output is correct
12 Correct 66 ms 18336 KB Output is correct
13 Correct 59 ms 18340 KB Output is correct
14 Correct 57 ms 18344 KB Output is correct
15 Correct 57 ms 18344 KB Output is correct
16 Correct 54 ms 18344 KB Output is correct
17 Correct 65 ms 18344 KB Output is correct
18 Correct 57 ms 18360 KB Output is correct
19 Correct 61 ms 18360 KB Output is correct
20 Correct 58 ms 18360 KB Output is correct
21 Correct 64 ms 18372 KB Output is correct
22 Correct 60 ms 18372 KB Output is correct
23 Correct 52 ms 18384 KB Output is correct
24 Correct 56 ms 18384 KB Output is correct
25 Correct 60 ms 18392 KB Output is correct
26 Correct 62 ms 18392 KB Output is correct
27 Correct 61 ms 18392 KB Output is correct
28 Correct 57 ms 18392 KB Output is correct
29 Correct 61 ms 18536 KB Output is correct
30 Correct 62 ms 18536 KB Output is correct
31 Correct 60 ms 18536 KB Output is correct
32 Correct 61 ms 18536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 18536 KB Output is correct
2 Correct 55 ms 18536 KB Output is correct
3 Correct 69 ms 18536 KB Output is correct
4 Correct 57 ms 18536 KB Output is correct
5 Correct 60 ms 18536 KB Output is correct
6 Correct 58 ms 18536 KB Output is correct
7 Correct 55 ms 18536 KB Output is correct
8 Correct 56 ms 18536 KB Output is correct
9 Correct 56 ms 18536 KB Output is correct
10 Correct 54 ms 18536 KB Output is correct
11 Correct 58 ms 18536 KB Output is correct
12 Correct 56 ms 18536 KB Output is correct
13 Correct 61 ms 18536 KB Output is correct
14 Correct 58 ms 18536 KB Output is correct
15 Correct 56 ms 18536 KB Output is correct
16 Correct 56 ms 18536 KB Output is correct
17 Correct 59 ms 18536 KB Output is correct
18 Correct 56 ms 18536 KB Output is correct
19 Correct 54 ms 18536 KB Output is correct
20 Correct 58 ms 18536 KB Output is correct
21 Correct 55 ms 18544 KB Output is correct
22 Correct 55 ms 18548 KB Output is correct
23 Correct 60 ms 18592 KB Output is correct
24 Correct 56 ms 18592 KB Output is correct
25 Correct 58 ms 18592 KB Output is correct
26 Correct 53 ms 18596 KB Output is correct
27 Correct 63 ms 18596 KB Output is correct
28 Correct 56 ms 18636 KB Output is correct
29 Correct 56 ms 18636 KB Output is correct
30 Correct 62 ms 18644 KB Output is correct
31 Correct 60 ms 18756 KB Output is correct
32 Correct 56 ms 18756 KB Output is correct
33 Correct 55 ms 18756 KB Output is correct
34 Correct 57 ms 18756 KB Output is correct
35 Correct 55 ms 18756 KB Output is correct
36 Correct 52 ms 18756 KB Output is correct
37 Correct 52 ms 18756 KB Output is correct
38 Correct 58 ms 18756 KB Output is correct
39 Correct 71 ms 18756 KB Output is correct
40 Correct 59 ms 18756 KB Output is correct
41 Correct 54 ms 18756 KB Output is correct
42 Correct 58 ms 18756 KB Output is correct
43 Correct 57 ms 18756 KB Output is correct
44 Correct 55 ms 18772 KB Output is correct
45 Correct 59 ms 18772 KB Output is correct
46 Correct 52 ms 18772 KB Output is correct
47 Correct 58 ms 18772 KB Output is correct
48 Correct 62 ms 18772 KB Output is correct
49 Correct 57 ms 18772 KB Output is correct
50 Correct 55 ms 18772 KB Output is correct
51 Correct 61 ms 18772 KB Output is correct
52 Correct 59 ms 18772 KB Output is correct
53 Correct 60 ms 18772 KB Output is correct
54 Correct 55 ms 18776 KB Output is correct
55 Correct 62 ms 18796 KB Output is correct
56 Correct 61 ms 18796 KB Output is correct
57 Correct 65 ms 18796 KB Output is correct
58 Correct 55 ms 18796 KB Output is correct
59 Correct 56 ms 18796 KB Output is correct
60 Correct 59 ms 18804 KB Output is correct
61 Correct 56 ms 18804 KB Output is correct
62 Correct 61 ms 18812 KB Output is correct
63 Correct 57 ms 18812 KB Output is correct
64 Correct 54 ms 18812 KB Output is correct
65 Correct 63 ms 18824 KB Output is correct
66 Correct 52 ms 18824 KB Output is correct
67 Correct 61 ms 18824 KB Output is correct
68 Correct 58 ms 18824 KB Output is correct
69 Correct 63 ms 18840 KB Output is correct
70 Correct 56 ms 18840 KB Output is correct
71 Correct 56 ms 18840 KB Output is correct
72 Correct 61 ms 18848 KB Output is correct
73 Correct 68 ms 18856 KB Output is correct
74 Correct 67 ms 18996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 18996 KB Output is correct
2 Correct 61 ms 18996 KB Output is correct
3 Correct 59 ms 18996 KB Output is correct
4 Correct 60 ms 18996 KB Output is correct
5 Correct 57 ms 18996 KB Output is correct
6 Correct 68 ms 18996 KB Output is correct
7 Correct 71 ms 18996 KB Output is correct
8 Correct 58 ms 18996 KB Output is correct
9 Correct 59 ms 18996 KB Output is correct
10 Correct 55 ms 18996 KB Output is correct
11 Correct 58 ms 18996 KB Output is correct
12 Correct 62 ms 18996 KB Output is correct
13 Correct 58 ms 18996 KB Output is correct
14 Correct 61 ms 18996 KB Output is correct
15 Correct 60 ms 18996 KB Output is correct
16 Correct 60 ms 18996 KB Output is correct
17 Correct 53 ms 18996 KB Output is correct
18 Correct 52 ms 18996 KB Output is correct
19 Correct 60 ms 19068 KB Output is correct
20 Correct 66 ms 19068 KB Output is correct
21 Correct 56 ms 19068 KB Output is correct
22 Correct 64 ms 19068 KB Output is correct
23 Correct 65 ms 19068 KB Output is correct
24 Correct 62 ms 19068 KB Output is correct
25 Correct 61 ms 19068 KB Output is correct
26 Correct 55 ms 19068 KB Output is correct
27 Correct 63 ms 19068 KB Output is correct
28 Correct 57 ms 19068 KB Output is correct
29 Correct 56 ms 19068 KB Output is correct
30 Correct 59 ms 19068 KB Output is correct
31 Correct 63 ms 19068 KB Output is correct
32 Correct 63 ms 19068 KB Output is correct
33 Correct 52 ms 19068 KB Output is correct
34 Correct 60 ms 19068 KB Output is correct
35 Correct 63 ms 19068 KB Output is correct
36 Correct 55 ms 19068 KB Output is correct
37 Correct 53 ms 19068 KB Output is correct
38 Correct 52 ms 19068 KB Output is correct
39 Correct 52 ms 19068 KB Output is correct
40 Correct 57 ms 19068 KB Output is correct
41 Correct 54 ms 19068 KB Output is correct
42 Correct 60 ms 19072 KB Output is correct
43 Correct 63 ms 19084 KB Output is correct
44 Correct 55 ms 19084 KB Output is correct
45 Correct 59 ms 19096 KB Output is correct
46 Correct 59 ms 19096 KB Output is correct
47 Correct 64 ms 19096 KB Output is correct
48 Correct 56 ms 19096 KB Output is correct
49 Correct 57 ms 19100 KB Output is correct
50 Correct 56 ms 19100 KB Output is correct
51 Incorrect 60 ms 19240 KB Output isn't correct
52 Halted 0 ms 0 KB -