結果

問題 No.989 N×Mマス計算(K以上)
ユーザー tanon710
提出日時 2020-02-21 01:00:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 20,952 KB
最終ジャッジ日時 2024-10-08 19:32:24
合計ジャッジ時間 2,947 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n,m,k=map(int,input().split())
tmp=list(map(str,input().split()))
op=tmp[0]
arr1=[int(tmp[i]) for i in range(1,m+1)]
arr2=[int(input()) for i in range(n)]
arr2=sorted(arr2)
ans=0
for i in range(m):
    if op=='+':
        pos=bisect.bisect_left(arr2,k-arr1[i])
        ans+=n-pos
    else:
        pos=bisect.bisect_left(arr2,(k+arr1[i]-1)//arr1[i])
        ans+=n-pos
print(ans)
0