結果

問題 No.723 2つの数の和
ユーザー s_shoheis_shohei
提出日時 2020-04-16 22:51:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 83,572 KB
最終ジャッジ日時 2024-04-10 12:30:21
合計ジャッジ時間 2,375 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
54,036 KB
testcase_01 AC 36 ms
52,420 KB
testcase_02 AC 33 ms
52,108 KB
testcase_03 AC 52 ms
76,092 KB
testcase_04 AC 62 ms
81,688 KB
testcase_05 AC 56 ms
79,352 KB
testcase_06 AC 56 ms
80,548 KB
testcase_07 AC 46 ms
70,528 KB
testcase_08 AC 48 ms
71,828 KB
testcase_09 AC 58 ms
83,572 KB
testcase_10 AC 48 ms
69,084 KB
testcase_11 AC 43 ms
63,748 KB
testcase_12 AC 53 ms
72,624 KB
testcase_13 AC 58 ms
81,900 KB
testcase_14 AC 43 ms
67,056 KB
testcase_15 AC 46 ms
70,496 KB
testcase_16 AC 50 ms
74,568 KB
testcase_17 AC 53 ms
78,768 KB
testcase_18 AC 52 ms
78,492 KB
testcase_19 AC 57 ms
81,748 KB
testcase_20 AC 33 ms
52,304 KB
testcase_21 AC 35 ms
52,128 KB
testcase_22 AC 34 ms
52,944 KB
testcase_23 AC 61 ms
81,616 KB
testcase_24 AC 46 ms
68,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

mxa=max(a)
cnts=[0]*(mxa+1)

for i in range(n):
    cnts[a[i]]+=1
ans=0
for i in range(mxa+1):
    nokori = x-i
    if 0<=nokori<=mxa:
        ans+=cnts[i]*cnts[nokori]
print(ans)
0