結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
![]() |
提出日時 | 2020-08-29 17:41:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 300 ms / 2,000 ms |
コード長 | 309 bytes |
コンパイル時間 | 1,848 ms |
コンパイル使用メモリ | 174,352 KB |
実行使用メモリ | 19,712 KB |
最終ジャッジ日時 | 2024-11-14 15:18:03 |
合計ジャッジ時間 | 3,925 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int n, x; cin >> n >> x; map<int,int> mp; vector<int> a(n); for(int i = 0; i < n; i++)cin >> a[i]; ll sum = 0; for(int i = 0; i < n; i++) { int g = x ^ a[i]; sum += mp[g]; mp[a[i]]++; } cout << sum << endl; }