이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,k,x,y,z;
ll a,b;
bool dp[105][2005][105];
ll ar[105];
signed main() {
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) cin >> ar[i];
	ll mxval = 0;
	for (int i = 1; i <= n; i++) mxval = max(mxval,ar[i]);
	for (int i = 1; i <= n; i++) ar[i] += ar[i-1];
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++) { //pos
		for (int j = 1; j <= n; j++) { //st pos
			for (int k = 1; k <= n; k++) { //groups
				for (int l = 0; l <= n*mxval; l++) { //total or
					if (dp[j-1][l][k-1]) dp[i][l|(ar[i]-ar[j-1])][k] = 1;
				}
			}
		}
	}
	for (int i = 0; i <= mxval*n; i++) {
		for (int j = a; j <= b; j++) {
			if (dp[n][i][j]) {
				cout << i << "\n";
				return 0;
			}
		}
	}
}
| # | 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... |