### Shameek's blog

By Shameek, 3 years ago,

how can i use codeforces api to post solutions to problems?

i cannot find this option in the api section.

i want to be able to submit slutions to any problem by including the soution in the body of the request.

• -1

By Shameek, 3 years ago,

MY APPROACH -

1. using a mergesort tree

2. find swaps decreased and increased for A[L] due to L-R

3. find swaps decreased and increased for A[R] due to L-R

complexity — Mlog^n?

my code — https://ideone.com/tgs2nU

i also tried testing my code against one of the AC codes still couldnt find my mistake. any help would be appreciated!

• -2

By Shameek, 3 years ago,

I cannot understand how to proceed with this question. Any help will be appreciated.

• 0

By Shameek, 3 years ago,

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

• +12

By Shameek, 3 years ago,

question — Kuroni and Cowsheds

can someone please explain the solution?

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

• -7

By Shameek, 3 years ago,

We can rotate a string any number of times

We need to find the minimum possible string lexicographically.

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

• 0

By Shameek, 3 years ago,

my code click here im getting runtime error (SIGSEGV) on 11th testcase..why? i have also increased the SIZE significantly as people were saying in the comment section that its more than 10^5.. i dont see a reason for long long as well in the question.. can someone please help??

• +3

By Shameek, history, 3 years ago,

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)

• 0