Kanao's blog

By Kanao, history, 23 months ago, In English

Can someone help me with Step-2 C: Very Easy Task

Problem Link : https://mirror.codeforces.com/edu/course/2/lesson/6/2/practice/contest/283932/problem/C

My Approach: if the task can be done in T time, then 1(good) else 0 (bad). So, making 1 copy of the original document will take min(x,y) time, and then both copy machines can simultaneously work.

we need to check whether n copies can be made in T time or not, if I am updating T1 = T-min(x,y) and then checking that can I make n-1 copies in T1 time. Then find the first occurrence of 1 using binary search. It is throwing me an error "Wrong Answer on test case 5"

Code

Actual Approach : we need to check whether n-1 copies can be made in T time or not. Then, by using binary search find the first occurrence of 1 as it will be the least time to make n-1 copies, and then adding min(x,y) as it will be the time to make the copy of original.

AC Code

I dont know, where am I making mistake, both logics seems similar to me.

  • Vote: I like it
  • -4
  • Vote: I do not like it

| Write comment?