Svlad_Cjelli's blog

By Svlad_Cjelli, history, 22 months ago, In English

I have been trying out Rust in contests and I'm curious about other people's impressions of the language, in comparison with C++. In particular I am interested in the possibility for building higher abstractions, and for better error detection.

C++ definitely has the potential to be error-prone, but I became much more consistent with it once I started using an LSP that shows me warnings/errors as I type. That plus avoiding global variables. Now I feel like almost all of my errors are logic-based rather than due to the unsafety of the language.

Here are some of my first impressions from using Rust to solve some contest problems.

Things I enjoyed:

  • iterators, map, filter, etc. I feel like the syntax is often cleaner than C++, where I would almost always default to mutable variables instead.

  • Type inference is usually good

  • Lightweight tuple and array syntax

  • Ranges

  • "const" is default

  • Automatic error tracing when compiling in debug mode

Dislikes/annoyances:

  • Recursive functions. This is the big one. In C++, recursive lambdas (with a Y combinator) are very convenient and allow for things like DFS without passing in a million parameters (and without global variables).

  • Index has to be usize

  • Casting to and from references

  • The borrow checker doesn't seem to be that useful for contest problems

I'm interested in what else the language can offer! Looking forward for Egor to weigh in.

Full text and comments »

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

By Svlad_Cjelli, history, 4 years ago, In English

So, I got this email recently:

Attention!

Your solution 91837075 for the problem 1409E significantly coincides with solutions Svlad_Cjelli/91837075, SeismicToss/91842722. Such a coincidence is a clear rules violation. ...

The first weird thing is that it's accusing me of plagiarizing my own solution. OK, that's probably just a glitch.

But what about the other accusation? Here are the two solutions: https://codeforces.com/contest/1409/submission/91837075 https://codeforces.com/contest/1409/submission/91842722

They do have similar-looking logic. But this is a very simple problem — there aren't that many things to try. It's very natural to have a loop to find the best answer for a single interval, and then another loop to find the answer for two intervals.

I also have never used IDEOne or anything like that during a contest. I do everything locally.

So the possibilities are:

  • It's just a coincidence.
  • SeismicToss somehow hacked into my computer or the CF servers, using his master hacking skills to cheat on a Div3 contest.
  • I am a master hacker, and used my abilities to cheat on a Div3 contest by stealing a solution from the future (I'm also a time traveler in this scenario).

Keep in mind this contest wasn't rated for either of us so it would be even sillier for any of us to cheat.

Is there some way to manually review the plagiarism accusation? It doesn't seem to have any effect so far, but I don't want to get banned for a different false positive later. I am also a bit worried because there's another blog post (https://codeforces.com/blog/entry/60663) calling for a stricter plagiarism checker. I think that could be a disaster...

Full text and comments »

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