結果

問題 No.2071 Shift and OR
ユーザー ayataka5ayataka5
提出日時 2022-09-16 22:15:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 203,944 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-23 15:52:33
合計ジャッジ時間 3,720 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 70 ms
4,376 KB
testcase_24 AC 8 ms
4,376 KB
testcase_25 AC 33 ms
4,376 KB
testcase_26 AC 39 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 75 ms
4,380 KB
testcase_29 AC 76 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 WA -
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 WA -
testcase_38 AC 1 ms
4,376 KB
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
const ll mod = 998244353;
const ll INF = (1LL << 60);

int shift(int x) {
    return (x / 2) + (1 << 15) * (x % 2);
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    sort(A.rbegin(), A.rend());
    int ans = 0;
    for(int i = 0; i < N; i++) {
        int rev = ans;
        for(int cnt = 0; cnt <= 16; cnt++) {
            rev = max(rev, (ans | A[i]));
            A[i] = shift(A[i]);
        }
        ans = rev;
    }
    cout << ans << endl;
    return 0;
}
0