結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
syunsuke
|
| 提出日時 | 2019-05-24 23:31:50 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 446 bytes |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 23,580 KB |
| 最終ジャッジ日時 | 2024-09-17 12:49:25 |
| 合計ジャッジ時間 | 3,137 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 14 |
ソースコード
import bisect
N,X=map(int,input().split())
a=list(map(int,input().split()))
c=set(a)
b=list(c)
b.sort()
#print(b)
L=[0 for i in range(len(b))]
for i in range(N):
L[bisect.bisect_left(b,a[i])]+=1
#print(L)
ans=0
ans2=0
for i in range(len(b)):
if b[i]*2==X:
ans2+=L[bisect.bisect_left(b,b[i])]
else:
if (X-b[i]) in c:
ans+=b[i]*L[bisect.bisect_left(b,X-b[i])]
print(ans//2+ans2)
#print(ans,ans2)
syunsuke