結果
問題 | No.1072 A Nice XOR Pair |
ユーザー | mikianaaa |
提出日時 | 2020-08-31 09:59:28 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 1,759 ms |
コンパイル使用メモリ | 173,068 KB |
実行使用メモリ | 14,208 KB |
最終ジャッジ日時 | 2024-04-27 14:11:32 |
合計ジャッジ時間 | 5,348 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
13,760 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 124 ms
14,208 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
ソースコード
#include <algorithm> #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define INF 1000000000000000000 typedef pair<ll, ll> pll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, X; cin >> N >> X; vector<ll> A(N); rep(i, N) { cin >> A[i]; } multiset<ll> mul; ll ans = 0; for (int i = N - 1; i > 0; i--) { mul.insert(A[i]); ll tar = A[i - 1] ^ X; ans += mul.count(tar); } cout << ans << endl; }