結果
| 問題 |
No.2071 Shift and OR
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2022-09-16 22:51:00 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 2,000 ms |
| コード長 | 967 bytes |
| コンパイル時間 | 2,153 ms |
| コンパイル使用メモリ | 116,124 KB |
| 最終ジャッジ日時 | 2025-02-07 10:23:12 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <atcoder/modint>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
using Modint = atcoder::static_modint<998244353>;
int main(){
int N; cin >> N;
if(N >= 16){ cout << ((1<<16)-1) << '\n'; return 0; }
vector<int> A(N);
rep(i,N) cin >> A[i];
vector<bool> dp(1<<16);
dp[0] = true;
for(int a : A){
vector<bool> tmp(1<<16);
rep(q,16){
a = (a>>1) | ((a%2)<<15);
rep(i,1<<16) if(dp[i]) tmp[i|a] = true;
}
swap(dp,tmp);
}
int ans = 0;
rep(i,1<<16) if(dp[i]) ans = i;
cout << ans << '\n';
return 0;
}
struct ios_do_not_sync{
ios_do_not_sync(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
} ios_do_not_sync_instance;
Nachia