結果

問題 No.2961 Shiny Monster Master
ユーザー norioc
提出日時 2024-12-30 23:27:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 690 ms
コンパイル使用メモリ 82,864 KB
実行使用メモリ 89,480 KB
最終ジャッジ日時 2024-12-30 23:27:29
合計ジャッジ時間 10,314 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 73
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right, bisect_left


def f(r):
    d, m = divmod(r, R)

    p = bisect_left(A, m+1)
    return d * N + p


def g(t):
    res = t // R * N
    t %= R
    return res + bisect_left(A, t+1)


R, N = map(int, input().split())
A = list(map(int, input().split()))

Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    ans = g(r) - g(l-1)
    print(ans)
0