https://cses.fi/problemset/task/1160

can someone please help me in this question?

I am not getting any ideas as to how i should proceed...

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

1 | tourist | 3735 |

2 | MiFaFaOvO | 3681 |

3 | Um_nik | 3553 |

4 | Benq | 3376 |

5 | ecnerwala | 3295 |

6 | maroonrk | 3229 |

7 | TLE | 3223 |

8 | Radewoosh | 3216 |

9 | scott_wu | 3209 |

10 | Petr | 3205 |

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

1 | Errichto | 200 |

2 | antontrygubO_o | 191 |

3 | pikmike | 188 |

4 | Monogon | 184 |

5 | Ashishgup | 182 |

6 | vovuh | 181 |

7 | Um_nik | 179 |

8 | Radewoosh | 174 |

9 | SecondThread | 172 |

10 | McDic | 161 |

https://cses.fi/problemset/task/1160

can someone please help me in this question?

I am not getting any ideas as to how i should proceed...

question — Kuroni and Cowsheds

link to question — https://www.codechef.com/LTIME85A/problems/COWSHEDS

can someone please explain the solution?

I couldnt do better than Q*N basically go L to R + dsu

We can rotate a string any number of times

We need to find the minimum possible string lexicographically.

E.g. inp — BCABDADAB op — ABBCABDAD

This is doable by Booth's algorithm in O(n).

I couldnt quite understand the way it is being done...can someone please help?

- i cannot find my mistake
- passing for tc
- i would be glad if someone could give a tc/help me debug
- i always get stuck on convex hull questions but leave it dont want to do that this time :(
- i have tried writing my code as clean as possible with comments
- https://www.codechef.com/viewsolution/34495463 =>my solution
- https://www.codechef.com/problems/contain/ =>problem link

but that isnt my doubt

so sum of all coprime numbers with n upto n = sum of all numbers part of phi(n) = phi(n)*(n/2)

i wrote the code for it.. apparently my function where i do the above computation was erroneous..

i tried stresstesting...here is my codee

its not giving correct anwer from around 1650... can someone please help? my functionname is phifunc editorial is phi

(P.S. i know that using sieve its n loglog n but both the editorial and my solution are sqrt n to it)

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/03/2020 18:14:24 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|