結果

問題 No.1072 A Nice XOR Pair
ユーザー ゆにぽけゆにぽけ
提出日時 2023-10-14 17:14:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 2,820 ms
コンパイル使用メモリ 131,560 KB
実行使用メモリ 12,804 KB
最終ジャッジ日時 2023-10-14 17:14:32
合計ジャッジ時間 3,428 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,356 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 150 ms
12,804 KB
testcase_08 AC 26 ms
4,348 KB
testcase_09 AC 25 ms
4,352 KB
testcase_10 AC 54 ms
4,352 KB
testcase_11 AC 110 ms
7,476 KB
testcase_12 AC 145 ms
12,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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();
}
0