結果
問題 | No.2961 Shiny Monster Master |
ユーザー |
![]() |
提出日時 | 2024-11-16 15:38:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 151 ms / 1,777 ms |
コード長 | 440 bytes |
コンパイル時間 | 441 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 91,136 KB |
最終ジャッジ日時 | 2024-11-16 15:38:55 |
合計ジャッジ時間 | 10,594 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 77 |
ソースコード
from bisect import bisect_left, bisect_right X, N = map(int, input().split()) A = sorted(list(map(int, input().split()))) Q = int(input()) LR = [list(map(int, input().split())) for _ in range(Q)] for L, R in LR: if L//X == R//X: print(bisect_right(A, R%X)-bisect_left(A, L%X)) else: ans = (N-bisect_left(A, L%X))+bisect_right(A, R%X) if R//X-L//X >= 2: ans += N*(R//X-L//X-1) print(ans)