# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
609688 | 2022-07-27T19:19:39 Z | krit3379 | Bali Sculptures (APIO15_sculpture) | C++17 | 1 ms | 340 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],now,ans; bitset<50> 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=50;i>=0;i--){ now=0; for(j=50;j>i;j--)now=bit[j]*(1ll<<j); for(j=i-1;j>=0;j--)now+=1ll<<j; for(j=1;j<=n;j++)for(k=j;k<=n;k++)ok[j][k]=((qs[j][k]|now)==now); 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[i]=true; } for(i=0;i<50;i++)if(bit[i])ans+=1ll<<i; printf("%lld",ans); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 0 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 0 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |