Array Filling

for input
1
10 2
9 9
6 6
the correct Answer is 87
LCM not required,once sorted

I hope this clarifies the method.

Thanks a lot sir for replying but from the problem statement

for operation 1:
except 9 all 9 holes will be filled by 9
By Operation 2:the hole 9 also filled by 6
87 will be the value
LCM not required, if sorted by xi
https://www.codechef.com/viewsolution/49890946
please provide failure case
I am using Product of y’s not LCM’s of y’s

Each testcase containing x_{i+k} being a multiple of x_i for arbitrary k should mess with your implementation.

Try for example
1
10 2
10 3
7 6
Your solution: 91
Actual solution: 84

Thank you sir

1 Like