SandorGarcia's blog

By SandorGarcia, history, 7 years ago, In English

I just started learning Ruby and while solving D div 2 of the last round 379 I've found a behavior that puzzles me. Check out this two accepted solutions:

22342957 This one was the first I submitted

22343033 This one was an attempt to optimize (wanted to check how time changed since Ruby is slow, and how much of the time consumed went on IO)

As you can see the first submission was actually the fastest, and I have no clue why, since my intuition tells me that if anything the first one checks a condition twice and should therefore be slower

Also since the difference in time was around a second, it is significant enough as to determine whether a code gets accepted or not, so I wish to learn why does this happens.

And I know Ruby is inherently slow (relative to other languages) and it is the wrong tool for most Codeforces problems. In live contest i'll keep using good old c++. So please just focus on helping me in this particular problem and not on flaming the language.

In a more concise way, why is first code faster, and why is time difference so big?

Full text and comments »

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

By SandorGarcia, history, 8 years ago, In English

The VK Cup 2016 is starting soon and I want to compete in all of it's rounds, I don't speak russian, and I'm willing to compete using statements google or yandex translated.

My main concern is: Mike (Mirzayanov) already said some of the rounds will be translated, and of course it will be a lot better to compete using correctly (by humans) translated statements, and now I wonder, if I register for official rounds like the first qualification (russian speaking people only) can I later don't participate in let's say official round 1, to compete in unofficial (yet in english) version of the round, or must I keep in the 'official' versions?

Formalizing, I want to maximize numbers of rounds where I participate, and as a tie breaker, I want to maximize the number of 'real english' rounds where I participate, then what should I do, in particular, should I compete in this qualification round??

Full text and comments »

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