# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
609699 | 2022-07-27T19:27:24 Z | krit3379 | Bali Sculptures (APIO15_sculpture) | C++14 | 557 ms | 23512 KB |
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define N 2005 long long arr[N],qs[N][N],dp[N],bit; bitset<N> ok[N]; int main(){ int n,a,b,i,j,k; scanf("%d %d %d",&n,&a,&b); for(i=1;i<=n;i++)scanf("%lld",&arr[i]),arr[i]+=arr[i-1]; for(i=1;i<=n;i++)for(j=i;j<=n;j++)qs[i][j]=arr[j]-arr[i-1]; if(a==1){ for(i=60;i>=0;i--){ long long x=bit|((1ll<<i)-1ll); for(j=1;j<=n;j++)for(k=j;k<=n;k++)ok[j][k]=((qs[j][k]|x)==x); for(j=1;j<=n;j++){ dp[j]=ok[1][j]?1:1e9; for(k=1;k<j;k++)if(ok[k+1][j])dp[j]=min(dp[j],dp[k]+1); } if(dp[n]>b)bit|=1ll<<i; } printf("%lld",bit); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 308 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 308 KB | Output is correct |
14 | Incorrect | 1 ms | 300 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 308 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 304 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 360 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Incorrect | 1 ms | 212 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 304 KB | Output is correct |
9 | Correct | 1 ms | 312 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 304 KB | Output is correct |
13 | Correct | 0 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 468 KB | Output is correct |
17 | Correct | 1 ms | 468 KB | Output is correct |
18 | Correct | 1 ms | 468 KB | Output is correct |
19 | Correct | 1 ms | 432 KB | Output is correct |
20 | Correct | 1 ms | 468 KB | Output is correct |
21 | Correct | 1 ms | 468 KB | Output is correct |
22 | Correct | 1 ms | 468 KB | Output is correct |
23 | Correct | 1 ms | 468 KB | Output is correct |
24 | Correct | 1 ms | 432 KB | Output is correct |
25 | Correct | 2 ms | 596 KB | Output is correct |
26 | Correct | 1 ms | 596 KB | Output is correct |
27 | Correct | 2 ms | 724 KB | Output is correct |
28 | Correct | 3 ms | 724 KB | Output is correct |
29 | Correct | 3 ms | 720 KB | Output is correct |
30 | Correct | 3 ms | 692 KB | Output is correct |
31 | Correct | 3 ms | 724 KB | Output is correct |
32 | Correct | 2 ms | 724 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 312 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 316 KB | Output is correct |
8 | Correct | 1 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 308 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 312 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Incorrect | 0 ms | 212 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 308 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 304 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 308 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 308 KB | Output is correct |
26 | Correct | 1 ms | 436 KB | Output is correct |
27 | Correct | 1 ms | 468 KB | Output is correct |
28 | Correct | 1 ms | 468 KB | Output is correct |
29 | Correct | 1 ms | 468 KB | Output is correct |
30 | Correct | 1 ms | 488 KB | Output is correct |
31 | Correct | 1 ms | 468 KB | Output is correct |
32 | Correct | 1 ms | 436 KB | Output is correct |
33 | Correct | 1 ms | 468 KB | Output is correct |
34 | Correct | 1 ms | 468 KB | Output is correct |
35 | Correct | 1 ms | 564 KB | Output is correct |
36 | Correct | 1 ms | 596 KB | Output is correct |
37 | Correct | 2 ms | 724 KB | Output is correct |
38 | Correct | 2 ms | 724 KB | Output is correct |
39 | Correct | 2 ms | 724 KB | Output is correct |
40 | Correct | 2 ms | 724 KB | Output is correct |
41 | Correct | 2 ms | 724 KB | Output is correct |
42 | Correct | 2 ms | 724 KB | Output is correct |
43 | Correct | 1 ms | 464 KB | Output is correct |
44 | Correct | 2 ms | 564 KB | Output is correct |
45 | Correct | 2 ms | 688 KB | Output is correct |
46 | Correct | 2 ms | 724 KB | Output is correct |
47 | Correct | 2 ms | 784 KB | Output is correct |
48 | Correct | 2 ms | 724 KB | Output is correct |
49 | Correct | 3 ms | 692 KB | Output is correct |
50 | Correct | 2 ms | 696 KB | Output is correct |
51 | Correct | 2 ms | 724 KB | Output is correct |
52 | Correct | 45 ms | 4056 KB | Output is correct |
53 | Correct | 81 ms | 5680 KB | Output is correct |
54 | Correct | 131 ms | 8504 KB | Output is correct |
55 | Correct | 125 ms | 8532 KB | Output is correct |
56 | Correct | 520 ms | 23508 KB | Output is correct |
57 | Correct | 540 ms | 23504 KB | Output is correct |
58 | Correct | 536 ms | 23508 KB | Output is correct |
59 | Correct | 549 ms | 23512 KB | Output is correct |
60 | Correct | 507 ms | 23508 KB | Output is correct |
61 | Correct | 2 ms | 724 KB | Output is correct |
62 | Correct | 87 ms | 5684 KB | Output is correct |
63 | Correct | 133 ms | 8404 KB | Output is correct |
64 | Correct | 133 ms | 8496 KB | Output is correct |
65 | Correct | 266 ms | 14036 KB | Output is correct |
66 | Correct | 383 ms | 19472 KB | Output is correct |
67 | Correct | 516 ms | 23508 KB | Output is correct |
68 | Correct | 557 ms | 23508 KB | Output is correct |
69 | Correct | 505 ms | 23504 KB | Output is correct |