https://atcoder.jp/contests/past202004-open/tasks/past202004_f
I am trying to solve the following problem:
We have $N$ tasks. Let today be Day $1$. You can do the $i$-th task on or after Day $A_i$, and finishing the task gives you $B_i$ points.
Each day, starting with today, you choose one task and finish it. For each integer $k$ from $1$ through $N$, find the maximum total number of points that can be earned in the $k$ days starting with today.
It is guaranteed that there are at least $k$ tasks that you can do in the first $k$ days for each integer $k$ from $1$ through $N$.
I know we can solve this problem by a greedy algorithm.
But why can we solve this problem by a greedy algorithm?