結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
![]() |
提出日時 | 2024-05-16 20:25:57 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 706 bytes |
コンパイル時間 | 4,431 ms |
コンパイル使用メモリ | 286,028 KB |
実行使用メモリ | 24,192 KB |
最終ジャッジ日時 | 2024-12-20 11:08:39 |
合計ジャッジ時間 | 6,851 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | AC * 4 WA * 7 |
ソースコード
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #include <atcoder/dsu> #include <atcoder/segtree> using namespace atcoder; using namespace std; typedef long long ll; #define rep(i,a,b) for(int i=a;i<b;i++) using vi = vector<int>; using vvi = vector<vi>; using li =vector<ll>; using lli=vector<li>; using si =vector<char>; using ssi =vector<si>; const long long INF = 1e18; const long long MOD=1e9+7; //for (auto [key, val] : mp) int main() { ll n,x;cin>>n>>x; //li vec(n); map<ll,ll>mp; rep(i,0,n){ll a;cin>>a;mp[a]++;} if(x==0){ll ans=0; for(auto [key,val]:mp){ ans+=val*(val-1)/2; } cout<<ans; } else {ll ans=0; for(auto [key,val]:mp){ ll y=x^key; ans+=mp[y]*(mp[y]-1)/2; } cout<<ans/2; } }