이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
int N,A,B,G[2020]; long long X[2020]; bool gr[101][101];
int main()
{
scanf ("%d %d %d",&N,&A,&B);
for (int i=1;i<=N;i++){
scanf ("%lld",&X[i]);
X[i] += X[i-1];
}
if (A == 1){
long long ans = 0;
for (int k=40;k>=0;k--){
long long want = ans + (1ll << k) - 1;
for (int i=1;i<=N;i++) G[i] = 10000;
for (int j=1;j<=N;j++) for (int i=1;i<=j;i++){
long long see = X[j] - X[i-1];
if ((see | want) == want){
if (G[j] > G[i-1] + 1)
G[j] = G[i-1] + 1;
}
}
if (G[N] > B) ans += (1ll << k);
}
printf ("%lld\n",ans);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |