結果
| 問題 |
No.2961 Shiny Monster Master
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-16 15:38:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 154 ms / 1,777 ms |
| コード長 | 787 bytes |
| コンパイル時間 | 529 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 90,112 KB |
| 最終ジャッジ日時 | 2024-11-16 15:38:13 |
| 合計ジャッジ時間 | 10,879 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 77 |
ソースコード
"""input"""
#int-input
# input = sys.stdin.readline
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
#str-input
def SI(): return input()
def MSI(): return input().split()
def SI_L(): return list(SI())
def SI_LI(): return list(map(int, SI()))
#multiple-input
def LLI(n): return [LI() for _ in range(n)]
def LSI(n): return [SI() for _ in range(n)]
#1-indexを0-indexでinput
def MI_1(): return map(lambda x:int(x)-1, input().split())
def TI_1(): return tuple(MI_1())
def LI_1(): return list(MI_1())
loop,n = MI()
a = LI()
a.sort()
q = II()
from bisect import bisect
c = len(a)
for i in range(q):
l,r = MI()
l -= 1
ans = c * (r//loop) + bisect(a,r%loop)
ans -= c * (l//loop) + bisect(a,l%loop)
print(ans)