結果

問題 No.2071 Shift and OR
コンテスト
ユーザー Hydrogen332
提出日時 2025-10-20 00:55:37
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 612 bytes
コンパイル時間 3,139 ms
コンパイル使用メモリ 281,664 KB
実行使用メモリ 814,524 KB
最終ジャッジ日時 2025-10-20 00:55:44
合計ジャッジ時間 6,537 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 MLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i, 0, N) cin >> A[i];
	
	vector dp(N + 1, vector<bool>(1 << 16, false));
	dp[0][0] = true;
	
	rep(i, 0, N) {
		rep(j, 0, 1 << 16) if (dp[i][j]) {
			rep(t, 0, 16) {
				dp[i + 1][j | A[i]] = true;
				A[i] = (A[i] >> 1) + ((A[i] & 1) << 15);
			}
		}
	}
	
	for (int bit = (1 << 16) - 1; bit >= 0; --bit) {
		if (dp[N][bit]) {
			cout << bit << '\n';
			break;
		}
	}
}
0