結果

問題 No.2961 Shiny Monster Master
ユーザー cologne
提出日時 2025-04-28 13:14:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 1,777 ms
コード長 501 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 82,608 KB
実行使用メモリ 92,744 KB
最終ジャッジ日時 2025-04-28 13:14:22
合計ジャッジ時間 12,027 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 77
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right
from collections import defaultdict
import math
import sys


def input():
    return sys.stdin.readline().strip()


def main():
    rr, n = map(int, input().split())
    (*a,) = map(int, input().split())
    a.sort()
    q = int(input())

    def calc(x):
        return x // rr * len(a) + bisect_right(a, x % rr)

    for i in range(q):
        l, r = map(int, input().split())
        print(calc(r) - calc(l - 1))


if __name__ == "__main__":
    main()
0