結果

問題 No.1409 Simple Math in yukicoder
ユーザー tamatotamato
提出日時 2021-02-26 23:42:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 911 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 82,808 KB
実行使用メモリ 78,040 KB
最終ジャッジ日時 2024-04-10 14:46:13
合計ジャッジ時間 28,512 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
54,144 KB
testcase_01 AC 35 ms
54,016 KB
testcase_02 AC 37 ms
53,888 KB
testcase_03 AC 38 ms
54,272 KB
testcase_04 AC 34 ms
54,016 KB
testcase_05 AC 34 ms
54,336 KB
testcase_06 AC 36 ms
54,272 KB
testcase_07 AC 62 ms
70,400 KB
testcase_08 AC 96 ms
77,312 KB
testcase_09 AC 61 ms
70,656 KB
testcase_10 AC 95 ms
77,440 KB
testcase_11 AC 96 ms
77,440 KB
testcase_12 AC 89 ms
77,184 KB
testcase_13 AC 62 ms
70,656 KB
testcase_14 AC 58 ms
68,992 KB
testcase_15 AC 72 ms
75,532 KB
testcase_16 AC 73 ms
75,540 KB
testcase_17 AC 106 ms
77,604 KB
testcase_18 AC 86 ms
77,456 KB
testcase_19 AC 92 ms
77,172 KB
testcase_20 AC 85 ms
77,228 KB
testcase_21 AC 92 ms
77,312 KB
testcase_22 AC 101 ms
77,312 KB
testcase_23 AC 57 ms
68,608 KB
testcase_24 AC 53 ms
66,944 KB
testcase_25 AC 91 ms
77,384 KB
testcase_26 AC 92 ms
77,320 KB
testcase_27 AC 115 ms
77,696 KB
testcase_28 AC 109 ms
77,312 KB
testcase_29 AC 116 ms
77,568 KB
testcase_30 AC 112 ms
77,568 KB
testcase_31 AC 115 ms
77,568 KB
testcase_32 AC 107 ms
77,312 KB
testcase_33 AC 108 ms
77,568 KB
testcase_34 AC 107 ms
77,440 KB
testcase_35 AC 117 ms
77,440 KB
testcase_36 AC 111 ms
77,440 KB
testcase_37 AC 139 ms
77,824 KB
testcase_38 AC 145 ms
77,660 KB
testcase_39 AC 140 ms
77,800 KB
testcase_40 AC 143 ms
77,596 KB
testcase_41 AC 138 ms
77,740 KB
testcase_42 AC 142 ms
77,936 KB
testcase_43 AC 141 ms
77,824 KB
testcase_44 AC 140 ms
77,572 KB
testcase_45 AC 138 ms
77,664 KB
testcase_46 AC 142 ms
77,952 KB
testcase_47 AC 144 ms
77,824 KB
testcase_48 AC 148 ms
77,952 KB
testcase_49 AC 139 ms
77,680 KB
testcase_50 AC 146 ms
77,608 KB
testcase_51 AC 147 ms
77,760 KB
testcase_52 AC 141 ms
77,824 KB
testcase_53 AC 148 ms
77,756 KB
testcase_54 AC 148 ms
77,696 KB
testcase_55 AC 147 ms
78,040 KB
testcase_56 AC 138 ms
77,632 KB
testcase_57 AC 154 ms
77,568 KB
testcase_58 AC 153 ms
77,552 KB
testcase_59 AC 145 ms
77,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline
    from random import randint

    def primitive_root(P):
        if P == 2:
            return 1
        div = []
        for d in range(2, P+1):
            if d*d > P-1:
                break
            if (P-1) % d == 0:
                div.append(d)
                div.append((P-1) // d)
        while True:
            k = randint(2, P-1)
            ok = 1
            for d in div:
                if pow(k, d, P) == 1:
                    ok = 0
                    break
            if ok:
                return k

    for _ in range(int(input())):
        v, x = map(int, input().split())
        p = v*x+1
        r = primitive_root(p)
        ans = []
        for i in range(x):
            ans.append(pow(r, i*v, p))
        ans.sort()
        print(*ans)


if __name__ == '__main__':
    main()
0