結果
| 問題 | No.2071 Shift and OR | 
| コンテスト | |
| ユーザー |  keisuke6 | 
| 提出日時 | 2022-09-16 21:38:12 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 33 ms / 2,000 ms | 
| コード長 | 565 bytes | 
| コンパイル時間 | 1,803 ms | 
| コンパイル使用メモリ | 197,072 KB | 
| 最終ジャッジ日時 | 2025-02-07 06:16:13 | 
| ジャッジサーバーID (参考情報) | judge2 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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;
  }
}
            
            
            
        