結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2020-06-05 21:50:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 104 ms / 2,000 ms |
| コード長 | 405 bytes |
| コンパイル時間 | 1,682 ms |
| コンパイル使用メモリ | 174,028 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-17 14:18:56 |
| 合計ジャッジ時間 | 2,822 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int64_t n, x;
cin >> n >> x;
vector<int64_t> as(n);
for (auto &&a : as)
{
cin >> a;
}
sort(as.begin(), as.end());
int64_t ans = 0;
for (int64_t i = 0; i < n; i++)
{
ans += distance(lower_bound(as.begin() + i + 1, as.end(), as[i] ^ x), upper_bound(as.begin() + i + 1, as.end(), as[i] ^ x));
}
cout << ans << endl;
return 0;
}
ldsyb