結果

問題 No.2071 Shift and OR
ユーザー asaringoasaringo
提出日時 2022-09-16 22:02:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,177 bytes
コンパイル時間 1,910 ms
コンパイル使用メモリ 198,424 KB
実行使用メモリ 6,112 KB
最終ジャッジ日時 2023-08-23 15:33:49
合計ジャッジ時間 3,823 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 7 ms
4,380 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 13 ms
5,784 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 14 ms
5,932 KB
testcase_12 AC 14 ms
6,056 KB
testcase_13 AC 12 ms
5,784 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 9 ms
5,996 KB
testcase_16 AC 9 ms
5,800 KB
testcase_17 AC 14 ms
5,800 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 17 ms
5,824 KB
testcase_20 AC 15 ms
5,800 KB
testcase_21 AC 20 ms
5,820 KB
testcase_22 AC 18 ms
6,112 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 7 ms
4,376 KB
testcase_31 AC 4 ms
4,380 KB
testcase_32 AC 5 ms
4,376 KB
testcase_33 AC 5 ms
4,376 KB
testcase_34 AC 5 ms
4,376 KB
testcase_35 AC 6 ms
4,380 KB
testcase_36 AC 8 ms
4,376 KB
testcase_37 AC 5 ms
4,380 KB
testcase_38 AC 5 ms
4,380 KB
testcase_39 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
#define fast_input_output ios::sync_with_stdio(false); cin.tie(nullptr);
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"

int n ;
int A[202020];
bool dp[18][1 << 18] ;

int main(){
    // fast_input_output
    cin >> n ;
    rep(i,n) cin >> A[i];
    if(n > 16) {
        cout << (1LL << 17) - 1 << endl;
        return 0;
    }
    dp[0][0] = true;
    rep(i,n){
        int a = A[i];
        rep(S,1<<16){
            if(!dp[i][S]) continue;
            rep(j,20){
                dp[i+1][S | a] = true;
                if(a & 1){
                    a /= 2;
                    a += 1 << 15;
                }
                else{
                    a /= 2;
                }
            }
        }
    }
    int res = 0;
    rep(S,1<<17) if(dp[n][S]) res = S;
    cout << res << endl;
}
0