結果

問題 No.2071 Shift and OR
ユーザー keisuke6keisuke6
提出日時 2022-09-16 21:38:12
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 565 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 202,928 KB
実行使用メモリ 12,268 KB
最終ジャッジ日時 2023-08-23 14:36:58
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,076 KB
testcase_01 AC 4 ms
5,780 KB
testcase_02 AC 5 ms
6,760 KB
testcase_03 AC 12 ms
8,156 KB
testcase_04 AC 7 ms
7,524 KB
testcase_05 AC 20 ms
9,732 KB
testcase_06 AC 9 ms
7,524 KB
testcase_07 AC 6 ms
6,780 KB
testcase_08 AC 7 ms
7,576 KB
testcase_09 AC 8 ms
7,568 KB
testcase_10 AC 9 ms
7,492 KB
testcase_11 AC 23 ms
10,152 KB
testcase_12 AC 23 ms
10,264 KB
testcase_13 AC 20 ms
9,640 KB
testcase_14 AC 3 ms
4,736 KB
testcase_15 AC 15 ms
8,832 KB
testcase_16 AC 15 ms
8,688 KB
testcase_17 AC 23 ms
10,164 KB
testcase_18 AC 4 ms
5,724 KB
testcase_19 AC 27 ms
10,656 KB
testcase_20 AC 24 ms
10,612 KB
testcase_21 AC 33 ms
12,268 KB
testcase_22 AC 29 ms
11,264 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 13 ms
8,164 KB
testcase_31 AC 8 ms
8,156 KB
testcase_32 AC 8 ms
8,004 KB
testcase_33 AC 9 ms
8,300 KB
testcase_34 AC 10 ms
8,308 KB
testcase_35 AC 10 ms
8,052 KB
testcase_36 AC 12 ms
8,132 KB
testcase_37 AC 10 ms
8,144 KB
testcase_38 AC 9 ms
8,164 KB
testcase_39 AC 8 ms
8,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  }
}
0