結果
| 問題 |
No.1240 Or Sum of Xor Pair
|
| コンテスト | |
| ユーザー |
👑 tatyam
|
| 提出日時 | 2020-08-23 21:34:13 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 991 bytes |
| コンパイル時間 | 11,953 ms |
| コンパイル使用メモリ | 276,456 KB |
| 最終ジャッジ日時 | 2025-01-13 12:55:22 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 3 |
| other | RE * 28 TLE * 2 |
ソースコード
#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';
}
tatyam