結果
| 問題 | No.2961 Shiny Monster Master |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-18 22:04:04 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 1,777 ms |
| コード長 | 409 bytes |
| 記録 | |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 96,384 KB |
| 最終ジャッジ日時 | 2026-05-11 20:24:29 |
| 合計ジャッジ時間 | 7,263 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 77 |
ソースコード
import bisect
R,N=list(map(int,input().split()))
A=list(map(int,input().split()))
A=sorted(A)
Q=int(input())
for i in range(Q):
l,r=list(map(int,input().split()))
if l//R==r//R:
cl=bisect.bisect_left(A,l%R)
cr=bisect.bisect_right(A,r%R)
print(cr-cl)
else:
ans=((r//R)-(l//R)-1)*N
cl=bisect.bisect_left(A,l%R)
cr=bisect.bisect_right(A,r%R)
ans=ans+cr+(N-cl)
print(ans)