V--o_o--V's blog

By V--o_o--V, history, 11 months ago, translation, In English,

Remember http://codeforces.com/contest/1039/problem/B or http://codeforces.com/contest/843/problem/B and the hack fiesta with reproducing the pseudorandom sequence?

It might be the case that some of you don't want to be seed hacked. There is a post by neal about the issue. The post is well written but I strongly disagree with the solution described there.

"This should be different every run." I'm fairly sure that it indeed is (well there is still is a small probability of collision but this is kinda obvious). Because of that you are no longer able to conveniently debug you program.

You can hide that under an IFDEF and this fixes the aforementioned problem. However hiding the code under the IFDEF takes 3 lines of code and you may accidentally change something in the IFDEFed part and never notice that locally (the latter is somewhat made up). And I consider IFDEFs ugly but it is a personal thing.

Another way is to obfuscate the generation of the seed. It is definitely against the rules though. There are some grey area ones like hashing a string of tabs and spaces.

There is another way.

template <size_t S>
constexpr bool ls(const char a[S], const char b[S]) {
    for (int i = 0; i < S; ++i) {
        if (a[i] != b[i]) {
            return a[i] < b[i];
        }
    }

    return false;
}

static_assert(ls<8>(__TIME__, "18:50:00") || ls<8>("20:15:00, __TIME__)", "((");

I don't think this requires any further explanation. It does not compile between 18:50 (should be shortly after the submission) and 20:15 (should be the time you expect the contest to end). This was tried on the Educational Codeforces Round 54.

Initially the hacking attempt received something along the lines of "Invalid Verdict". Later the solution and the hacking attempt were ignored (we were deemed trolls or smth like that). However, this is somewhere in the grey area. It might be considered an attempt to destabilize the testing system but I assume that the testing system should be fine.

It is not known how will similar submissions be treated in a standard contest. While I do think that hacks are cancer and would never hack myself I understand that in almost every problem the hack is beneficial to the hacked person. Therefore I am not willing to try this code in a Div1 contest unless there is a problem with a randomized solution. However, someone might and I would be curious to see the results.

Irrelevant Fact

The actual reason for my preference of this approach to any other is because it seems like a middle finger one to a person who tries to hack the seed but without resorting to swearing. Feels good man.

Read more »

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

By V--o_o--V, 23 months ago, In English,

If you don't wanna see some butthurt, skip this post.

1 December: I open main page of codeforces to see a picture of some anime girl taking half of my 1920x1080 screen. I got disgusted back than, but hatred for anime is my personal opinion, but IMO this picture was way too big to be on the main page of CF(it was the biggest one I saw on CF, if i remember correctly).

2 December: after nice Trial Round of NEERC I was looking forward to a CF round. I was not in my hometown and had internet which was LTE, but still was kind of laggy and slow. I was checking in in the hotel at the time of start of the round.

So the round starts, problem A loads, and here we go. There is another f***g anime picture right in front of me (which loads slowly because of internet, and the statement isn't loading until the picture loads (it generally isn't that way though)). Name -> Picture -> Statement. At this point i instantly added some curse words in my template (luckily i decided not to compete, so those didn't make it in public), after that i went straight for problem E, since I couldn't code. "The statement cannot be displayed correctly". Whatever. I open problem D. Another f****g anime picture. At this pointed I decided, fudge it i'll skip this round since I didn't feel that well anyway, and had no desire to solve problems of such an author.

One more thing: gritukan is my teammate in ACM ICPC, so he saw my laptop's screen when I opened that statement, and he was really surprised. Probably he had no idea about the pictures(I don't know for sure because it's not very polite to talk to coordinator of CF about CF during the round).

To sum things up, I do believe authors should have freedom to make almost any legend within bounds, probably should have freedom to decide which tests are pretests, and maybe something else. But in my opinion, this is too much. The legends have the right to exist, cause you can skip it, the dialogs at the top of the statement have the right to exist, because you automatically skip them, without thinking. But this is way too intrusive. What next? Flashing GIFS at the top of the statement?

I would want to say, that this is not a hate post, but, unfortunately, I can't.

Read more »

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