| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 495928 | ntabc05101 | Bali Sculptures (APIO15_sculpture) | C++14 | 12 ms | 368 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define taskname ""
const int lgN = 41;
int main() {
	if (fopen(taskname".inp", "r")) {
		freopen(taskname".inp", "r", stdin);
		freopen(taskname".out", "w", stdout);
	}
	else {
		if (fopen(taskname".in", "r")) {
			freopen(taskname".in", "r", stdin);
			freopen(taskname".out", "w", stdout);
		}
	}
	cin.tie(0)->sync_with_stdio(0);
	int n, a, b; cin >> n >> a >> b;
	long long y[n + 1];
	y[0] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> y[i]; y[i] += y[i - 1];
	}
	long long res = 0;
	if (n > 100) {
		pair<bool, int> dp[n + 1];
		for (int x = lgN - 1; ~x; x--) {
			dp[0] = {1, 0};
			for (int i = 1; i <= n; i++) {
				dp[i] = {0, 0};
				for (int j = i - 1; ~j; j--) {
					if ((res >> x) == (((y[i] - y[j]) | res) >> x)) {
						dp[i] = max(dp[i], dp[j]);
					}
				}
				dp[i].second--;
			}
			if (!dp[n].first || -dp[n].second > b) {
				res |= 1 << x;
			}
		}
		cout << res << "\n";
	}
	else {
		bool dp[n + 1][n + 1];
		for (int x = lgN - 1; ~x; x--) {
			memset(dp, 0, sizeof(dp));
			dp[0][0] = 1;
			for (int i = 1; i <= n; i++) {
				for (int k = i - 1; ~k; k--) {
					if ((res >> x) == (((y[i] - y[k]) | res) >> x)) {
						for (int j = 1; j <= i; j++) {
							dp[i][j] |= dp[k][j - 1];
						}
					}
				}
			}
	
			int chk = 1;
			for (int j = a; j <= b; j++) {
				if (dp[n][j]) {
					chk = 0; break;
				}
			}
			res |= chk << x;
		}
		cout << res << "\n";
	}
	return 0;
}
컴파일 시 표준 에러 (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... | ||||
