ahmed_drawy's blog

By ahmed_drawy, 3 years ago, In English

in the latest div3 contest Codeforces Round #540 (Div. 3) , in 1118D2 - Coffee and Coursework (Hard Version) i have solved the easy version using DP but i want to know can i optimize it to be 1D and solve the harder version ?? here's my submission for the easy version 50191639

my approach is for each cup (indx) we can take it and proceed to the next day or we can increase the answer and take another cup and proceed to the next day and minimize

i sorted the array in descending order to take the largest cups first because i don't have a case of not taking the cup at all

  • Vote: I like it
  • +6
  • Vote: I do not like it