結果

問題 No.2071 Shift and OR
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-05-08 22:27:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 778 bytes
コンパイル時間 956 ms
コンパイル使用メモリ 111,460 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-16 21:17:14
合計ジャッジ時間 7,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
8,760 KB
testcase_01 AC 16 ms
4,376 KB
testcase_02 AC 26 ms
4,376 KB
testcase_03 AC 35 ms
4,376 KB
testcase_04 AC 30 ms
4,380 KB
testcase_05 AC 49 ms
4,380 KB
testcase_06 AC 30 ms
4,376 KB
testcase_07 AC 25 ms
4,376 KB
testcase_08 AC 30 ms
4,376 KB
testcase_09 AC 30 ms
4,376 KB
testcase_10 AC 30 ms
4,376 KB
testcase_11 AC 54 ms
4,376 KB
testcase_12 AC 54 ms
4,380 KB
testcase_13 AC 49 ms
4,380 KB
testcase_14 AC 6 ms
4,376 KB
testcase_15 AC 40 ms
4,376 KB
testcase_16 AC 39 ms
4,376 KB
testcase_17 AC 54 ms
4,376 KB
testcase_18 AC 16 ms
4,376 KB
testcase_19 AC 59 ms
4,376 KB
testcase_20 AC 58 ms
4,376 KB
testcase_21 AC 73 ms
4,376 KB
testcase_22 AC 63 ms
4,376 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    int N, A, mx=1<<16, ans=0;
    cin >> N;
    if (N >= 16){
        cout << mx-1 << endl;
    }

    deque<bool> dp(mx);
    dp[0] = 1;
    for (int i=0; i<N; i++){
        cin >> A;
        deque<bool> pd(mx);
        for (int j=0; j<16; j++){
            A = A/2 + (1<<15) * (A % 2);
            for (int j=0; j<mx; j++){
                pd[j|A] |= dp[j];
            }
        }
        swap(dp, pd);
    }

    for (int i=0; i<mx; i++) if (dp[i]) ans=i;

    cout << ans << endl;

    return 0;
}
0