結果
| 問題 |
No.2961 Shiny Monster Master
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-16 15:38:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 410 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 173,312 KB |
| 最終ジャッジ日時 | 2024-11-16 15:39:07 |
| 合計ジャッジ時間 | 11,571 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 76 |
ソースコード
import sys
input = sys.stdin.readline
R, 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] += 1
S = [0]
for c in cnt:
S.append(S[-1]+c)
for l, r in LR:
t = r-l+1
loop = t//R
ans = loop*S[-1]
ans += S[-1] - S[l%R]
ans += S[(r+1)%R]
print(ans)