結果

問題 No.1240 Or Sum of Xor Pair
ユーザー 👑 tatyamtatyam
提出日時 2020-08-23 21:34:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 991 bytes
コンパイル時間 3,609 ms
コンパイル使用メモリ 218,940 KB
実行使用メモリ 12,020 KB
最終ジャッジ日時 2023-09-04 07:48:27
合計ジャッジ時間 10,018 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
using uint = uint32_t;
using ull = uint64_t;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const uint w = 1 << 9, mx = (200000 + w - 1) / w;
    uint a[mx] = {};
    uint n, x;
    cin >> n >> x;
    for(uint i = 0; i < n; i++) cin >> a[i];
    ull ans = 0;
    for(uint ib = 0; ib < mx; ib += w) for(uint jb = ib + w; jb < mx; jb += w)
        for(uint i = ib; i < ib + w; i++) for(uint j = jb; j < jb + w; j++)
            if(const uint b = a[i] ^ a[j]; b < x) ans += b;
    for(uint ib = 0; ib < mx; ib += w)
        for(uint i = ib; i < ib + w; i++) for(uint j = i + 1; j < ib + w; j++)
            if(const uint b = a[i] ^ a[j]; b < x) ans += b;
    for(uint i = 0; i < mx; i++) if(a[i] < x) ans -= ull(a[i]) * (mx - n);
    cout << ans << '\n';
}
0