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

1 | Benq | 3783 |

2 | jiangly | 3666 |

3 | tourist | 3611 |

4 | Um_nik | 3536 |

5 | inaFSTream | 3477 |

6 | fantasy | 3468 |

7 | maroonrk | 3464 |

8 | QAQAutoMaton | 3428 |

9 | ecnerwala | 3427 |

10 | Ormlis | 3396 |

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

1 | Um_nik | 184 |

2 | adamant | 178 |

3 | awoo | 177 |

4 | nor | 169 |

5 | maroonrk | 165 |

6 | -is-this-fft- | 163 |

7 | antontrygubO_o | 152 |

7 | ko_osaga | 152 |

9 | dario2994 | 150 |

10 | SecondThread | 149 |

↑

↓

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/10/2023 21:28:56 (l1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Nobody??? Not even an opinion.....

It's proved, years don't pass along your mind :) After 3 years, you take a look at the problem again, think of it about 15 minutes, and you get a new optimization that solves it :) In this case that the longest meaningful code must be less than the length of the message :) solution

First of all, thank you kindly for source code with solution! However, I am a bit confused with 1 particular moment: why in the solution it is ok to pick n starting from m/2? How is that possible that it provides correct result if half of possible keys are ignored? Thanks in advance!

If a key of length k is valid, then that key squared (of length 2 * k) is valid too, so we only need to check key lengths that can't be squared, aka starting from m / 2.