답안 #43250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
43250 2018-03-11T15:37:28 Z dqhungdl Bali Sculptures (APIO15_sculpture) C++14
71 / 100
1000 ms 18156 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(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 17528 KB Output is correct
2 Correct 56 ms 17760 KB Output is correct
3 Correct 56 ms 17760 KB Output is correct
4 Correct 64 ms 17868 KB Output is correct
5 Correct 58 ms 17868 KB Output is correct
6 Correct 54 ms 17884 KB Output is correct
7 Correct 55 ms 17884 KB Output is correct
8 Correct 61 ms 17884 KB Output is correct
9 Correct 55 ms 17884 KB Output is correct
10 Correct 55 ms 17884 KB Output is correct
11 Correct 56 ms 17884 KB Output is correct
12 Correct 70 ms 17884 KB Output is correct
13 Correct 60 ms 17952 KB Output is correct
14 Correct 54 ms 17952 KB Output is correct
15 Correct 56 ms 17952 KB Output is correct
16 Correct 55 ms 17952 KB Output is correct
17 Correct 56 ms 17952 KB Output is correct
18 Correct 56 ms 17952 KB Output is correct
19 Correct 65 ms 18028 KB Output is correct
20 Correct 61 ms 18028 KB Output is correct
21 Correct 64 ms 18028 KB Output is correct
22 Correct 57 ms 18028 KB Output is correct
23 Correct 66 ms 18028 KB Output is correct
24 Correct 59 ms 18028 KB Output is correct
25 Correct 53 ms 18028 KB Output is correct
26 Correct 57 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 55 ms 18028 KB Output is correct
30 Correct 54 ms 18028 KB Output is correct
31 Correct 58 ms 18028 KB Output is correct
32 Correct 61 ms 18028 KB Output is correct
33 Correct 56 ms 18028 KB Output is correct
34 Correct 62 ms 18028 KB Output is correct
35 Correct 55 ms 18028 KB Output is correct
36 Correct 56 ms 18028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 18028 KB Output is correct
2 Correct 62 ms 18028 KB Output is correct
3 Correct 61 ms 18028 KB Output is correct
4 Correct 53 ms 18028 KB Output is correct
5 Correct 56 ms 18028 KB Output is correct
6 Correct 54 ms 18028 KB Output is correct
7 Correct 64 ms 18028 KB Output is correct
8 Correct 56 ms 18028 KB Output is correct
9 Correct 56 ms 18028 KB Output is correct
10 Correct 63 ms 18028 KB Output is correct
11 Correct 54 ms 18028 KB Output is correct
12 Correct 57 ms 18028 KB Output is correct
13 Correct 60 ms 18028 KB Output is correct
14 Correct 56 ms 18028 KB Output is correct
15 Correct 57 ms 18028 KB Output is correct
16 Correct 60 ms 18028 KB Output is correct
17 Correct 54 ms 18028 KB Output is correct
18 Correct 57 ms 18028 KB Output is correct
19 Correct 56 ms 18028 KB Output is correct
20 Correct 59 ms 18028 KB Output is correct
21 Correct 59 ms 18028 KB Output is correct
22 Correct 59 ms 18028 KB Output is correct
23 Correct 54 ms 18028 KB Output is correct
24 Correct 55 ms 18028 KB Output is correct
25 Correct 56 ms 18028 KB Output is correct
26 Correct 60 ms 18028 KB Output is correct
27 Correct 57 ms 18028 KB Output is correct
28 Correct 57 ms 18028 KB Output is correct
29 Correct 63 ms 18028 KB Output is correct
30 Correct 53 ms 18028 KB Output is correct
31 Correct 53 ms 18028 KB Output is correct
32 Correct 53 ms 18028 KB Output is correct
33 Correct 52 ms 18028 KB Output is correct
34 Correct 52 ms 18028 KB Output is correct
35 Correct 55 ms 18028 KB Output is correct
36 Correct 57 ms 18028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 18028 KB Output is correct
2 Correct 59 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 53 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 61 ms 18028 KB Output is correct
9 Correct 54 ms 18028 KB Output is correct
10 Correct 56 ms 18028 KB Output is correct
11 Correct 54 ms 18028 KB Output is correct
12 Correct 54 ms 18028 KB Output is correct
13 Correct 58 ms 18028 KB Output is correct
14 Correct 60 ms 18028 KB Output is correct
15 Correct 57 ms 18028 KB Output is correct
16 Correct 57 ms 18028 KB Output is correct
17 Correct 53 ms 18028 KB Output is correct
18 Correct 57 ms 18028 KB Output is correct
19 Correct 62 ms 18028 KB Output is correct
20 Correct 68 ms 18028 KB Output is correct
21 Correct 59 ms 18028 KB Output is correct
22 Correct 60 ms 18028 KB Output is correct
23 Correct 61 ms 18028 KB Output is correct
24 Correct 61 ms 18028 KB Output is correct
25 Correct 55 ms 18028 KB Output is correct
26 Correct 59 ms 18028 KB Output is correct
27 Correct 59 ms 18028 KB Output is correct
28 Correct 59 ms 18028 KB Output is correct
29 Correct 57 ms 18028 KB Output is correct
30 Correct 53 ms 18028 KB Output is correct
31 Correct 53 ms 18028 KB Output is correct
32 Correct 52 ms 18028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 18028 KB Output is correct
2 Correct 57 ms 18028 KB Output is correct
3 Correct 56 ms 18028 KB Output is correct
4 Correct 59 ms 18028 KB Output is correct
5 Correct 59 ms 18028 KB Output is correct
6 Correct 67 ms 18028 KB Output is correct
7 Correct 60 ms 18028 KB Output is correct
8 Correct 66 ms 18028 KB Output is correct
9 Correct 59 ms 18028 KB Output is correct
10 Correct 56 ms 18028 KB Output is correct
11 Correct 55 ms 18028 KB Output is correct
12 Correct 56 ms 18028 KB Output is correct
13 Correct 64 ms 18028 KB Output is correct
14 Correct 58 ms 18028 KB Output is correct
15 Correct 57 ms 18028 KB Output is correct
16 Correct 70 ms 18028 KB Output is correct
17 Correct 61 ms 18028 KB Output is correct
18 Correct 59 ms 18028 KB Output is correct
19 Correct 62 ms 18028 KB Output is correct
20 Correct 67 ms 18028 KB Output is correct
21 Correct 54 ms 18028 KB Output is correct
22 Correct 60 ms 18028 KB Output is correct
23 Correct 68 ms 18028 KB Output is correct
24 Correct 62 ms 18028 KB Output is correct
25 Correct 55 ms 18028 KB Output is correct
26 Correct 63 ms 18028 KB Output is correct
27 Correct 55 ms 18028 KB Output is correct
28 Correct 55 ms 18028 KB Output is correct
29 Correct 57 ms 18028 KB Output is correct
30 Correct 63 ms 18028 KB Output is correct
31 Correct 58 ms 18028 KB Output is correct
32 Correct 55 ms 18028 KB Output is correct
33 Correct 61 ms 18028 KB Output is correct
34 Correct 58 ms 18028 KB Output is correct
35 Correct 64 ms 18028 KB Output is correct
36 Correct 64 ms 18028 KB Output is correct
37 Correct 61 ms 18028 KB Output is correct
38 Correct 68 ms 18028 KB Output is correct
39 Correct 65 ms 18028 KB Output is correct
40 Correct 59 ms 18028 KB Output is correct
41 Correct 69 ms 18028 KB Output is correct
42 Correct 66 ms 18028 KB Output is correct
43 Correct 61 ms 18028 KB Output is correct
44 Correct 71 ms 18028 KB Output is correct
45 Correct 54 ms 18028 KB Output is correct
46 Correct 62 ms 18028 KB Output is correct
47 Correct 57 ms 18028 KB Output is correct
48 Correct 57 ms 18028 KB Output is correct
49 Correct 64 ms 18028 KB Output is correct
50 Correct 66 ms 18028 KB Output is correct
51 Correct 66 ms 18028 KB Output is correct
52 Correct 65 ms 18028 KB Output is correct
53 Correct 60 ms 18028 KB Output is correct
54 Correct 62 ms 18028 KB Output is correct
55 Correct 57 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 60 ms 18028 KB Output is correct
59 Correct 61 ms 18028 KB Output is correct
60 Correct 60 ms 18028 KB Output is correct
61 Correct 60 ms 18028 KB Output is correct
62 Correct 61 ms 18028 KB Output is correct
63 Correct 63 ms 18028 KB Output is correct
64 Correct 58 ms 18028 KB Output is correct
65 Correct 62 ms 18028 KB Output is correct
66 Correct 64 ms 18028 KB Output is correct
67 Correct 58 ms 18028 KB Output is correct
68 Correct 63 ms 18028 KB Output is correct
69 Correct 63 ms 18028 KB Output is correct
70 Correct 58 ms 18028 KB Output is correct
71 Correct 54 ms 18028 KB Output is correct
72 Correct 59 ms 18028 KB Output is correct
73 Correct 62 ms 18028 KB Output is correct
74 Correct 66 ms 18028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 18028 KB Output is correct
2 Correct 79 ms 18028 KB Output is correct
3 Correct 64 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 54 ms 18028 KB Output is correct
7 Correct 57 ms 18028 KB Output is correct
8 Correct 62 ms 18028 KB Output is correct
9 Correct 61 ms 18028 KB Output is correct
10 Correct 69 ms 18028 KB Output is correct
11 Correct 66 ms 18028 KB Output is correct
12 Correct 58 ms 18028 KB Output is correct
13 Correct 64 ms 18028 KB Output is correct
14 Correct 71 ms 18028 KB Output is correct
15 Correct 64 ms 18028 KB Output is correct
16 Correct 65 ms 18028 KB Output is correct
17 Correct 59 ms 18028 KB Output is correct
18 Correct 82 ms 18028 KB Output is correct
19 Correct 62 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 59 ms 18028 KB Output is correct
23 Correct 62 ms 18028 KB Output is correct
24 Correct 58 ms 18028 KB Output is correct
25 Correct 54 ms 18028 KB Output is correct
26 Correct 59 ms 18028 KB Output is correct
27 Correct 57 ms 18028 KB Output is correct
28 Correct 52 ms 18028 KB Output is correct
29 Correct 64 ms 18028 KB Output is correct
30 Correct 61 ms 18028 KB Output is correct
31 Correct 56 ms 18028 KB Output is correct
32 Correct 53 ms 18028 KB Output is correct
33 Correct 58 ms 18028 KB Output is correct
34 Correct 56 ms 18028 KB Output is correct
35 Correct 61 ms 18028 KB Output is correct
36 Correct 54 ms 18028 KB Output is correct
37 Correct 54 ms 18028 KB Output is correct
38 Correct 56 ms 18028 KB Output is correct
39 Correct 58 ms 18028 KB Output is correct
40 Correct 64 ms 18028 KB Output is correct
41 Correct 53 ms 18028 KB Output is correct
42 Correct 56 ms 18028 KB Output is correct
43 Correct 54 ms 18028 KB Output is correct
44 Correct 60 ms 18028 KB Output is correct
45 Correct 56 ms 18028 KB Output is correct
46 Correct 56 ms 18028 KB Output is correct
47 Correct 61 ms 18028 KB Output is correct
48 Correct 67 ms 18028 KB Output is correct
49 Correct 54 ms 18028 KB Output is correct
50 Correct 58 ms 18028 KB Output is correct
51 Correct 60 ms 18028 KB Output is correct
52 Correct 250 ms 18028 KB Output is correct
53 Correct 59 ms 18028 KB Output is correct
54 Correct 483 ms 18156 KB Output is correct
55 Correct 413 ms 18156 KB Output is correct
56 Execution timed out 1068 ms 18156 KB Time limit exceeded
57 Halted 0 ms 0 KB -