結果
問題 |
No.8015 アンチローリングハッシュ
|
ユーザー |
|
提出日時 | 2022-05-14 20:59:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 581 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-07-23 08:01:01 |
合計ジャッジ時間 | 5,901 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 WA * 1 |
ソースコード
import random a,b = map(int, input().split()) def get_hash(s, a, b): h = 0 for i in range(len(s)): h = (h * a + s[i]) % b return h for n in range(1, b): S = [random.randint(97, 122) for _ in range(n)] S_hash = get_hash(S, a, b) for _ in range(b-n): T = [random.randint(97, 122) for _ in range(n)] if S_hash == get_hash(T, a, b) and S != T: ss = [chr(s) for s in S] print(''.join(ss)) tt = [chr(t) for t in T] print(''.join(tt)) break else: continue break