結果
問題 | No.8014 多項式ハッシュに関する教育的な問題 |
ユーザー |
![]() |
提出日時 | 2023-10-01 15:32:10 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 458 bytes |
コンパイル時間 | 1,025 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 83,456 KB |
最終ジャッジ日時 | 2024-07-26 13:28:10 |
合計ジャッジ時間 | 1,158 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 1 |
ソースコード
import stringP = int(input())B = int(input())def hash(S):res = 0for s in S:res = (res * B + s) % Preturn resD1 = {'': 0}D2 = {}def dfs(s):v = (D1[s[:-1]] + ord(s[-1])) % PD1[s] = vif v in D2:print(s)print(D2[v])exit()else:D2[v] = sif len(s) == 10**4:returnfor c in string.ascii_lowercase:dfs(s+c)for c in string.ascii_lowercase:dfs(c)