結果

問題 No.3015 アンチローリングハッシュ
ユーザー vwxyzvwxyz
提出日時 2022-10-18 10:18:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 560 ms
コンパイル使用メモリ 87,316 KB
実行使用メモリ 115,200 KB
最終ジャッジ日時 2023-09-11 05:02:53
合計ジャッジ時間 7,640 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 205 ms
107,884 KB
testcase_01 AC 233 ms
115,200 KB
testcase_02 AC 199 ms
104,968 KB
testcase_03 AC 225 ms
105,544 KB
testcase_04 AC 214 ms
96,992 KB
testcase_05 AC 197 ms
102,288 KB
testcase_06 AC 219 ms
91,852 KB
testcase_07 AC 203 ms
90,124 KB
testcase_08 AC 229 ms
92,452 KB
testcase_09 AC 238 ms
97,864 KB
testcase_10 AC 252 ms
100,512 KB
testcase_11 AC 247 ms
102,128 KB
testcase_12 AC 258 ms
99,876 KB
testcase_13 AC 241 ms
98,712 KB
testcase_14 AC 246 ms
96,744 KB
testcase_15 AC 217 ms
91,660 KB
testcase_16 AC 254 ms
101,936 KB
testcase_17 AC 252 ms
99,788 KB
testcase_18 AC 216 ms
98,516 KB
testcase_19 AC 218 ms
95,448 KB
testcase_20 AC 213 ms
94,736 KB
testcase_21 AC 226 ms
99,088 KB
testcase_22 AC 217 ms
97,632 KB
権限があれば一括ダウンロードができます

ソースコード

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