| Task: | WA on Buzzwords |
| Sender: | banghalq |
| Submission time: | 2025-11-24 17:45:21 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.15 s | details |
Code
import random
import string
import sys
A = 256
B = 123456789
def F(s):
h = 0
for c in s:
h = (h * A + ord(c)) % B
return h
verif = {}
while True:
size = random.randint(4,10)
str_test = ''.join(random.choices(string.ascii_lowercase, k=size))
res = F(str_test)
if res in verif:
if str_test != verif[res] and len(str_test) == len(verif[res]):
print(str_test + ' ' + verif[res])
print(1)
print(str_test)
sys.exit()
else:
verif[res] = str_test