Given amount of Users and their Codes. Determine which Users are Cheaters while Which are Not Cheaters.
User amount <= 10^5, Code Per User <= 10^3.
First, if Two Code from Two Different Users is same, Two Users Both are Cheaters.
Then, we Iterate All pairs of Users and Iterate All pairs of Codes. If code pair is Same, User Pair are Cheaters.
Finally, we Output Those Users who Are Cheaters.
Code is below:
codes = input ("codes")
users = input ("users")
cheaters = []
for u1 in users:
for u2 in users:
for c1 in codes:
for c2 in codes:
if c1 == c2 and u1 != u2:
cheaters.append(u1)
cheaters.append(u2)
print (cheaters)
In real Codeforces Might need to get Users and Codes from DataBase.
Tourist code matches tourist's own code. Cheater??
Oh Thanks We Need To Detect if User pairs is Not Same
If the solution is print(n), everyone has the same
If the solution is short, it's likely some people will have very similar code by coincidence
If someone just changed variable names in a big difficult code, cheating is more likely than the first case
So it's not easy to decide which are cheating. I think some pretty smart thresholds of similarity are already set up, based on different factors
Auto comment: topic has been updated by doraimota (previous revision, new revision, compare).
https://codeforces.net/blog/entry/132796