結果

問題 No.723 2つの数の和
ユーザー yakeshibayakeshiba
提出日時 2021-06-09 00:08:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 258 bytes
コンパイル時間 1,862 ms
コンパイル使用メモリ 86,512 KB
実行使用メモリ 105,740 KB
最終ジャッジ日時 2023-08-18 04:49:47
合計ジャッジ時間 4,850 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
71,732 KB
testcase_01 AC 96 ms
71,608 KB
testcase_02 AC 96 ms
71,320 KB
testcase_03 AC 137 ms
93,636 KB
testcase_04 AC 143 ms
100,408 KB
testcase_05 AC 140 ms
98,452 KB
testcase_06 AC 142 ms
98,656 KB
testcase_07 AC 121 ms
85,188 KB
testcase_08 AC 122 ms
86,604 KB
testcase_09 AC 146 ms
100,452 KB
testcase_10 AC 122 ms
84,800 KB
testcase_11 AC 111 ms
77,980 KB
testcase_12 AC 127 ms
88,716 KB
testcase_13 AC 145 ms
100,332 KB
testcase_14 AC 112 ms
81,096 KB
testcase_15 AC 119 ms
85,572 KB
testcase_16 AC 131 ms
92,436 KB
testcase_17 AC 139 ms
97,368 KB
testcase_18 AC 118 ms
89,472 KB
testcase_19 AC 122 ms
91,328 KB
testcase_20 AC 99 ms
71,472 KB
testcase_21 AC 98 ms
71,468 KB
testcase_22 AC 98 ms
71,732 KB
testcase_23 AC 139 ms
105,740 KB
testcase_24 AC 120 ms
82,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

n, x = map(int,input().split())
A = list(map(int,input().split()))

cnt = Counter(A)

ans = 0
for k, v in cnt.items():
    if k == x-k:
        ans += v*v
        continue
    if cnt[x-k]:
        ans += v*cnt[x-k]
print(ans)
0