結果

問題 No.3015 アンチローリングハッシュ
ユーザー vwxyzvwxyz
提出日時 2022-10-18 10:18:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 882 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 50,252 KB
最終ジャッジ日時 2023-09-11 05:03:13
合計ジャッジ時間 19,812 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 661 ms
41,092 KB
testcase_01 AC 639 ms
41,352 KB
testcase_02 AC 652 ms
41,084 KB
testcase_03 AC 642 ms
41,524 KB
testcase_04 AC 643 ms
42,140 KB
testcase_05 AC 570 ms
40,828 KB
testcase_06 AC 748 ms
42,640 KB
testcase_07 AC 675 ms
41,324 KB
testcase_08 AC 805 ms
44,160 KB
testcase_09 AC 809 ms
44,204 KB
testcase_10 AC 795 ms
45,988 KB
testcase_11 AC 882 ms
50,252 KB
testcase_12 AC 816 ms
46,700 KB
testcase_13 AC 827 ms
44,196 KB
testcase_14 AC 798 ms
44,356 KB
testcase_15 AC 809 ms
43,016 KB
testcase_16 AC 814 ms
49,688 KB
testcase_17 AC 819 ms
44,856 KB
testcase_18 AC 745 ms
48,660 KB
testcase_19 AC 747 ms
48,248 KB
testcase_20 AC 809 ms
48,740 KB
testcase_21 AC 780 ms
45,612 KB
testcase_22 AC 687 ms
42,552 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