結果
問題 | No.2961 Shiny Monster Master |
ユーザー |
|
提出日時 | 2024-11-16 15:46:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 172 ms / 1,777 ms |
コード長 | 405 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 173,440 KB |
最終ジャッジ日時 | 2024-11-16 15:46:25 |
合計ジャッジ時間 | 10,924 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 77 |
ソースコード
import sysinput = sys.stdin.readlineR, N = map(int, input().split())A = list(map(int, input().split()))Q = int(input())LR = [list(map(int, input().split())) for _ in range(Q)]cnt = [0 for _ in range(R)]for a in A:cnt[a] += 1S = [0]for c in cnt:S.append(S[-1]+c)for l, r in LR:rcnt = ((r+1)//R)*S[-1] + S[(r+1)%R]lcnt = (l//R)*S[-1] + S[l%R]ans = rcnt-lcntprint(ans)