結果

問題 No.723 2つの数の和
ユーザー dangodango
提出日時 2023-06-16 19:23:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 105,820 KB
最終ジャッジ日時 2023-09-06 16:53:47
合計ジャッジ時間 4,860 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
76,936 KB
testcase_01 AC 97 ms
76,996 KB
testcase_02 AC 102 ms
76,884 KB
testcase_03 AC 132 ms
93,676 KB
testcase_04 AC 146 ms
100,224 KB
testcase_05 AC 140 ms
98,520 KB
testcase_06 AC 135 ms
98,548 KB
testcase_07 AC 118 ms
85,012 KB
testcase_08 AC 122 ms
86,248 KB
testcase_09 AC 143 ms
100,496 KB
testcase_10 AC 123 ms
84,532 KB
testcase_11 AC 109 ms
77,840 KB
testcase_12 AC 129 ms
88,672 KB
testcase_13 AC 137 ms
100,540 KB
testcase_14 AC 111 ms
81,056 KB
testcase_15 AC 117 ms
85,648 KB
testcase_16 AC 127 ms
92,548 KB
testcase_17 AC 139 ms
97,480 KB
testcase_18 AC 121 ms
89,960 KB
testcase_19 AC 125 ms
91,576 KB
testcase_20 AC 101 ms
76,836 KB
testcase_21 AC 102 ms
76,896 KB
testcase_22 AC 103 ms
76,772 KB
testcase_23 AC 135 ms
105,820 KB
testcase_24 AC 119 ms
82,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N, X = map(int,input().split())
A = list(map(int,input().split()))
C = collections.Counter(A)
ans = 0
for i in range(10 ** 5 + 1):
    if X == 2 * i:
        ans += C[i] ** 2
    else:
        ans += C[i]* C[X - i]
print(ans)
0