結果

問題 No.3015 アンチローリングハッシュ
ユーザー 👑 KazunKazun
提出日時 2021-12-04 15:32:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 85,636 KB
最終ジャッジ日時 2023-09-21 03:01:04
合計ジャッジ時間 5,929 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
80,156 KB
testcase_01 AC 155 ms
80,356 KB
testcase_02 AC 149 ms
80,200 KB
testcase_03 AC 150 ms
80,220 KB
testcase_04 AC 153 ms
80,312 KB
testcase_05 AC 147 ms
80,124 KB
testcase_06 AC 151 ms
80,124 KB
testcase_07 AC 151 ms
80,168 KB
testcase_08 AC 168 ms
81,204 KB
testcase_09 AC 159 ms
81,296 KB
testcase_10 AC 187 ms
85,636 KB
testcase_11 AC 179 ms
85,316 KB
testcase_12 AC 164 ms
82,640 KB
testcase_13 AC 173 ms
84,240 KB
testcase_14 AC 160 ms
81,764 KB
testcase_15 AC 155 ms
81,168 KB
testcase_16 AC 179 ms
85,472 KB
testcase_17 AC 179 ms
84,260 KB
testcase_18 AC 151 ms
80,168 KB
testcase_19 AC 149 ms
80,436 KB
testcase_20 AC 148 ms
80,016 KB
testcase_21 AC 146 ms
80,360 KB
testcase_22 AC 147 ms
80,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def encode(S):
    X=0
    p=1
    for m in S[::-1]:
        X+=ord(m)*p; X%=b
        p*=a; p%=b
    return X

from string import ascii_lowercase as K
from itertools import product

a,b=map(int,input().split())
M={}
for S in product(K,repeat=4):
    S="".join(S)
    code=encode(S)
    if code in M:
        print(S)
        print(M[code])
        exit()
    M[code]=S
0