結果

問題 No.2024 Xer
ユーザー ぷらぷら
提出日時 2022-07-29 21:52:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,275 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 208,860 KB
実行使用メモリ 42,992 KB
最終ジャッジ日時 2023-09-26 20:35:03
合計ジャッジ時間 12,857 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 188 ms
31,348 KB
testcase_08 AC 369 ms
31,216 KB
testcase_09 AC 593 ms
42,976 KB
testcase_10 AC 429 ms
31,344 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 235 ms
19,116 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 339 ms
25,832 KB
testcase_21 AC 595 ms
39,224 KB
testcase_22 AC 595 ms
42,992 KB
testcase_23 AC 591 ms
39,304 KB
testcase_24 AC 595 ms
39,412 KB
testcase_25 AC 5 ms
4,380 KB
testcase_26 AC 15 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 7 ms
4,380 KB
testcase_30 AC 13 ms
4,376 KB
testcase_31 AC 18 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 12 ms
4,376 KB
testcase_34 AC 5 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 11 ms
4,380 KB
testcase_37 AC 16 ms
4,380 KB
testcase_38 AC 18 ms
4,380 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 13 ms
4,380 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 479 ms
35,616 KB
testcase_46 AC 117 ms
10,744 KB
testcase_47 AC 367 ms
26,056 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int N,X;
    cin >> N >> X;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<vector<int>>tmp;
    tmp.push_back(A);
    for(int i = 29; i >= 0; i--) {
        vector<vector<int>>nxt;
        for(int j = 0; j < tmp.size(); j++) {
            vector<int>res1,res2;
            for(int k = 0; k < tmp[j].size(); k++) {
                if(1 & (tmp[j][k] >> i)) {
                    res2.push_back(tmp[j][k]);
                }
                else {
                    res1.push_back(tmp[j][k]);
                }
            }
            if(1 & (X >> i)) {
                swap(res1,res2);
            }
            if(res1.size()) {
                nxt.push_back(res1);
            }
            if(res2.size()) {
                nxt.push_back(res2);
            }
        }
        tmp = nxt;
    }
    if(tmp.size() != N) {
        cout << "No" << endl;
        return 0;
    }
    for(int i = 0; i+1 < N; i++) {
        if(tmp[i][0] >= (tmp[i+1][0]^X)) {
            cout << "No" << endl;
            return 0;
        }
        if(tmp[i+1][0] <= (tmp[i][0]^X)) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}
0