結果

問題 No.2071 Shift and OR
ユーザー keisuke6keisuke6
提出日時 2022-09-16 21:38:12
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 565 bytes
コンパイル時間 2,038 ms
使用メモリ 12,344 KB
最終ジャッジ日時 2023-01-11 06:13:10
合計ジャッジ時間 4,213 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 3 ms
6,948 KB
testcase_01 AC 3 ms
5,748 KB
testcase_02 AC 5 ms
6,772 KB
testcase_03 AC 11 ms
8,104 KB
testcase_04 AC 6 ms
7,576 KB
testcase_05 AC 20 ms
9,692 KB
testcase_06 AC 8 ms
7,532 KB
testcase_07 AC 5 ms
6,796 KB
testcase_08 AC 6 ms
7,596 KB
testcase_09 AC 7 ms
7,576 KB
testcase_10 AC 8 ms
7,580 KB
testcase_11 AC 23 ms
10,168 KB
testcase_12 AC 23 ms
10,224 KB
testcase_13 AC 19 ms
9,636 KB
testcase_14 AC 2 ms
6,948 KB
testcase_15 AC 15 ms
8,584 KB
testcase_16 AC 14 ms
8,580 KB
testcase_17 AC 22 ms
10,236 KB
testcase_18 AC 3 ms
5,680 KB
testcase_19 AC 27 ms
10,700 KB
testcase_20 AC 24 ms
10,700 KB
testcase_21 AC 32 ms
12,344 KB
testcase_22 AC 28 ms
11,268 KB
testcase_23 AC 2 ms
4,904 KB
testcase_24 AC 2 ms
4,900 KB
testcase_25 AC 1 ms
6,952 KB
testcase_26 AC 1 ms
6,952 KB
testcase_27 AC 1 ms
4,904 KB
testcase_28 AC 2 ms
4,900 KB
testcase_29 AC 1 ms
4,904 KB
testcase_30 AC 14 ms
8,116 KB
testcase_31 AC 8 ms
8,184 KB
testcase_32 AC 7 ms
8,064 KB
testcase_33 AC 8 ms
8,112 KB
testcase_34 AC 9 ms
8,096 KB
testcase_35 AC 10 ms
8,180 KB
testcase_36 AC 12 ms
8,116 KB
testcase_37 AC 9 ms
8,064 KB
testcase_38 AC 9 ms
8,060 KB
testcase_39 AC 8 ms
8,052 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