結果
| 問題 | No.2071 Shift and OR |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 21:52:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 63 ms / 2,000 ms |
| コード長 | 614 bytes |
| コンパイル時間 | 2,072 ms |
| コンパイル使用メモリ | 195,564 KB |
| 最終ジャッジ日時 | 2025-02-07 09:22:12 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
int shift(int x) {
return x/2 + (1<<15)*(x % 2);
}
int main(){
int n;
cin >> n;
vector<int> a(n);
rep(i,n) cin >> a[i];
int all = (1<<16)-1;
if(n >= 16) {
cout << all << endl;
return 0;
}
vector<int> dp(1<<16);
dp[0]++;
rep(i,n) {
vector<int> dpn(1<<16);
rep(j,17) {
a[i] = shift(a[i]);
rep(x,1<<16) dpn[a[i]|x] += dp[x];
}
swap(dp,dpn);
}
int ans = 0;
rep(i,1<<16) if(dp[i]) ans = max(ans,i);
cout << ans << endl;
return 0;
}