結果
| 問題 | No.1072 A Nice XOR Pair | 
| コンテスト | |
| ユーザー |  Moss_Local | 
| 提出日時 | 2022-02-13 10:07:39 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 285 ms / 2,000 ms | 
| コード長 | 1,515 bytes | 
| コンパイル時間 | 4,297 ms | 
| コンパイル使用メモリ | 256,684 KB | 
| 最終ジャッジ日時 | 2025-01-27 22:58:07 | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 11 | 
コンパイルメッセージ
main.cpp:76:9: warning: first argument of ‘int32_t main(long long int, char**)’ should be ‘int’ [-Wmain]
   76 | int32_t main(int argc, char **argv)
      |         ^~~~
            
            ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x, to) for (int x = 0; x < (to); x++)
#define REP(x, to) for (int x = 0; x < (to); x++)
#define FORR(x, arr) for (auto &x : arr)
#define FORR2(x, y, arr) for (auto &[x, y] : arr)
#define ALL(a) (a.begin()), (a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MOD 1000000007
#define INF 100000000000001
#define let auto
using i64 = long long;
using ll = long long;
;
using pll = pair<ll, ll>;
#define int long long
template <class T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b;
    return 1;
  }
  return 0;
}
void solve(void)
{
  int n, x;
  cin >> n >> x;
  vector<int> vec(n, 0);
  for (int i = 0; i < n; i++)
  {
    cin >> vec[i];
  }
  map<int, int> mp;
  for (int i = 0; i < n; i++)
  {
    mp[vec[i]]++;
  }
  int res = 0;
  for (int i = 0; i < n; i++)
  {
    int xx = vec[i];
    int yy = x ^ xx;
    res += mp[yy];
    if (xx == yy)
    {
      res--;
    }
  }
  cout << res / 2 << endl;
  return;
}
int32_t main(int argc, char **argv)
{
  string s;
  int i;
  if (argc == 1)
    ios::sync_with_stdio(false), cin.tie(0);
  FOR(i, argc - 1)
  s += argv[i + 1],
      s += '\n';
  FOR(i, s.size())
  ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
            
            
            
        