結果

問題 No.2071 Shift and OR
ユーザー rogi52rogi52
提出日時 2022-10-16 20:54:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 770 bytes
コンパイル時間 1,970 ms
コンパイル使用メモリ 202,356 KB
実行使用メモリ 7,576 KB
最終ジャッジ日時 2023-09-09 22:19:59
合計ジャッジ時間 5,460 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,376 KB
testcase_01 AC 16 ms
4,376 KB
testcase_02 AC 24 ms
4,884 KB
testcase_03 AC 33 ms
5,336 KB
testcase_04 AC 28 ms
5,072 KB
testcase_05 AC 47 ms
6,180 KB
testcase_06 AC 29 ms
5,204 KB
testcase_07 AC 25 ms
4,940 KB
testcase_08 AC 29 ms
5,120 KB
testcase_09 AC 29 ms
5,060 KB
testcase_10 AC 29 ms
5,060 KB
testcase_11 AC 51 ms
6,496 KB
testcase_12 AC 50 ms
6,388 KB
testcase_13 AC 47 ms
6,180 KB
testcase_14 AC 7 ms
4,376 KB
testcase_15 AC 38 ms
5,648 KB
testcase_16 AC 38 ms
5,608 KB
testcase_17 AC 50 ms
6,492 KB
testcase_18 AC 16 ms
4,376 KB
testcase_19 AC 56 ms
6,660 KB
testcase_20 AC 54 ms
6,784 KB
testcase_21 AC 68 ms
7,576 KB
testcase_22 AC 60 ms
6,956 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 34 ms
5,316 KB
testcase_31 AC 33 ms
5,428 KB
testcase_32 AC 33 ms
5,384 KB
testcase_33 AC 34 ms
5,340 KB
testcase_34 AC 33 ms
5,380 KB
testcase_35 AC 34 ms
5,392 KB
testcase_36 AC 34 ms
5,604 KB
testcase_37 AC 33 ms
5,440 KB
testcase_38 AC 34 ms
5,380 KB
testcase_39 AC 34 ms
5,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    int N; cin >> N;
    if(N >= 16) {
        cout << (1 << 16) - 1 << endl;
    } else {
        vector<int> A(N);
        rep(i,N) cin >> A[i];
        int LIM = (1 << 16);
        vector<vector<int>> dp(N + 1, vector<int>(LIM, 0));
        dp[0][0] = 1;
        rep(i,N) {
            rep(x,LIM) {
                rep(_,15) {
                    dp[i + 1][x | A[i]] |= dp[i][x];
                    A[i] = (A[i] / 2) + (1 << 15) * (A[i] % 2);
                }
            }
        }
        int ans = 0;
        rep(x,LIM) if(dp[N][x]) ans = max(ans, x);
        cout << ans << endl;
    }
}
0