dev_il's blog

By dev_il, 11 years ago, In English

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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
11 years ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

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.

  • »
    »
    11 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

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

»
11 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

http://mirror.codeforces.com/contest/433/submission/11329247