結果
問題 | No.2961 Shiny Monster Master |
ユーザー |
|
提出日時 | 2024-11-16 15:51:44 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 411 ms / 1,777 ms |
コード長 | 705 bytes |
コンパイル時間 | 818 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 94,672 KB |
最終ジャッジ日時 | 2024-11-16 15:52:12 |
合計ジャッジ時間 | 19,031 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 77 |
ソースコード
from collections import deque, defaultdict as ddfrom random import randintfrom copy import deepcopyfrom heapq import heappop, heappush, heappushpop, heapifyINF = 1 << 60MOD = 1000000007xor = randint(100, INF)def main():r, n = map(int, input().split())a = list(map(int, input().split()))ac = [0]*(2*r+1)for v in a:ac[v+1] += 1ac[v+r+1] += 1for i in range(2*r):ac[i+1] += ac[i]q = int(input())for _ in range(q):x, y = map(int, input().split())ans = ((y-x)//r)*nx %= ry %= rif x > y:y += rans += ac[y+1]-ac[x]print(ans)if __name__ == "__main__":main()