結果
| 問題 | No.2071 Shift and OR |
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2022-09-16 21:38:12 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 565 bytes |
| 記録 | |
| コンパイル時間 | 1,285 ms |
| コンパイル使用メモリ | 214,080 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2026-06-27 14:30:35 |
| 合計ジャッジ時間 | 2,838 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int N;
cin>>N;
if(N >= 16){
cout<<65535<<endl;
return 0;
}
vector<vector<int>> dp(N+1,vector<int>(70000));
dp[0][0] = 1;
vector<int> S(N);
for(int i=0;i<N;i++) cin>>S[i];
for(int i=0;i<N;i++)for(int j=0;j<69990;j++){
if(!dp[i][j]) continue;
for(int k=0;k<16;k++){
dp[i+1][j|S[i]] = 1;
S[i] = S[i]/2+(1<<15)*(S[i]%2);
}
}
for(int i=68000;i>=0;i--)if(dp[N][i]){
cout<<i<<endl;
return 0;
}
}
keisuke6