I am a Chinese. Sorry if my English has 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 may involve cheating.
Look at this hacked submission: 204925830
The source code of the defender contained a “landmine”, which means that for some corner case, the code wouldn’t be accepted, which is deliberately designed for hackers.
Following is the source code. 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 isn’t contained in test data.
Then view the hacking test.
1
xxxxxxxxxx
What a “coincidence”!
But do you think someone may deliberately leave a “landmine” for others to hack, and make himself/herself 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.
So, most likely, the hacker created an alt account, used his/her alt account to submit a “landmine code”, used his/her main account to hack it, to let his/her main account get $$$100$$$ points.
This is why I suspect that this hacking may involve cheating.
This example is just one of all. Actually I saw at least three such examples of “landmine code” hacking. I think this phenomenon should be controlled.