結果

問題 No.1072 A Nice XOR Pair
ユーザー pionepione
提出日時 2020-06-05 23:35:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,082 bytes
コンパイル時間 3,725 ms
コンパイル使用メモリ 177,520 KB
実行使用メモリ 180,932 KB
最終ジャッジ日時 2023-08-22 18:13:15
合計ジャッジ時間 5,334 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 6 ms
4,780 KB
testcase_07 AC 943 ms
142,432 KB
testcase_08 AC 79 ms
4,568 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 629 ms
75,844 KB
testcase_12 AC 1,020 ms
180,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,x; cin>>n>>x;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  map<vll,ll> m;
  map<vll,ll> w;
  rep(i,n){
    vll b(32);
    vll c(32);
    rep(j,32){
      if((a[i]>>j)&1) b[j]=1;
      else b[j]=0;
      
      if((a[i]>>j&1) == (x>>j&1)) c[j]=0;
      else c[j]=1;
    }
    m[b]++;
    w[c]++;
  }
  
  ll ans=0;
  for(auto e: w){
    // for(auto f: e.first) cout<<f<<' ';
    // cout<<e.second<<endl;
    ans+=e.second*m[e.first];
  }
  cout<<ans/2<<endl;
}
0