how to solve this problem ?1265B - Beautiful Numbers

here is my submission in python 82612211

ok sorry for the joke if you don't find it funny.

but seriously i am not able to understand the idea of the editorial. please help me in this problem.

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

1 | Benq | 3797 |

2 | tourist | 3723 |

3 | Radewoosh | 3720 |

4 | ecnerwala | 3579 |

5 | ksun48 | 3463 |

6 | Um_nik | 3457 |

7 | maroonrk | 3446 |

8 | jiangly | 3432 |

9 | Petr | 3370 |

10 | scott_wu | 3350 |

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

1 | 1-gon | 208 |

2 | awoo | 184 |

2 | rng_58 | 184 |

4 | Errichto | 182 |

5 | SecondThread | 177 |

6 | maroonrk | 176 |

6 | Radewoosh | 176 |

6 | -is-this-fft- | 176 |

9 | Um_nik | 173 |

10 | antontrygubO_o | 169 |

how to solve this problem ?1265B - Beautiful Numbers

here is my submission in python 82612211

ok sorry for the joke if you don't find it funny.

but seriously i am not able to understand the idea of the editorial. please help me in this problem.

↑

↓

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/22/2021 07:00:43 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Auto comment: topic has been updated by Mango-man (previous revision, new revision, compare).This is how I solved this problem: I was iterating from 1 to n. Let l is the leftmost position of all number from 1 to i, and r — the rightmost one. Then i is a good number if and only if (r — l + 1) == i. Do you need a proof of that?

sorry i doesn't understand can you elaborate more deeply.

looks like you are using same formula which is describe in editorial.

and also thanks for the replying on my blog