結果

問題 No.989 N×Mマス計算(K以上)
ユーザー oshii
提出日時 2020-03-20 19:14:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 679 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 98,384 KB
最終ジャッジ日時 2024-12-14 14:44:54
合計ジャッジ時間 4,393 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import math
n, m, k = map(int, input().split())
bw = list(map(str, input().split()))
a = [int(input()) for i in range(n)]
a.sort()
op = bw.pop(0)
b = [int(i) for i in bw]
b.sort()
ans = 0
if op == "+":
	c = bisect.bisect_left(b,k)
	ans += len(b[c:])*len(a)
	for i in b[:c]:
		d = bisect.bisect_left(a,k-i)
		ans += len(a[d:])
else:
	for i in range(n):
		ans += m - bisect.bisect_left(b,math.ceil(k/a[i]))
print (ans)
0