結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
ゆにぽけ
|
| 提出日時 | 2023-10-14 17:14:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 131 ms / 2,000 ms |
| コード長 | 650 bytes |
| コンパイル時間 | 1,178 ms |
| コンパイル使用メモリ | 126,056 KB |
| 最終ジャッジ日時 | 2025-02-17 07:48:35 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<cmath>
#include<ctime>
#include<iomanip>
#include<numeric>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<random>
using namespace std;
int N,X;
void solve()
{
cin >> N >> X;
long long ans = 0;
map<int,int> mp;
for(int i = 0;i < N;i++)
{
int a;
cin >> a;
int b = a^X;
if(mp.count(b)) ans += mp[b];
mp[a]++;
}
cout << ans << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tt = 1;
//cin >> tt;
while(tt--) solve();
}
ゆにぽけ