結果

問題 No.723 2つの数の和
ユーザー ntudantuda
提出日時 2023-12-30 22:16:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 272 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 117,992 KB
最終ジャッジ日時 2023-12-30 22:16:10
合計ジャッジ時間 3,726 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,460 KB
testcase_01 AC 42 ms
53,460 KB
testcase_02 AC 41 ms
53,460 KB
testcase_03 AC 94 ms
92,892 KB
testcase_04 AC 131 ms
106,712 KB
testcase_05 AC 135 ms
111,644 KB
testcase_06 AC 100 ms
97,036 KB
testcase_07 AC 77 ms
82,380 KB
testcase_08 AC 81 ms
85,332 KB
testcase_09 AC 98 ms
97,840 KB
testcase_10 AC 100 ms
94,728 KB
testcase_11 AC 67 ms
76,548 KB
testcase_12 AC 81 ms
88,084 KB
testcase_13 AC 84 ms
95,112 KB
testcase_14 AC 55 ms
69,848 KB
testcase_15 AC 62 ms
76,832 KB
testcase_16 AC 72 ms
85,148 KB
testcase_17 AC 78 ms
90,172 KB
testcase_18 AC 63 ms
80,820 KB
testcase_19 AC 108 ms
117,992 KB
testcase_20 AC 41 ms
53,460 KB
testcase_21 AC 42 ms
53,460 KB
testcase_22 AC 42 ms
53,460 KB
testcase_23 AC 85 ms
100,680 KB
testcase_24 AC 104 ms
103,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X = map(int, input().split())
A = list(map(int, input().split()))
from collections import defaultdict
dic = defaultdict(int)
for a in A:
    dic[a] += 1

if X > 2 * 10 ** 5:
    print(0)
    exit()
ans = 0
for i in range(X+1):
    ans += dic[i] * dic[X-i]

print(ans)

0