結果

問題 No.989 N×Mマス計算(K以上)
ユーザー flippergoflippergo
提出日時 2020-12-25 09:53:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 89,636 KB
最終ジャッジ日時 2023-10-22 01:20:33
合計ジャッジ時間 3,317 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,548 KB
testcase_01 AC 34 ms
53,548 KB
testcase_02 AC 36 ms
53,548 KB
testcase_03 AC 35 ms
53,548 KB
testcase_04 AC 34 ms
53,548 KB
testcase_05 AC 36 ms
53,548 KB
testcase_06 AC 35 ms
53,548 KB
testcase_07 AC 34 ms
53,548 KB
testcase_08 AC 40 ms
53,548 KB
testcase_09 AC 35 ms
53,548 KB
testcase_10 AC 126 ms
83,092 KB
testcase_11 AC 117 ms
87,788 KB
testcase_12 AC 119 ms
85,872 KB
testcase_13 AC 79 ms
84,256 KB
testcase_14 AC 147 ms
89,636 KB
testcase_15 AC 98 ms
77,512 KB
testcase_16 AC 98 ms
80,880 KB
testcase_17 AC 86 ms
84,252 KB
testcase_18 AC 110 ms
77,328 KB
testcase_19 AC 116 ms
87,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
N,M,K = map(int,input().split())
B = list(input().split())
op = B.pop(0)
B = sorted(list(map(int,B)))
A = sorted([int(input()) for _ in range(N)])
if op=="+":
    cnt = 0
    for i in range(N):
        a = A[i]
        if a>=K:
            cnt += M
        else:
            ind = bisect_left(B,K-a)
            cnt += M-ind
else:
    cnt = 0
    for i in range(N):
        a = A[i]
        if a>=K:
            cnt += M
        else:
            ind = bisect_left(B,K//a+bool(K%a))
            cnt += M-ind
print(cnt)
0