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

Автор YahiaSherif, история, 4 года назад, По-английски

I am wondering if problem setters test their time limits with java. Doesn't seem like it. Most C++ solution today in problem E barely passed the time limit which means it's virtually impossible to accepted in java. Not the first time this has happened in a cf round. Very frustrating.

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

»
4 года назад, скрыть # |
 
Проголосовать: нравится +79 Проголосовать: не нравится

IMO languages aren't created equal and if you decide to participate with a language you must accept its ups and downs.

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

When you choose java, you make a tradeoff between performance and convenience of development. This includes competitive programming as well.

Don't whine that you couldn't get ac in some E in java. With java you can easily get AC in plenty of problems in which most other languages fail and you don't whine about it. And you know what people do when they cannot get AC in their favorite language? They switch to some other language for the specific problem they're solving

Tbh, I find this post ridiculous. And Lately I often see some ridiculous posts from people who achieved orange or red and are supposed to be very smart. Either this or complains that their 1999.9ms passed solution got TLE FST after the round or claiming that we don't need timely editorials. I just don't get it

  • »
    »
    4 года назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    IMO the convenience difference between Java and CPP is so small that it turns out to be totally subjective. It's not like Java is a super 'smart' language (such as python) that gives an unfair advantage to its competitors. In fact, the only library 'advantage' it has over CPP is the BigInteger class.

    I believe the main reason I and other people use Java, is because we are familiar with it, and adapting to another language (to a competitive level) takes practice and time. Personally, in my free time, I prefer to learn/implement new algorithms over practicing a new language.

    Also, it's not always clear whether Java will TLE for a given problem. Usually, you need to submit in order to find out and after that having to translate the code to CPP wastes time and mentality, which is indeed really frustrating. In general having an optimal solution and missing the whole problem for such a reason is always frustrating, I don't understand how you "don't get it".

    To sum up, in my opinion adding one more second to a problem that the time limit seems to be quite strict in CPP doesn't hurt in any way. It's not like O(n^2) solutions will pass when O(NlogN) is expected, and trying to cut off O(NlogN) solutions expecting O(n) complexity is pointless anyway...

    • »
      »
      »
      4 года назад, скрыть # ^ |
       
      Проголосовать: нравится +15 Проголосовать: не нравится

      If the time limit is tight there might be a reason for it. The prospect of $$$O(n^2)$$$ solutions passing where $$$O(n \log n)$$$ is expected is more likely than you seem to think, especially if such $$$O(n^2)$$$ solutions have good constant, break early etc.

    • »
      »
      »
      4 года назад, скрыть # ^ |
      Rev. 2  
      Проголосовать: нравится 0 Проголосовать: не нравится

      There is problem with java in CodeForces. Java sorting of integer array uses QuickSort — which in worst cases degrades to n^2 performance. And so perfectly valid solutions fail on slow sort. It happened with me several times ((((( C++ is lucky — their sort is more stable. I didn't investigae other languages, may be we have Java problem in other languages ??? It is inconvenient to not be able to run sort in your progrm ((((

»
4 года назад, скрыть # |
 
Проголосовать: нравится +30 Проголосовать: не нравится

Every round I was a problem author in, we made sure to write Java solutions to make sure the time limits weren’t tight for Java users. It’s not a requirement, but some contest creators are kind enough to account for Java.