Zaoly's blog

By Zaoly, history, 16 months ago, In English

I’m Chinese. Sorry if my English had some grammar mistakes.


In a recent contest: Codeforces Round 871 (Div. 4), I saw a “Successful hacking attempt” in the “Hacks” list. But I think this hacking might involve cheating.

Look at this hacked submission: 204925830.

The source code of the defender contained a “landmine”, which means that for some corner case (unlikely contained in test data), the code wouldn’t be accepted, which was intentionally designed for hackers.

Following was the source code (GNU C++14). Note the corner case in the code that would make it wrong.


#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

string s1,s2;
int t;

int main(){
	scanf("%d",&t);
	s1 = "codeforces";
	int ans;
	while(t --){
		cin >> s2;
		if(s2 == "xxxxxxxxxx"){ // Here! The corner case
			puts("-1"); // Wrong output
			return 0;
		}
		ans = 0;
		for(unsigned int i = 0 ; i < s1.size() ; ++i){
			if(s1[i] != s2[i])
				++ans;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Therefore, for the case “xxxxxxxxxx”, the code would definitely get “Wrong answer”. Unluckily (or luckily, for the hacker), this corner case wasn’t contained in test data.

Then view the hacking test.


1
xxxxxxxxxx

What a “coincidence”!

But do you think someone may intentionally leave a “landmine” for others to hack, and give himself/herself a chance to lose $$$50$$$ points? Anyone knows it’s impossible.

And see the rating of the defender: Newbie. I’m not discriminating against Newbies (since so am I), but this is one of the typical features of an alt account. In addition, he/she participated in few contests so far.

So, most likely, the contestant created an alt account, used his/her alt account to submit a “landmine code”, used his/her main account to hack it, to let the main account get extra $$$100$$$ points. Or maybe, it’s his/her friend, not his/her alt account. But that doesn’t matter.

This is why I suspect that this hacking may involve cheating.


I’m not targeting any user. This example is just one of all. Actually I saw at least three such examples of “landmine code” hackings only in this contest (where some of the defenders are even Unrated).

Cheating is shameful, but a flawed rule may also become a breeding ground for cheating behaviors. I think this phenomenon should be controlled.

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

»
16 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Zaoly (previous revision, new revision, compare).

»
16 months ago, # |
Rev. 2   Vote: I like it +28 Vote: I do not like it

But hacker don't gain anything from a 12-hour hacking phase in Div. 3, Div. 4 or Educational rounds

UPD: "_But do you think someone may intentionally leave a “landmine” for others to hack, and give himself/herself a chance to lose 50 50 points? Anyone knows it’s impossible._" What you've mentioned is only true in Div. 2 or Div. 1 rounds (which has no hacking phase). In those rounds, participants are divided into rooms. The possibility for his two account appear in the same room is very low.

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The only reasons I can think of is that:

    A. they didn't know that

    B. they want negative delta, either to be rated in an upcoming div3/div4 contest they would otherwise be out of competition in, or they want negative rating for the lols of it.

»
16 months ago, # |
  Vote: I like it -8 Vote: I do not like it

Nice