# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
418057 | cgiosy | Bali Sculptures (APIO15_sculpture) | C++17 | 1 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
ios::sync_with_stdio(0);cin.tie(0);
int N, S, E;
cin>>N>>S>>E;
ll A[N+1];
for(int i=1; i<=N; i++) cin>>A[i], A[i]+=A[i-1];
ll l=0, r=1LL<<41;
int L[N+1], R[N+1];
L[0]=R[0]=0;
while(l+1<r) {
ll m=l+r>>1;
for(int i=1; i<=N; i++) {
L[i]=N, R[i]=1;
for(int j=0; j<=i; j++) if(!(A[i]-A[j]&m)) {
L[i]=min(L[i], L[j]+1);
R[i]=max(R[i], R[j]+1);
}
}
(S<=R[N] && L[N]<=E ? l : r)=m;
}
cout<<(1LL<<41)-1-l<<'\n';
}
Compilation message (stderr)
# | 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... |