結果
| 問題 |
No.1240 Or Sum of Xor Pair
|
| コンテスト | |
| ユーザー |
👑 tatyam
|
| 提出日時 | 2020-08-24 21:17:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 965 bytes |
| コンパイル時間 | 4,016 ms |
| コンパイル使用メモリ | 226,876 KB |
| 最終ジャッジ日時 | 2025-01-13 13:36:13 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 3 |
| other | TLE * 30 |
ソースコード
#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 mx = 200192, w = 1 << 9;
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((a[i] ^ a[j]) < x) ans += a[i] | a[j];
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((a[i] ^ a[j]) < x) ans += a[i] | a[j];
for(uint i = 0; i < mx; i++) if(a[i] < x) ans -= ull(a[i]) * (mx - n);
cout << ans << '\n';
}
tatyam