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