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

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

Congratulations to tourist, ksun48 and Um_nik!

Is an editorial available anywhere? I'd be interested in C and F, specifically.

Полный текст и комментарии »

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

Автор -Wave-, история, 7 лет назад, По-английски

I was considering trying to use Python on Codeforces, so I wanted to find a top rated contestant who uses Python as their main language. Turns out no red contestant uses Python as their main language. I compiled this list of who uses which language.

Not surprisingly, C++ dominates — about 95% reds use it:

C++:    262
Java:   12
Python: 3
C#:     1

Note that all three Python users were actually just messing around with the language recently, but they use C++ as their primary language. See the gist to see who uses which language + which compiler/version.

I think this is a shame, because there are many wonderful languages that simply don't get used because people fear they are slower than C++. Many problems are designed in a way that requires careful optimization even in C++ and are simply not solvable in other languages.fr

I think having execution time multiplied by a constant that differs per-language would be are a reasonable solution to penalize C++ and Java. Hackerrank already does this. If Codeforces, the most popular platform, started doing this, it could help getting the competitive programming community out of the C++ feedback loop: everybody supports C++ because everybody uses C++ because everybody supports C++.

Another way of solving the problem is to use the open-data format, which is obviously not an option for Codeforces, but Google Code Jam statistics illustrate that there is a demand for other languages as well.

Getting out of the C++ loop would help getting more people in the community because they wouldn't be forced to learn C++ (not the easiest of languages) just to stand a chance. If more people started using different languages, they would have more support, resources, tutorials etc. -- think of how every tutorial on an algorithm, technique or trick is currently written in C++. For sure having implementations of crucial algorithms in something like Python would help a lot as well, if only because of how approachable it is compared to C++.

Полный текст и комментарии »

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

Автор -Wave-, история, 8 лет назад, По-английски

If you've ever been asked about your hobbies, you probably know this problem. How does one briefly explain what competitive programming is about to a person who has never even heard about it and, worse yet, is not a programmer nor mathematician?

I've struggled with this quite a bit and I still haven't found a satisfactory answer. With a bit of Googling, I found this entertaining response, which is accurate if you already know CP, but doesn't really tell you much if you don't. On the other side, there is an analogy I tend to use — that it's like a math contest but with a computer. However, I feel like when you mention the word math, people tend to roll their eyes and stop listening, and it's not entirely accurate either: having to code your solution is very different from writing it in a math contest. When my friends read a CP task I'm working on, they often don't even know what is being asked of them (that is, to write a program which solves the problem for any input).

My working explanation, which is far from perfect, goes something like this:

"It's a bit like the Mathematical Olympiad, but with programming. You are given some tasks which tell you that you have to write a program that performs a specific task. For example, imagine you have a backpack, which has some volume. Also, you have a list of items with various volumes. Your program, given the capacity and the list, has to tell you if you can put some of the items into the backpack so that it's completely full. So you read the task, then write a program which solves it, then you submit it to an automatic system which tests it, and if it really works, you get some points."

Obviously, this is the knapsack problem, which I selected because it's quite easy to state. The downside here is that it's hard to explain the solution to somebody who has never heard about recursion or DP. Also, it doesn't tell you about time complexities (basically, that your program has to be fast). This is why I sometimes use exponentiation as an example (given N, find 3^N), because it's fairly simple to explain both the O(N) and O(log N) solutions, but it's not that straightforward for people without a math background.

What I'm looking for here are other analogies and ways of explaining competitive programming, on either end of the accuracy/entertainment spectrum (but ideally, both accurate and entertaining). The shorter, the better. Also, do you know about some example tasks which are not trivial, but easy to explain and have solutions with different complexities?

Полный текст и комментарии »

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

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

When I was reading statistics from http://www.go-hero.net/jam/15/ (great site, by the way), I noticed that sorting the countries by "Qualification round" and "Remaining" yields different results, so I wondered — what percent of participants advance per region? Per language? I wrote a little program to find out, here are the results:

Regions: http://pastebin.com/iteGLwqk

Languages: http://pastebin.com/Z6Ky63SY

Some things to note:

-There are limitations here. The number of participants is calculated as the sum of participants in 1A, 1B and 1C. However, participants could've participated in more than one of the subrounds, skewing the results.

-Language statistics are affected by the fact that go-hero counts the language even if the participant wrote just one solution in it. That leads to strange statistics — LOLCODE, for example, has a 100% advancement rate.

-Yay, Haskell!

Even though this is far from accurate, I found it interesting and I hope you will too.

Another thing that surprised me: compare the languages graph of China and United States.

Полный текст и комментарии »

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

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

I wrote a solution to 525E that works... just not on Codeforces. It produces correct output both on my machine and on Ideone, but prints something different on Codeforces.

Here is the submission: http://codeforces.me/contest/525/submission/11007405

And the Ideone test: http://ideone.com/IMONbz

My guess would be out-of-bounds memory access, but I can't find that anywhere... could somebody please help me?

Edit:

Thank you for the replies! It was indeed caused by pow. Didn't expect to it to produce floating point numbers even when fed integers. A lesson learned, I guess. Sometimes I wish for Haskell's ^ (yes, I know it's XOR in c++).

The new submission: http://codeforces.me/contest/525/submission/11008141

Полный текст и комментарии »

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

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

I don't really have this problem in Codeforces, where the rounds only last two hours, but I find that during longer contests (say, 4 hours), I tend to lose focus at the end. I start to think more about how I'm doing ("oh god, I'll never be able to solve this in time") than on solving. That means that I do almost nothing during the last hour or so.

Do you have any tips on how to work on this?

Полный текст и комментарии »

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