提出 #24540614


ソースコード 拡げる

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#else
    //    freopen("lupa.in","r",stdin);
    //    freopen("pupa.out","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(10);
    cout << fixed;
    int n;
    cin >> n;
    vector<ull> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    set<ull> ans;
    for (int i = 0; i < n; ++i) {
        ull x = (a[0] ^ b[i]);
        unordered_multiset<ull> st;
        for (int j = 0; j < n; ++j) {
            if (j == i) {
                continue;
            }
            st.insert(b[j]);
        }
        bool good = true;
        for (int j = 1; j < n; ++j) {
            auto it = st.find(x ^ a[j]);
            if (it == st.end()) {
                good = false;
                break;
            }
            st.erase(it);
        }
        if (good) {
            ans.insert(x);
        }
    }
//    sort(ans.begin(), ans.end());
    cout << ans.size() << "\n";
    for(ull val: ans) {
        cout << val << "\n";
    }
    return 0;
}

提出情報

提出日時
問題 B - XOR Matching 2
ユーザ Paliukh
言語 C++ (GCC 9.2.1)
得点 400
コード長 1407 Byte
結果 AC
実行時間 379 ms
メモリ 3804 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 41
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand2_01.txt, hand2_02.txt, hand2_03.txt, hand2_04.txt, hand2_05.txt, hand2_06.txt, hand2_07.txt, hand2_08.txt, hand2_09.txt, hand2_10.txt, hand3_01.txt, hand3_02.txt, hand3_03.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
hand2_01.txt AC 371 ms 3748 KiB
hand2_02.txt AC 371 ms 3776 KiB
hand2_03.txt AC 373 ms 3792 KiB
hand2_04.txt AC 369 ms 3644 KiB
hand2_05.txt AC 368 ms 3748 KiB
hand2_06.txt AC 42 ms 3560 KiB
hand2_07.txt AC 64 ms 3624 KiB
hand2_08.txt AC 102 ms 3568 KiB
hand2_09.txt AC 47 ms 3544 KiB
hand2_10.txt AC 41 ms 3556 KiB
hand3_01.txt AC 6 ms 3580 KiB
hand3_02.txt AC 26 ms 3600 KiB
hand3_03.txt AC 48 ms 3560 KiB
hand_01.txt AC 2 ms 3612 KiB
hand_02.txt AC 3 ms 3564 KiB
hand_03.txt AC 3 ms 3624 KiB
hand_04.txt AC 20 ms 3652 KiB
hand_05.txt AC 122 ms 3784 KiB
random_01.txt AC 342 ms 3712 KiB
random_02.txt AC 361 ms 3696 KiB
random_03.txt AC 371 ms 3756 KiB
random_04.txt AC 369 ms 3804 KiB
random_05.txt AC 368 ms 3736 KiB
random_06.txt AC 356 ms 3768 KiB
random_07.txt AC 327 ms 3724 KiB
random_08.txt AC 238 ms 3676 KiB
random_09.txt AC 135 ms 3700 KiB
random_10.txt AC 48 ms 3556 KiB
random_11.txt AC 331 ms 3632 KiB
random_12.txt AC 371 ms 3784 KiB
random_13.txt AC 379 ms 3748 KiB
random_14.txt AC 370 ms 3636 KiB
random_15.txt AC 375 ms 3800 KiB
random_16.txt AC 356 ms 3616 KiB
random_17.txt AC 328 ms 3768 KiB
random_18.txt AC 237 ms 3624 KiB
random_19.txt AC 137 ms 3728 KiB
random_20.txt AC 53 ms 3564 KiB
sample_01.txt AC 2 ms 3544 KiB
sample_02.txt AC 2 ms 3580 KiB
sample_03.txt AC 3 ms 3556 KiB