結果
問題 | No.2154 あさかつの参加人数 |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:11:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 396 ms / 2,000 ms |
コード長 | 600 bytes |
コンパイル時間 | 234 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 84,700 KB |
最終ジャッジ日時 | 2025-03-20 21:12:32 |
合計ジャッジ時間 | 12,845 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
n, m = map(int, input().split())diff = [0] * (n + 2) # Using indices 1 to n+1for _ in range(m):l, r = map(int, input().split())li = lri = r# The participant contributes from ri to li days ago inclusivediff[ri] += 1if li + 1 <= n:diff[li + 1] -= 1# Compute prefix sum to get the number of participants for each daycurrent = 0ans = [0] * (n + 1) # ans[1], ans[2], ..., ans[n]for day in range(1, n + 1):current += diff[day]ans[day] = current# Output from N days ago (day n) to yesterday (day 1)for day in range(n, 0, -1):print(ans[day])