結果
問題 |
No.8015 アンチローリングハッシュ
|
ユーザー |
|
提出日時 | 2022-05-14 21:02:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 590 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 18,336 KB |
最終ジャッジ日時 | 2024-07-23 08:05:33 |
合計ジャッジ時間 | 9,012 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 TLE * 1 -- * 13 |
ソースコード
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, 10**6): S = [random.randint(97, 122) for _ in range(n)] S_hash = get_hash(S, a, b) for _ in range(10**6--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