nguyenchicuong's blog

By nguyenchicuong, 10 years ago, In English

Hello everybody.

I have no idea to improve my code for this problem to increase speed. Can you help me?

This is my submission: 9235975

Thanks for reading :D

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
10 years ago, # |
Rev. 3   Vote: I like it +1 Vote: I do not like it

I think one of these advices will help you:
1. Replace: cin/cout -> scanf/printf.
2. Add line "ios_base::sync_with_stdio(0);" at the beggining of your code and replace all scanf/printf to cin/cout

  • »
    »
    10 years ago, # ^ |
    Rev. 2   Vote: I like it +3 Vote: I do not like it

    Thank your tips, but i think cin is need replace to scanf, cout is unnecessary beacause the result is a string with length 2*n-2 ( it's small to affect the excution time ). :D

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I advise you to not use cin and scanf in one code, because it will work slowly

»
10 years ago, # |
  Vote: I like it +3 Vote: I do not like it

thanks you, i found the errors.