Greedy, don't know how to think about the master difficulty
Some details need to be dealt with: first, note that one line may have multiple annotations, and the original value is paid as 1 with the INC record.
Another array to save more than K (=0= just feel more convenient, anyway, weak data), for each page (anyway not more than N, who said you must have a solution, is human nature, hum), with the pointer D record printed to the first page
Finally from 1 to N sweep again, you can put it, can't put on the next page
Code
varf,t:Array[0.. the] ofLongint; D,r,k,n,all,x,y,i,j:longint; beginreadln (n,k); READLN (All); fori:=1 toN Dot[i]:=1; fori:=1 toN Dof[i]:=K; D:=1; fori:=1 toAll Do beginreadln (x, y); T[X]:=t[x]+y; End; fori:=1 toN Do begin ifF[d]>=t[i] ThenDec (f[d],t[i])Else beginInc (d); Dec (F[d],t[i]);End; End; Writeln (d); End.
Like on the collection, Vic private qq:1064864324, add me to discuss issues together, and progress
[codevs2640] Pages printed