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

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

Problem: 433B - Kuriyama Mirai's Stones

This is my solution: 11326002

I use partial sums for initial array and then for sorted. Don't understand where can be a bottleneck.

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

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

Your approach and implementation of the problem are correct but you seem to use scanner class for taking input which is slow (though i am not a regular JAVA user but that is the only fault i can find in your code) . Try to use faster I/O methods. I think it will get accepted after that because your approach and implementation are correct. For faster I/O you can refer to codes of top rated coders who use JAVA as their language.

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Oh, thank you very much. I think you are right. I even forgot about FastScanner.

»
10 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The bottleneck is quite well-known. Should not use Arrays.sort for primitive types.

http://codeforces.net/contest/433/submission/11329247