結果

問題 No.723 2つの数の和
ユーザー s_shoheis_shohei
提出日時 2020-04-16 22:48:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 301 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 83,904 KB
最終ジャッジ日時 2024-04-10 12:18:46
合計ジャッジ時間 2,493 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
52,808 KB
testcase_01 AC 31 ms
52,120 KB
testcase_02 AC 33 ms
52,800 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 57 ms
82,008 KB
testcase_14 AC 43 ms
65,776 KB
testcase_15 AC 41 ms
69,436 KB
testcase_16 AC 45 ms
73,952 KB
testcase_17 AC 51 ms
79,588 KB
testcase_18 AC 50 ms
79,300 KB
testcase_19 WA -
testcase_20 AC 30 ms
52,012 KB
testcase_21 AC 31 ms
52,756 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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(n):
    nokori = x-i
    if 0<=nokori<=mxa:
        cnt=cnts[i]*cnts[nokori]
        if nokori!=i:
            cnt*=2
        ans+=cnt
print(ans)
0