結果

問題 No.723 2つの数の和
ユーザー qibqib
提出日時 2023-04-25 13:12:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 106,240 KB
最終ジャッジ日時 2024-04-26 18:52:33
合計ジャッジ時間 3,035 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,248 KB
testcase_01 AC 41 ms
53,504 KB
testcase_02 AC 43 ms
53,632 KB
testcase_03 AC 92 ms
94,976 KB
testcase_04 AC 104 ms
101,760 KB
testcase_05 AC 100 ms
101,376 KB
testcase_06 AC 100 ms
100,224 KB
testcase_07 AC 75 ms
83,072 KB
testcase_08 AC 77 ms
84,864 KB
testcase_09 AC 105 ms
103,936 KB
testcase_10 AC 71 ms
80,896 KB
testcase_11 AC 55 ms
67,328 KB
testcase_12 AC 82 ms
89,088 KB
testcase_13 AC 108 ms
106,240 KB
testcase_14 AC 64 ms
74,752 KB
testcase_15 AC 75 ms
84,352 KB
testcase_16 AC 87 ms
93,268 KB
testcase_17 AC 97 ms
100,736 KB
testcase_18 AC 64 ms
82,432 KB
testcase_19 AC 68 ms
85,376 KB
testcase_20 AC 41 ms
53,632 KB
testcase_21 AC 41 ms
53,760 KB
testcase_22 AC 40 ms
53,504 KB
testcase_23 AC 101 ms
106,112 KB
testcase_24 AC 69 ms
77,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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

cnt = defaultdict(int)
for k in a:
  cnt[k] += 1
  cnt[x - k] += 0

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

print(ans)
0