結果

問題 No.8015 アンチローリングハッシュ
ユーザー vwxyz
提出日時 2022-10-18 10:18:25
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 448 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 226 ms
コンパイル使用メモリ 85,432 KB
実行使用メモリ 113,132 KB
最終ジャッジ日時 2026-03-17 21:24:54
合計ジャッジ時間 3,597 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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