답안 #418060

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418060 2021-06-05T01:38:56 Z cgiosy Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 204 KB
#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;
	int A[N+1];
	for(int i=1; i<=N; i++) cin>>A[i];
	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, s=0;
		for(int i=1; i<=N; i++) {
			L[i]=N, R[i]=1;
			ll t=s+=A[i];
			for(int j=0; j<i; t-=A[++j]) if(!(t&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

sculpture.cpp: In function 'int main()':
sculpture.cpp:15:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |   ll m=l+r>>1, s=0;
      |        ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -