Submission #43251

# Submission time Handle Problem Language Result Execution time Memory
43251 2018-03-11T15:46:54 Z dqhungdl Bali Sculptures (APIO15_sculpture) C++14
100 / 100
299 ms 18500 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];
ll sum[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 = n; i >= vt; --i){
        x = sum[i] - sum[vt-1];
        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],sum[i] = sum[i-1] +  a[i];
    s = (1LL << 41) - 1;
    t = 40;
    while(t >= 0){
        memset(f,0,sizeof(f));
        for(int i = 1; i <= n; ++i)
            q[i] = n+1;
        s -= (1LL << t);
        if(!kt(1,0))
            s += (1LL << t);
        --t;
    }
    cout << s;
}

Compilation message

sculpture.cpp:36:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Correct 65 ms 17528 KB Output is correct
2 Correct 61 ms 17704 KB Output is correct
3 Correct 58 ms 17704 KB Output is correct
4 Correct 60 ms 17752 KB Output is correct
5 Correct 58 ms 17904 KB Output is correct
6 Correct 68 ms 17904 KB Output is correct
7 Correct 60 ms 17904 KB Output is correct
8 Correct 61 ms 17904 KB Output is correct
9 Correct 69 ms 17904 KB Output is correct
10 Correct 55 ms 17904 KB Output is correct
11 Correct 59 ms 17904 KB Output is correct
12 Correct 58 ms 17904 KB Output is correct
13 Correct 73 ms 17928 KB Output is correct
14 Correct 71 ms 17928 KB Output is correct
15 Correct 67 ms 17928 KB Output is correct
16 Correct 69 ms 17928 KB Output is correct
17 Correct 54 ms 17928 KB Output is correct
18 Correct 73 ms 17928 KB Output is correct
19 Correct 58 ms 17928 KB Output is correct
20 Correct 60 ms 17928 KB Output is correct
21 Correct 59 ms 17928 KB Output is correct
22 Correct 57 ms 17928 KB Output is correct
23 Correct 56 ms 17928 KB Output is correct
24 Correct 53 ms 17928 KB Output is correct
25 Correct 67 ms 17928 KB Output is correct
26 Correct 60 ms 17928 KB Output is correct
27 Correct 60 ms 17928 KB Output is correct
28 Correct 65 ms 17928 KB Output is correct
29 Correct 63 ms 17928 KB Output is correct
30 Correct 58 ms 17928 KB Output is correct
31 Correct 62 ms 17928 KB Output is correct
32 Correct 59 ms 17928 KB Output is correct
33 Correct 57 ms 17928 KB Output is correct
34 Correct 60 ms 17928 KB Output is correct
35 Correct 53 ms 17928 KB Output is correct
36 Correct 63 ms 17928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 17928 KB Output is correct
2 Correct 72 ms 17928 KB Output is correct
3 Correct 65 ms 17928 KB Output is correct
4 Correct 77 ms 17928 KB Output is correct
5 Correct 80 ms 17928 KB Output is correct
6 Correct 109 ms 18028 KB Output is correct
7 Correct 62 ms 18028 KB Output is correct
8 Correct 61 ms 18028 KB Output is correct
9 Correct 81 ms 18028 KB Output is correct
10 Correct 71 ms 18028 KB Output is correct
11 Correct 53 ms 18028 KB Output is correct
12 Correct 69 ms 18028 KB Output is correct
13 Correct 82 ms 18028 KB Output is correct
14 Correct 54 ms 18028 KB Output is correct
15 Correct 65 ms 18028 KB Output is correct
16 Correct 60 ms 18028 KB Output is correct
17 Correct 57 ms 18028 KB Output is correct
18 Correct 65 ms 18028 KB Output is correct
19 Correct 62 ms 18028 KB Output is correct
20 Correct 60 ms 18028 KB Output is correct
21 Correct 58 ms 18028 KB Output is correct
22 Correct 66 ms 18028 KB Output is correct
23 Correct 59 ms 18028 KB Output is correct
24 Correct 53 ms 18028 KB Output is correct
25 Correct 61 ms 18028 KB Output is correct
26 Correct 73 ms 18028 KB Output is correct
27 Correct 55 ms 18028 KB Output is correct
28 Correct 95 ms 18028 KB Output is correct
29 Correct 53 ms 18028 KB Output is correct
30 Correct 57 ms 18028 KB Output is correct
31 Correct 85 ms 18028 KB Output is correct
32 Correct 87 ms 18028 KB Output is correct
33 Correct 98 ms 18028 KB Output is correct
34 Correct 77 ms 18028 KB Output is correct
35 Correct 54 ms 18028 KB Output is correct
36 Correct 74 ms 18028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 18028 KB Output is correct
2 Correct 57 ms 18028 KB Output is correct
3 Correct 62 ms 18028 KB Output is correct
4 Correct 64 ms 18028 KB Output is correct
5 Correct 59 ms 18028 KB Output is correct
6 Correct 69 ms 18028 KB Output is correct
7 Correct 56 ms 18028 KB Output is correct
8 Correct 65 ms 18028 KB Output is correct
9 Correct 69 ms 18028 KB Output is correct
10 Correct 53 ms 18028 KB Output is correct
11 Correct 52 ms 18028 KB Output is correct
12 Correct 51 ms 18028 KB Output is correct
13 Correct 60 ms 18028 KB Output is correct
14 Correct 57 ms 18028 KB Output is correct
15 Correct 52 ms 18028 KB Output is correct
16 Correct 58 ms 18028 KB Output is correct
17 Correct 52 ms 18028 KB Output is correct
18 Correct 51 ms 18028 KB Output is correct
19 Correct 60 ms 18028 KB Output is correct
20 Correct 60 ms 18028 KB Output is correct
21 Correct 54 ms 18028 KB Output is correct
22 Correct 58 ms 18028 KB Output is correct
23 Correct 55 ms 18028 KB Output is correct
24 Correct 57 ms 18028 KB Output is correct
25 Correct 52 ms 18028 KB Output is correct
26 Correct 54 ms 18028 KB Output is correct
27 Correct 54 ms 18028 KB Output is correct
28 Correct 54 ms 18028 KB Output is correct
29 Correct 58 ms 18028 KB Output is correct
30 Correct 57 ms 18028 KB Output is correct
31 Correct 54 ms 18028 KB Output is correct
32 Correct 56 ms 18028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 18028 KB Output is correct
2 Correct 52 ms 18028 KB Output is correct
3 Correct 56 ms 18028 KB Output is correct
4 Correct 52 ms 18028 KB Output is correct
5 Correct 55 ms 18028 KB Output is correct
6 Correct 53 ms 18028 KB Output is correct
7 Correct 58 ms 18028 KB Output is correct
8 Correct 54 ms 18028 KB Output is correct
9 Correct 52 ms 18028 KB Output is correct
10 Correct 54 ms 18028 KB Output is correct
11 Correct 57 ms 18028 KB Output is correct
12 Correct 51 ms 18028 KB Output is correct
13 Correct 52 ms 18028 KB Output is correct
14 Correct 52 ms 18028 KB Output is correct
15 Correct 63 ms 18028 KB Output is correct
16 Correct 61 ms 18028 KB Output is correct
17 Correct 53 ms 18028 KB Output is correct
18 Correct 53 ms 18028 KB Output is correct
19 Correct 61 ms 18028 KB Output is correct
20 Correct 55 ms 18028 KB Output is correct
21 Correct 55 ms 18028 KB Output is correct
22 Correct 58 ms 18028 KB Output is correct
23 Correct 65 ms 18028 KB Output is correct
24 Correct 62 ms 18028 KB Output is correct
25 Correct 58 ms 18028 KB Output is correct
26 Correct 63 ms 18028 KB Output is correct
27 Correct 60 ms 18028 KB Output is correct
28 Correct 56 ms 18028 KB Output is correct
29 Correct 53 ms 18028 KB Output is correct
30 Correct 53 ms 18028 KB Output is correct
31 Correct 52 ms 18028 KB Output is correct
32 Correct 56 ms 18028 KB Output is correct
33 Correct 66 ms 18028 KB Output is correct
34 Correct 60 ms 18028 KB Output is correct
35 Correct 63 ms 18028 KB Output is correct
36 Correct 55 ms 18028 KB Output is correct
37 Correct 67 ms 18028 KB Output is correct
38 Correct 59 ms 18028 KB Output is correct
39 Correct 66 ms 18028 KB Output is correct
40 Correct 63 ms 18028 KB Output is correct
41 Correct 54 ms 18028 KB Output is correct
42 Correct 54 ms 18028 KB Output is correct
43 Correct 55 ms 18028 KB Output is correct
44 Correct 62 ms 18028 KB Output is correct
45 Correct 61 ms 18028 KB Output is correct
46 Correct 57 ms 18028 KB Output is correct
47 Correct 70 ms 18028 KB Output is correct
48 Correct 56 ms 18028 KB Output is correct
49 Correct 67 ms 18028 KB Output is correct
50 Correct 62 ms 18028 KB Output is correct
51 Correct 56 ms 18028 KB Output is correct
52 Correct 59 ms 18028 KB Output is correct
53 Correct 66 ms 18028 KB Output is correct
54 Correct 58 ms 18028 KB Output is correct
55 Correct 56 ms 18028 KB Output is correct
56 Correct 56 ms 18028 KB Output is correct
57 Correct 64 ms 18028 KB Output is correct
58 Correct 61 ms 18028 KB Output is correct
59 Correct 83 ms 18028 KB Output is correct
60 Correct 63 ms 18028 KB Output is correct
61 Correct 70 ms 18028 KB Output is correct
62 Correct 64 ms 18028 KB Output is correct
63 Correct 59 ms 18028 KB Output is correct
64 Correct 69 ms 18028 KB Output is correct
65 Correct 68 ms 18028 KB Output is correct
66 Correct 59 ms 18028 KB Output is correct
67 Correct 63 ms 18028 KB Output is correct
68 Correct 67 ms 18028 KB Output is correct
69 Correct 66 ms 18028 KB Output is correct
70 Correct 59 ms 18028 KB Output is correct
71 Correct 66 ms 18028 KB Output is correct
72 Correct 61 ms 18028 KB Output is correct
73 Correct 65 ms 18028 KB Output is correct
74 Correct 60 ms 18028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 18028 KB Output is correct
2 Correct 54 ms 18028 KB Output is correct
3 Correct 68 ms 18028 KB Output is correct
4 Correct 67 ms 18028 KB Output is correct
5 Correct 62 ms 18028 KB Output is correct
6 Correct 55 ms 18028 KB Output is correct
7 Correct 69 ms 18028 KB Output is correct
8 Correct 59 ms 18028 KB Output is correct
9 Correct 73 ms 18028 KB Output is correct
10 Correct 70 ms 18028 KB Output is correct
11 Correct 63 ms 18028 KB Output is correct
12 Correct 62 ms 18028 KB Output is correct
13 Correct 57 ms 18028 KB Output is correct
14 Correct 58 ms 18028 KB Output is correct
15 Correct 59 ms 18028 KB Output is correct
16 Correct 57 ms 18028 KB Output is correct
17 Correct 67 ms 18028 KB Output is correct
18 Correct 60 ms 18028 KB Output is correct
19 Correct 60 ms 18028 KB Output is correct
20 Correct 60 ms 18028 KB Output is correct
21 Correct 58 ms 18028 KB Output is correct
22 Correct 61 ms 18028 KB Output is correct
23 Correct 57 ms 18028 KB Output is correct
24 Correct 56 ms 18028 KB Output is correct
25 Correct 61 ms 18028 KB Output is correct
26 Correct 60 ms 18028 KB Output is correct
27 Correct 52 ms 18028 KB Output is correct
28 Correct 60 ms 18028 KB Output is correct
29 Correct 52 ms 18028 KB Output is correct
30 Correct 52 ms 18028 KB Output is correct
31 Correct 51 ms 18028 KB Output is correct
32 Correct 65 ms 18028 KB Output is correct
33 Correct 56 ms 18028 KB Output is correct
34 Correct 57 ms 18028 KB Output is correct
35 Correct 74 ms 18028 KB Output is correct
36 Correct 55 ms 18028 KB Output is correct
37 Correct 60 ms 18028 KB Output is correct
38 Correct 56 ms 18028 KB Output is correct
39 Correct 65 ms 18028 KB Output is correct
40 Correct 57 ms 18028 KB Output is correct
41 Correct 55 ms 18028 KB Output is correct
42 Correct 58 ms 18028 KB Output is correct
43 Correct 67 ms 18028 KB Output is correct
44 Correct 61 ms 18028 KB Output is correct
45 Correct 71 ms 18028 KB Output is correct
46 Correct 63 ms 18028 KB Output is correct
47 Correct 59 ms 18028 KB Output is correct
48 Correct 57 ms 18028 KB Output is correct
49 Correct 65 ms 18028 KB Output is correct
50 Correct 61 ms 18028 KB Output is correct
51 Correct 60 ms 18028 KB Output is correct
52 Correct 72 ms 18028 KB Output is correct
53 Correct 63 ms 18028 KB Output is correct
54 Correct 123 ms 18028 KB Output is correct
55 Correct 87 ms 18028 KB Output is correct
56 Correct 71 ms 18028 KB Output is correct
57 Correct 63 ms 18028 KB Output is correct
58 Correct 77 ms 18168 KB Output is correct
59 Correct 101 ms 18168 KB Output is correct
60 Correct 81 ms 18172 KB Output is correct
61 Correct 53 ms 18172 KB Output is correct
62 Correct 52 ms 18172 KB Output is correct
63 Correct 116 ms 18172 KB Output is correct
64 Correct 59 ms 18172 KB Output is correct
65 Correct 59 ms 18172 KB Output is correct
66 Correct 72 ms 18332 KB Output is correct
67 Correct 65 ms 18332 KB Output is correct
68 Correct 299 ms 18332 KB Output is correct
69 Correct 62 ms 18500 KB Output is correct