I am getting WA for Test Set 2.

I looked at other people's solutions and also generated some random cases on both the correct and my solution, but both are giving the same answer.

Can anyone tell where I am getting it wrong?

# | User | Rating |
---|---|---|

1 | Benq | 3650 |

2 | Radewoosh | 3648 |

3 | tourist | 3579 |

4 | ecnerwala | 3551 |

5 | Um_nik | 3494 |

6 | Petr | 3452 |

7 | ksun48 | 3432 |

8 | jiangly | 3349 |

9 | maroonrk | 3338 |

10 | Miracle03 | 3314 |

# | User | Contrib. |
---|---|---|

1 | 1-gon | 210 |

2 | awoo | 188 |

3 | rng_58 | 185 |

3 | Errichto | 185 |

5 | SecondThread | 182 |

6 | Ashishgup | 176 |

7 | Um_nik | 175 |

8 | maroonrk | 174 |

9 | antontrygubO_o | 170 |

10 | -is-this-fft- | 169 |

I am getting WA for Test Set 2.

I looked at other people's solutions and also generated some random cases on both the correct and my solution, but both are giving the same answer.

Can anyone tell where I am getting it wrong?

↑

↓

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/17/2021 07:38:14 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Try this:

Output should be 3. Final array: 99899 99900

Thanks for the help. I got it.

I have got this case right. Also every other case i can imagine of. Still WA on 2nd test set. I did it using long long as the data type. Could that be a problem?

I also overflowed. Since the minimal number that is larger than the last can be one digit longer, numbers can be up to 10^n = 10^100, far exceeding long long. There's a lot of ways to get around this like using strings.

The numbers can only go till 10^20 or 10^21 , in the case where all the given 100 elements are 10^9

If the list of n=100 numbers is 199, 198, ... 100, the optimal solution is 199, 1980, 19700, ... , 100...000. Where the last number has 101 zeros.

Actually an even easier case is just all numbers = 1.

No bro, if all numbers are 1

Yah you are right on your first example, sorry, thanks

codicon thanks a lot!

codicon Thanks man. Just tried using strings and it worked. Regret the fact that I knew what may have gone wrong but still didnt change it.

Alternatively, you can download test data also. They provide input and output for all test sets. And then you can compare exactly for which test case, your code is not working correctly.