結果

問題 No.723 2つの数の和
ユーザー はむ吉🐹はむ吉🐹
提出日時 2018-08-03 22:54:41
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 23,892 KB
最終ジャッジ日時 2023-10-19 21:34:53
合計ジャッジ時間 2,632 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,104 KB
testcase_01 AC 29 ms
10,104 KB
testcase_02 AC 30 ms
10,104 KB
testcase_03 AC 80 ms
18,616 KB
testcase_04 AC 104 ms
21,444 KB
testcase_05 AC 92 ms
19,652 KB
testcase_06 AC 99 ms
19,792 KB
testcase_07 AC 59 ms
14,984 KB
testcase_08 AC 63 ms
15,972 KB
testcase_09 AC 103 ms
21,476 KB
testcase_10 AC 56 ms
14,992 KB
testcase_11 AC 36 ms
11,352 KB
testcase_12 AC 67 ms
16,016 KB
testcase_13 AC 103 ms
21,544 KB
testcase_14 AC 45 ms
13,528 KB
testcase_15 AC 60 ms
15,200 KB
testcase_16 AC 76 ms
18,588 KB
testcase_17 AC 91 ms
20,436 KB
testcase_18 AC 66 ms
11,900 KB
testcase_19 AC 85 ms
21,628 KB
testcase_20 AC 29 ms
10,104 KB
testcase_21 AC 30 ms
10,104 KB
testcase_22 AC 30 ms
10,104 KB
testcase_23 AC 89 ms
23,892 KB
testcase_24 AC 51 ms
14,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import collections


def count_pairs(n, x, ys):
    ctr = collections.Counter(ys)
    res = sum(ctr[x - y] for y in ys)
    return res


def main():
    n, x = (int(z) for z in input().split())
    ys = [int(y) for y in input().split()]
    res = count_pairs(n, x, ys)
    print(res)


if __name__ == '__main__':
    main()
0