結果
問題 | No.1072 A Nice XOR Pair |
ユーザー | wattaihei |
提出日時 | 2020-06-05 21:37:33 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 356 bytes |
コンパイル時間 | 626 ms |
コンパイル使用メモリ | 10,892 KB |
実行使用メモリ | 31,604 KB |
最終ジャッジ日時 | 2023-08-22 14:37:30 |
合計ジャッジ時間 | 2,350 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
8,472 KB |
testcase_01 | AC | 17 ms
8,444 KB |
testcase_02 | AC | 18 ms
8,376 KB |
testcase_03 | AC | 17 ms
8,460 KB |
testcase_04 | WA | - |
testcase_05 | AC | 17 ms
8,532 KB |
testcase_06 | AC | 19 ms
8,612 KB |
testcase_07 | AC | 242 ms
31,604 KB |
testcase_08 | AC | 104 ms
16,108 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 151 ms
20,056 KB |
testcase_12 | AC | 179 ms
31,556 KB |
ソースコード
import sys input = sys.stdin.readline from collections import Counter N, X = map(int, input().split()) A = [int(input()) for _ in range(N)] C = Counter(A) ans = 0 if X == 0: for c, num in C.items(): ans += c*(c-1)//2 else: for c, num in C.items(): b = c ^ X if b in C: ans += C[b]*num ans //= 2 print(ans)