結果

問題 No.723 2つの数の和
ユーザー ttrttr
提出日時 2020-02-10 19:27:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 21,748 KB
最終ジャッジ日時 2024-04-08 13:10:49
合計ジャッジ時間 2,877 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,984 KB
testcase_01 AC 32 ms
9,984 KB
testcase_02 AC 32 ms
9,984 KB
testcase_03 AC 105 ms
17,716 KB
testcase_04 AC 112 ms
21,380 KB
testcase_05 AC 97 ms
19,796 KB
testcase_06 AC 117 ms
19,816 KB
testcase_07 AC 81 ms
14,380 KB
testcase_08 AC 88 ms
15,148 KB
testcase_09 AC 109 ms
21,164 KB
testcase_10 AC 87 ms
14,360 KB
testcase_11 AC 67 ms
11,648 KB
testcase_12 AC 85 ms
16,004 KB
testcase_13 AC 91 ms
21,544 KB
testcase_14 AC 57 ms
13,312 KB
testcase_15 AC 69 ms
14,508 KB
testcase_16 AC 73 ms
17,088 KB
testcase_17 AC 85 ms
19,428 KB
testcase_18 AC 63 ms
11,972 KB
testcase_19 AC 96 ms
21,748 KB
testcase_20 AC 29 ms
9,984 KB
testcase_21 AC 30 ms
9,984 KB
testcase_22 AC 30 ms
9,984 KB
testcase_23 AC 118 ms
21,564 KB
testcase_24 AC 63 ms
13,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X = map(int, input().split())
A = [int(a) for a in input().split()]

M = max(A)+1
L = [0]*M
for a in A:
    L[a] += 1
ans = 0
for i in range(M):
    if X-i >= M or X-i < 0:
        continue
    ans += L[i]*L[X-i]
print(ans)
0