結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,248 KB
testcase_01 AC 42 ms
53,248 KB
testcase_02 AC 43 ms
53,248 KB
testcase_03 AC 100 ms
93,952 KB
testcase_04 AC 107 ms
101,628 KB
testcase_05 AC 101 ms
100,736 KB
testcase_06 AC 103 ms
100,352 KB
testcase_07 AC 78 ms
82,432 KB
testcase_08 AC 84 ms
84,352 KB
testcase_09 AC 110 ms
104,064 KB
testcase_10 AC 74 ms
80,384 KB
testcase_11 AC 61 ms
67,328 KB
testcase_12 AC 91 ms
88,832 KB
testcase_13 AC 110 ms
105,856 KB
testcase_14 AC 66 ms
74,496 KB
testcase_15 AC 81 ms
83,968 KB
testcase_16 AC 93 ms
93,056 KB
testcase_17 AC 96 ms
100,480 KB
testcase_18 AC 67 ms
82,048 KB
testcase_19 AC 75 ms
85,248 KB
testcase_20 AC 43 ms
53,248 KB
testcase_21 AC 43 ms
53,120 KB
testcase_22 AC 43 ms
53,248 KB
testcase_23 AC 109 ms
105,856 KB
testcase_24 AC 70 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