結果

問題 No.1072 A Nice XOR Pair
ユーザー tko919tko919
提出日時 2020-06-05 21:28:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 275 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 1,546 ms
コンパイル使用メモリ 172,008 KB
実行使用メモリ 18,904 KB
最終ジャッジ日時 2023-08-22 14:15:01
合計ジャッジ時間 3,453 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 225 ms
12,792 KB
testcase_08 AC 77 ms
4,376 KB
testcase_09 AC 75 ms
4,376 KB
testcase_10 AC 94 ms
4,376 KB
testcase_11 AC 166 ms
9,068 KB
testcase_12 AC 275 ms
18,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end


int main(){
   int n,x; cin>>n>>x;
   ll res=0;
   map<int,int> cnt;
   rep(i,0,n){
      int a; cin>>a;
      res+=cnt[a^x]; cnt[a]++;
   }
   cout<<res<<endl;
   return 0;
}
0