I was solving Labyrinth from cses. My submission was Submission, I got a wrong answer on this submssion, but I think this solution works. Please Tell me what is wrong in my solution.

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

1 | tourist | 3690 |

2 | jiangly | 3647 |

3 | Benq | 3581 |

4 | orzdevinwang | 3570 |

5 | Geothermal | 3569 |

5 | cnnfls_csy | 3569 |

7 | Radewoosh | 3509 |

8 | ecnerwala | 3486 |

9 | jqdai0815 | 3474 |

10 | gyh20 | 3447 |

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

1 | maomao90 | 172 |

2 | adamant | 164 |

3 | awoo | 163 |

4 | TheScrasse | 160 |

5 | nor | 157 |

6 | maroonrk | 155 |

7 | -is-this-fft- | 152 |

8 | Petr | 146 |

9 | orz | 145 |

9 | pajenegod | 145 |

After two years I finally reached pupil on Codeforces.

In the problem Swaps [problem:https://codeforces.com/problemset/problem/1573/B], my solution which is of O(n log n) time complexity is not working and giving a tle on test 2, when clearly the problem allows O(n log n) to pass. My solution: [submission:https://codeforces.com/contest/1573/submission/240104987]. Can somebody explain why this is happening. I know that there is a better solution in the editorial but why should this not pass?

Update: Fixed the problem :>

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/24/2024 07:45:30 (k2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|