Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя nguyenchicuong

Автор nguyenchicuong, 10 лет назад, По-английски

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

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

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 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

    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 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

thanks you, i found the errors.