# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72708 | 2018-08-26T18:31:46 Z | Pajaraja | Bali Sculptures (APIO15_sculpture) | C++17 | 5 ms | 916 KB |
#include <bits/stdc++.h> #define MAXN 2007 using namespace std; long long s[MAXN][MAXN],arr[MAXN]; bool g[MAXN][MAXN],ag[MAXN][MAXN],dp[MAXN][MAXN]; int dpl[MAXN]; int main() { int n,a,b; scanf("%d%d%d",&n,&a,&b); for(int i=0;i<n;i++) scanf("%lld",&arr[i]); for(int i=0;i<n;i++) s[i][i]=arr[i]; for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) {ag[i][j]=true; s[i][j]=s[i][j-1]+arr[j];} long long rez=0; for(int x=40;x>=0;x--) { for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) g[i][j]=(((1LL<<x)|s[i][j-1])!=s[i][j-1]) && ag[i][j]; bool ra=false; if(n<=200) { for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) dp[i][j]=false; dp[0][0]=true; for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) if(g[i][j]) for(int r=1;r<n;r++) dp[j][r]=dp[j][r]||dp[i][r-1]; for(int i=a;i<=b;i++) ra=ra||dp[n][i]; } else { for(int i=1;i<=n;i++) dpl[i]=MAXN; dpl[0]=0; for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) dpl[j]=min(dpl[j],dpl[i]+1); if(dpl[n]<=b) ra=true; } if(ra) for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) ag[i][j]=g[i][j]; else rez+=(1LL<<x); } printf("%lld",rez); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 444 KB | Output is correct |
3 | Incorrect | 4 ms | 460 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 644 KB | Output is correct |
2 | Correct | 2 ms | 648 KB | Output is correct |
3 | Incorrect | 2 ms | 648 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 880 KB | Output is correct |
2 | Correct | 2 ms | 880 KB | Output is correct |
3 | Incorrect | 2 ms | 880 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 880 KB | Output is correct |
2 | Correct | 2 ms | 916 KB | Output is correct |
3 | Incorrect | 2 ms | 916 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 916 KB | Output is correct |
2 | Correct | 2 ms | 916 KB | Output is correct |
3 | Incorrect | 3 ms | 916 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |