Rescheduling the Exam solution codeforces – The session starts on day 11 and lasts dd days. The iith exam will take place on the day of aiai (1≤ai≤n1≤ai≤n)

Rescheduling the Exam solution codeforces Now Dmitry has a session, and he has to pass nn exams. The session starts on day 11 and lasts dd days. The iith exam will take place on the day of aiai (1≤ai≤n1≤ai≤n), all aiai — are different. Sample, where n=3n=3, d=12d=12, a=[3,5,9]a=[3,5,9]. Orange — exam days. Before the first exam Dmitry will rest 22 days, before the second he will rest 11 day and before the third … Read more