結果

問題 No.1072 A Nice XOR Pair
ユーザー ats5515ats5515
提出日時 2020-06-05 23:07:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 347 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 2,978 ms
コンパイル使用メモリ 153,928 KB
実行使用メモリ 25,152 KB
最終ジャッジ日時 2023-08-22 17:17:48
合計ジャッジ時間 3,594 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 302 ms
16,980 KB
testcase_08 AC 30 ms
4,640 KB
testcase_09 AC 27 ms
4,524 KB
testcase_10 AC 52 ms
4,600 KB
testcase_11 AC 194 ms
12,484 KB
testcase_12 AC 347 ms
25,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, X;
	cin >> N >> X;
	vector<int> A(N);
	map<int, int> mp;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		mp[A[i]]++;
	}
	int res = 0;
	for (int i = 0; i < N; i++) {
		res += mp[A[i] ^ X];
	}
	if (X == 0) res -= N;
	res /= 2;
	cout << res << endl;
}
0