結果

問題 No.1072 A Nice XOR Pair
ユーザー 6soukiti296soukiti29
提出日時 2020-06-09 01:55:11
言語 Nim
(2.0.2)
結果
RE  
実行時間 -
コード長 488 bytes
コンパイル時間 4,872 ms
コンパイル使用メモリ 68,768 KB
実行使用メモリ 10,412 KB
最終ジャッジ日時 2023-08-28 09:53:57
合計ジャッジ時間 7,210 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 RE -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 93 ms
7,708 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils,algorithm
var
    N, X : int64
    A : seq[int64]
    B : seq[int64]
    ans : int
    f :array[100010, int]

(N, X) = stdin.readline.split.map(parseBiggestInt)

for i in 1..N:
    A.add(stdin.readline.parseBiggestInt)

A.sort(cmp)

for a in A:
    if B.len == 0 or B[^1] != a:
         B.add(a)
    f[B.high] += 1
for i,a in B:
    var k : int64 = (X xor a)
    var j = B.lowerbound(k)

    if B[j] != k:
        continue
    ans += f[j] * f[i]

echo (ans div 2)
0