結果

問題 No.8015 アンチローリングハッシュ
ユーザー vwxyz
提出日時 2022-10-18 10:18:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 108,672 KB
最終ジャッジ日時 2024-06-28 19:26:42
合計ジャッジ時間 4,615 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
readline=sys.stdin.readline

A,B=map(int,readline().split())
alp=[chr(i) for i in range(97,97+26)]
S=[[] for b in range(B)]
for a in alp:
    for b in alp:
        for c in alp:
            for d in alp:
                S[(ord(a)*pow(A,3,B)%B+ord(b)*pow(A,2,B)%B+ord(c)*A%B+ord(d))%B].append(a+b+c+d)
for b in range(B):
    if len(S[b])>=2:
        print(S[b][0])
        print(S[b][1])
        exit()
0