結果

問題 No.723 2つの数の和
ユーザー s_shohei
提出日時 2020-04-16 22:48:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 301 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,652 KB
実行使用メモリ 83,852 KB
最終ジャッジ日時 2024-10-02 14:17:41
合計ジャッジ時間 2,930 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 14
権限があれば一括ダウンロードができます

ソースコード

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