結果

問題 No.1240 Or Sum of Xor Pair
ユーザー 👑 tatyamtatyam
提出日時 2020-08-25 13:33:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 880 bytes
コンパイル時間 5,344 ms
コンパイル使用メモリ 218,668 KB
実行使用メモリ 8,944 KB
最終ジャッジ日時 2023-09-04 14:07:14
合計ジャッジ時間 15,642 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
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")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
using namespace std;


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