結果
問題 | No.3015 アンチローリングハッシュ |
ユーザー |
|
提出日時 | 2022-05-14 20:54:44 |
言語 | Python3 (3.10.1 + numpy 1.22.3 + scipy 1.8.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 586 Byte |
コンパイル時間 | 66 ms |
使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2022-05-14 20:54:51 |
合計ジャッジ時間 | 6,444 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
8,320 KB |
testcase_01 | AC | 17 ms
8,192 KB |
testcase_02 | AC | 17 ms
8,428 KB |
testcase_03 | AC | 17 ms
8,328 KB |
testcase_04 | AC | 17 ms
8,316 KB |
testcase_05 | AC | 17 ms
8,420 KB |
testcase_06 | AC | 1,388 ms
8,384 KB |
testcase_07 | AC | 114 ms
8,220 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
ソースコード
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