timmy's blog

By timmy, 13 years ago, In English

I wonder what's happening with me last time.

Let me tell you my short story.

During the "Unknown language contest #1" I've spent too much time on solving relatively easy task (D). So, when I solved E it was about 40 seconds before the end of the contest. When I saw it, my eyes popped out and I was trying to find this file to submit. The only problem is that when you have no time, your hands don't obey. But I did it, in about last 30 seconds, yoohoo! And even system tests were passed.

During the "Codeforces Beta Round #58" my solution on task B was hacked. I was trying to find my mistakes, but.. there is no mistakes in my code! Then I understand, that "int" is too small to store values that I need. I've changed it to "long" and judje's verdict was "MLE". Ok, I killed one array. And now judje's verdict was "TLE" on the hacker's test.

And, SUDDENLY, I realized, that Java's Scanner is tooo slooooow (maybe, it's God's punishment for moving from C++) . I wrote new solution using StreamTokenizer (thanks to http://acm.timus.ru/help.aspx?topic=java). And I've submitted this task in last 6 seconds (!!!). 

It's too sad that due to lack of the time I didn't hack any Java solution.

I can't describe my feelings when submitting those tasks, I just remember that it is like... electric shock or something that I can't write here :)

p.s. Sorry for my bad english, feel free to point on my mistakes.

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

| Write comment?
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Why are you decide to move from C++ to Java?
  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Just for fun (when I decided to use Java, I didn't know this language at all). 

    And it's really fun to write in Java. Imho Java has a lot of advantages compared to C++, and it increases your productivity. Additionally, NetBeans is the best IDE I have ever used :)

13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
In this problem (B, round#58) you have to read by line - in Java BufferedReader.readLine() is fastest method for this purpose.