# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
91577 | 2018-12-28T13:28:56 Z | Mercenary | Bali Sculptures (APIO15_sculpture) | C++11 | 76 ms | 1932 KB |
#include<bits/stdc++.h> using namespace std; #define taskname "TEST" #define pb push_back typedef long double ld; typedef long long ll; const int maxn1 = 105; const int maxn2 = 2e3 + 5; int n , a , b , y[maxn2]; ll s[maxn2]; void enter() { cin >> n >> a >> b; for(int i = 1 ; i <= n ; ++i){ cin >> y[i]; s[i] = s[i - 1] + y[i]; } } ll get(int i , int j) { return s[j] - s[i - 1]; } bool ok(ll x , ll y) { return !(x & y); } struct Sub1 { bool f[maxn1][maxn1]; // f(i,j) chon den thg i va dk j nhom void init(){memset(f,0,sizeof f / sizeof(f[0][0]));} bool can(ll need) { f[0][0] = 1; for(int i = 1 ; i <= n ; ++i) { for(int j = 1 ; j <= b ; ++j) { for(int t = i ; t >= 1 && !f[i][j] ; --t) if(ok(get(t,i),need))f[i][j] |= f[t - 1][j - 1]; } } for(int i = a ; i <= b ; ++i)if(f[n][i])return 1; return 0; } }Sub1; struct Sub2 { const int inf = 1e9; int f[maxn2]; void init(){for(int i = 1 ; i <= n ; ++i)f[i] = inf;} bool can(ll need) { for(int i = 1 ; i <= n ; ++i) for(int t = i ; t >= 1 ; --t) if(ok(get(t,i),need))f[i] = min(f[i] , f[t - 1] + 1); return f[n] <= b; } }Sub2; void solve() { ll res = 0; for(int i = 40 ; i >= 0 ; --i) { if(a == 1) { Sub2.init(); if(Sub2.can(res | (1ll << i)))res |= (1ll << i); } else { Sub1.init(); if(Sub1.can(res | (1ll << i)))res |= (1ll << i); } } cout << ((~res) & ((1ll << 41) - 1)); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(taskname".INP","r")) freopen(taskname".INP", "r",stdin) , freopen(taskname".OUT", "w",stdout); enter(); solve(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 528 KB | Output is correct |
4 | Correct | 2 ms | 528 KB | Output is correct |
5 | Correct | 2 ms | 668 KB | Output is correct |
6 | Correct | 2 ms | 668 KB | Output is correct |
7 | Correct | 2 ms | 668 KB | Output is correct |
8 | Correct | 2 ms | 668 KB | Output is correct |
9 | Correct | 2 ms | 668 KB | Output is correct |
10 | Correct | 2 ms | 680 KB | Output is correct |
11 | Correct | 2 ms | 752 KB | Output is correct |
12 | Correct | 2 ms | 752 KB | Output is correct |
13 | Correct | 2 ms | 752 KB | Output is correct |
14 | Correct | 2 ms | 752 KB | Output is correct |
15 | Correct | 2 ms | 752 KB | Output is correct |
16 | Correct | 2 ms | 808 KB | Output is correct |
17 | Correct | 2 ms | 808 KB | Output is correct |
18 | Correct | 2 ms | 808 KB | Output is correct |
19 | Correct | 2 ms | 808 KB | Output is correct |
20 | Correct | 2 ms | 808 KB | Output is correct |
21 | Correct | 2 ms | 808 KB | Output is correct |
22 | Correct | 2 ms | 808 KB | Output is correct |
23 | Correct | 2 ms | 808 KB | Output is correct |
24 | Correct | 2 ms | 808 KB | Output is correct |
25 | Correct | 2 ms | 808 KB | Output is correct |
26 | Correct | 2 ms | 808 KB | Output is correct |
27 | Correct | 2 ms | 808 KB | Output is correct |
28 | Correct | 2 ms | 808 KB | Output is correct |
29 | Correct | 2 ms | 808 KB | Output is correct |
30 | Correct | 2 ms | 808 KB | Output is correct |
31 | Correct | 2 ms | 808 KB | Output is correct |
32 | Correct | 2 ms | 808 KB | Output is correct |
33 | Correct | 2 ms | 808 KB | Output is correct |
34 | Correct | 2 ms | 808 KB | Output is correct |
35 | Correct | 2 ms | 808 KB | Output is correct |
36 | Correct | 2 ms | 808 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 808 KB | Output is correct |
2 | Correct | 2 ms | 808 KB | Output is correct |
3 | Correct | 2 ms | 808 KB | Output is correct |
4 | Correct | 2 ms | 808 KB | Output is correct |
5 | Correct | 2 ms | 808 KB | Output is correct |
6 | Correct | 2 ms | 808 KB | Output is correct |
7 | Correct | 2 ms | 808 KB | Output is correct |
8 | Correct | 2 ms | 932 KB | Output is correct |
9 | Correct | 2 ms | 932 KB | Output is correct |
10 | Correct | 2 ms | 932 KB | Output is correct |
11 | Correct | 2 ms | 932 KB | Output is correct |
12 | Correct | 2 ms | 932 KB | Output is correct |
13 | Correct | 2 ms | 932 KB | Output is correct |
14 | Correct | 2 ms | 932 KB | Output is correct |
15 | Correct | 2 ms | 932 KB | Output is correct |
16 | Correct | 2 ms | 932 KB | Output is correct |
17 | Correct | 2 ms | 932 KB | Output is correct |
18 | Correct | 2 ms | 932 KB | Output is correct |
19 | Correct | 2 ms | 932 KB | Output is correct |
20 | Correct | 2 ms | 932 KB | Output is correct |
21 | Correct | 2 ms | 932 KB | Output is correct |
22 | Correct | 2 ms | 932 KB | Output is correct |
23 | Correct | 2 ms | 932 KB | Output is correct |
24 | Correct | 2 ms | 932 KB | Output is correct |
25 | Correct | 2 ms | 932 KB | Output is correct |
26 | Correct | 2 ms | 932 KB | Output is correct |
27 | Correct | 2 ms | 932 KB | Output is correct |
28 | Correct | 2 ms | 932 KB | Output is correct |
29 | Correct | 2 ms | 932 KB | Output is correct |
30 | Correct | 2 ms | 932 KB | Output is correct |
31 | Correct | 2 ms | 932 KB | Output is correct |
32 | Correct | 2 ms | 932 KB | Output is correct |
33 | Correct | 2 ms | 932 KB | Output is correct |
34 | Correct | 2 ms | 932 KB | Output is correct |
35 | Correct | 2 ms | 932 KB | Output is correct |
36 | Correct | 2 ms | 932 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 932 KB | Output is correct |
2 | Correct | 2 ms | 932 KB | Output is correct |
3 | Correct | 2 ms | 932 KB | Output is correct |
4 | Correct | 2 ms | 936 KB | Output is correct |
5 | Correct | 2 ms | 940 KB | Output is correct |
6 | Correct | 2 ms | 944 KB | Output is correct |
7 | Correct | 2 ms | 948 KB | Output is correct |
8 | Correct | 2 ms | 952 KB | Output is correct |
9 | Correct | 2 ms | 956 KB | Output is correct |
10 | Correct | 2 ms | 960 KB | Output is correct |
11 | Correct | 2 ms | 964 KB | Output is correct |
12 | Correct | 2 ms | 968 KB | Output is correct |
13 | Correct | 2 ms | 972 KB | Output is correct |
14 | Correct | 2 ms | 976 KB | Output is correct |
15 | Correct | 2 ms | 980 KB | Output is correct |
16 | Correct | 2 ms | 984 KB | Output is correct |
17 | Correct | 2 ms | 988 KB | Output is correct |
18 | Correct | 2 ms | 996 KB | Output is correct |
19 | Correct | 2 ms | 996 KB | Output is correct |
20 | Correct | 2 ms | 1000 KB | Output is correct |
21 | Correct | 2 ms | 1004 KB | Output is correct |
22 | Correct | 2 ms | 1008 KB | Output is correct |
23 | Correct | 2 ms | 1008 KB | Output is correct |
24 | Correct | 2 ms | 1016 KB | Output is correct |
25 | Correct | 2 ms | 1020 KB | Output is correct |
26 | Correct | 2 ms | 1024 KB | Output is correct |
27 | Correct | 2 ms | 1024 KB | Output is correct |
28 | Correct | 3 ms | 1160 KB | Output is correct |
29 | Correct | 2 ms | 1160 KB | Output is correct |
30 | Correct | 2 ms | 1160 KB | Output is correct |
31 | Correct | 2 ms | 1160 KB | Output is correct |
32 | Correct | 2 ms | 1160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1160 KB | Output is correct |
2 | Correct | 2 ms | 1160 KB | Output is correct |
3 | Correct | 2 ms | 1160 KB | Output is correct |
4 | Correct | 2 ms | 1160 KB | Output is correct |
5 | Correct | 2 ms | 1160 KB | Output is correct |
6 | Correct | 2 ms | 1160 KB | Output is correct |
7 | Correct | 2 ms | 1160 KB | Output is correct |
8 | Correct | 2 ms | 1160 KB | Output is correct |
9 | Correct | 2 ms | 1160 KB | Output is correct |
10 | Correct | 2 ms | 1160 KB | Output is correct |
11 | Correct | 2 ms | 1160 KB | Output is correct |
12 | Correct | 2 ms | 1160 KB | Output is correct |
13 | Correct | 2 ms | 1160 KB | Output is correct |
14 | Correct | 2 ms | 1216 KB | Output is correct |
15 | Correct | 2 ms | 1216 KB | Output is correct |
16 | Correct | 2 ms | 1216 KB | Output is correct |
17 | Correct | 2 ms | 1216 KB | Output is correct |
18 | Correct | 2 ms | 1216 KB | Output is correct |
19 | Correct | 2 ms | 1216 KB | Output is correct |
20 | Correct | 2 ms | 1216 KB | Output is correct |
21 | Correct | 2 ms | 1216 KB | Output is correct |
22 | Correct | 2 ms | 1216 KB | Output is correct |
23 | Correct | 2 ms | 1216 KB | Output is correct |
24 | Correct | 2 ms | 1216 KB | Output is correct |
25 | Correct | 2 ms | 1216 KB | Output is correct |
26 | Correct | 2 ms | 1216 KB | Output is correct |
27 | Correct | 2 ms | 1216 KB | Output is correct |
28 | Correct | 2 ms | 1216 KB | Output is correct |
29 | Correct | 2 ms | 1216 KB | Output is correct |
30 | Correct | 2 ms | 1216 KB | Output is correct |
31 | Correct | 2 ms | 1216 KB | Output is correct |
32 | Correct | 2 ms | 1216 KB | Output is correct |
33 | Correct | 2 ms | 1268 KB | Output is correct |
34 | Correct | 2 ms | 1268 KB | Output is correct |
35 | Correct | 2 ms | 1268 KB | Output is correct |
36 | Correct | 2 ms | 1268 KB | Output is correct |
37 | Correct | 2 ms | 1300 KB | Output is correct |
38 | Correct | 2 ms | 1300 KB | Output is correct |
39 | Correct | 2 ms | 1300 KB | Output is correct |
40 | Correct | 2 ms | 1300 KB | Output is correct |
41 | Correct | 2 ms | 1300 KB | Output is correct |
42 | Correct | 2 ms | 1300 KB | Output is correct |
43 | Correct | 2 ms | 1300 KB | Output is correct |
44 | Correct | 2 ms | 1300 KB | Output is correct |
45 | Correct | 2 ms | 1300 KB | Output is correct |
46 | Correct | 2 ms | 1300 KB | Output is correct |
47 | Correct | 2 ms | 1300 KB | Output is correct |
48 | Correct | 2 ms | 1300 KB | Output is correct |
49 | Correct | 2 ms | 1300 KB | Output is correct |
50 | Correct | 2 ms | 1300 KB | Output is correct |
51 | Correct | 2 ms | 1300 KB | Output is correct |
52 | Correct | 2 ms | 1300 KB | Output is correct |
53 | Correct | 2 ms | 1300 KB | Output is correct |
54 | Correct | 2 ms | 1300 KB | Output is correct |
55 | Correct | 2 ms | 1300 KB | Output is correct |
56 | Correct | 2 ms | 1300 KB | Output is correct |
57 | Correct | 2 ms | 1300 KB | Output is correct |
58 | Correct | 2 ms | 1300 KB | Output is correct |
59 | Correct | 2 ms | 1300 KB | Output is correct |
60 | Correct | 2 ms | 1300 KB | Output is correct |
61 | Correct | 2 ms | 1300 KB | Output is correct |
62 | Correct | 2 ms | 1300 KB | Output is correct |
63 | Correct | 2 ms | 1304 KB | Output is correct |
64 | Correct | 9 ms | 1304 KB | Output is correct |
65 | Correct | 3 ms | 1312 KB | Output is correct |
66 | Correct | 3 ms | 1312 KB | Output is correct |
67 | Correct | 5 ms | 1316 KB | Output is correct |
68 | Correct | 10 ms | 1320 KB | Output is correct |
69 | Correct | 20 ms | 1324 KB | Output is correct |
70 | Correct | 20 ms | 1328 KB | Output is correct |
71 | Correct | 2 ms | 1332 KB | Output is correct |
72 | Correct | 20 ms | 1368 KB | Output is correct |
73 | Correct | 15 ms | 1368 KB | Output is correct |
74 | Correct | 13 ms | 1368 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1368 KB | Output is correct |
2 | Correct | 2 ms | 1368 KB | Output is correct |
3 | Correct | 2 ms | 1368 KB | Output is correct |
4 | Correct | 2 ms | 1368 KB | Output is correct |
5 | Correct | 2 ms | 1368 KB | Output is correct |
6 | Correct | 2 ms | 1368 KB | Output is correct |
7 | Correct | 2 ms | 1372 KB | Output is correct |
8 | Correct | 2 ms | 1376 KB | Output is correct |
9 | Correct | 2 ms | 1488 KB | Output is correct |
10 | Correct | 2 ms | 1488 KB | Output is correct |
11 | Correct | 2 ms | 1488 KB | Output is correct |
12 | Correct | 2 ms | 1488 KB | Output is correct |
13 | Correct | 2 ms | 1488 KB | Output is correct |
14 | Correct | 2 ms | 1488 KB | Output is correct |
15 | Correct | 2 ms | 1488 KB | Output is correct |
16 | Correct | 2 ms | 1488 KB | Output is correct |
17 | Correct | 2 ms | 1488 KB | Output is correct |
18 | Correct | 2 ms | 1488 KB | Output is correct |
19 | Correct | 2 ms | 1488 KB | Output is correct |
20 | Correct | 8 ms | 1488 KB | Output is correct |
21 | Correct | 2 ms | 1536 KB | Output is correct |
22 | Correct | 2 ms | 1536 KB | Output is correct |
23 | Correct | 2 ms | 1536 KB | Output is correct |
24 | Correct | 2 ms | 1544 KB | Output is correct |
25 | Correct | 2 ms | 1544 KB | Output is correct |
26 | Correct | 2 ms | 1544 KB | Output is correct |
27 | Correct | 2 ms | 1544 KB | Output is correct |
28 | Correct | 2 ms | 1544 KB | Output is correct |
29 | Correct | 2 ms | 1544 KB | Output is correct |
30 | Correct | 2 ms | 1544 KB | Output is correct |
31 | Correct | 2 ms | 1544 KB | Output is correct |
32 | Correct | 2 ms | 1544 KB | Output is correct |
33 | Correct | 2 ms | 1544 KB | Output is correct |
34 | Correct | 2 ms | 1544 KB | Output is correct |
35 | Correct | 2 ms | 1544 KB | Output is correct |
36 | Correct | 2 ms | 1544 KB | Output is correct |
37 | Correct | 2 ms | 1544 KB | Output is correct |
38 | Correct | 2 ms | 1544 KB | Output is correct |
39 | Correct | 2 ms | 1544 KB | Output is correct |
40 | Correct | 2 ms | 1544 KB | Output is correct |
41 | Correct | 2 ms | 1544 KB | Output is correct |
42 | Correct | 2 ms | 1544 KB | Output is correct |
43 | Correct | 2 ms | 1544 KB | Output is correct |
44 | Correct | 2 ms | 1544 KB | Output is correct |
45 | Correct | 2 ms | 1632 KB | Output is correct |
46 | Correct | 2 ms | 1636 KB | Output is correct |
47 | Correct | 2 ms | 1636 KB | Output is correct |
48 | Correct | 2 ms | 1636 KB | Output is correct |
49 | Correct | 2 ms | 1636 KB | Output is correct |
50 | Correct | 2 ms | 1636 KB | Output is correct |
51 | Correct | 2 ms | 1636 KB | Output is correct |
52 | Correct | 9 ms | 1636 KB | Output is correct |
53 | Correct | 13 ms | 1636 KB | Output is correct |
54 | Correct | 23 ms | 1636 KB | Output is correct |
55 | Correct | 22 ms | 1636 KB | Output is correct |
56 | Correct | 76 ms | 1636 KB | Output is correct |
57 | Correct | 75 ms | 1636 KB | Output is correct |
58 | Correct | 70 ms | 1636 KB | Output is correct |
59 | Correct | 70 ms | 1644 KB | Output is correct |
60 | Correct | 76 ms | 1796 KB | Output is correct |
61 | Correct | 2 ms | 1796 KB | Output is correct |
62 | Correct | 13 ms | 1796 KB | Output is correct |
63 | Correct | 23 ms | 1796 KB | Output is correct |
64 | Correct | 22 ms | 1796 KB | Output is correct |
65 | Correct | 38 ms | 1796 KB | Output is correct |
66 | Correct | 56 ms | 1804 KB | Output is correct |
67 | Correct | 74 ms | 1888 KB | Output is correct |
68 | Correct | 75 ms | 1888 KB | Output is correct |
69 | Correct | 72 ms | 1932 KB | Output is correct |