結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
![]() |
提出日時 | 2020-07-13 22:52:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 376 ms / 2,000 ms |
コード長 | 476 bytes |
コンパイル時間 | 1,931 ms |
コンパイル使用メモリ | 202,404 KB |
最終ジャッジ日時 | 2025-01-11 20:20:45 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int,int> P; constexpr int INF = 2e9; int main() { int n, x; cin >> n >> x; map<int,int> mp; vector<int> a(n); rep(i,n) cin >> a[i]; for (int i = 0; i < n; i++) { mp[a[i]]++; } ll res = 0; for (int i = 0; i < n; i++) { mp[a[i]]--; res += mp[a[i] ^ x]; } cout << res << endl; return 0; }