結果

問題 No.1409 Simple Math in yukicoder
ユーザー mkawa2mkawa2
提出日時 2022-10-31 17:59:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,182 bytes
コンパイル時間 1,420 ms
コンパイル使用メモリ 86,564 KB
実行使用メモリ 265,804 KB
最終ジャッジ日時 2023-09-22 14:54:11
合計ジャッジ時間 37,182 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
72,224 KB
testcase_01 AC 87 ms
71,708 KB
testcase_02 AC 91 ms
71,984 KB
testcase_03 AC 91 ms
71,712 KB
testcase_04 AC 90 ms
72,116 KB
testcase_05 WA -
testcase_06 AC 89 ms
72,360 KB
testcase_07 AC 324 ms
169,400 KB
testcase_08 AC 816 ms
204,456 KB
testcase_09 AC 307 ms
163,452 KB
testcase_10 WA -
testcase_11 AC 781 ms
202,228 KB
testcase_12 WA -
testcase_13 AC 313 ms
149,732 KB
testcase_14 AC 283 ms
148,980 KB
testcase_15 AC 368 ms
169,004 KB
testcase_16 AC 403 ms
201,704 KB
testcase_17 AC 994 ms
193,956 KB
testcase_18 AC 577 ms
161,496 KB
testcase_19 WA -
testcase_20 AC 509 ms
178,720 KB
testcase_21 AC 450 ms
189,728 KB
testcase_22 AC 718 ms
188,816 KB
testcase_23 AC 241 ms
132,456 KB
testcase_24 AC 206 ms
117,136 KB
testcase_25 WA -
testcase_26 AC 685 ms
183,840 KB
testcase_27 AC 1,076 ms
199,584 KB
testcase_28 AC 1,036 ms
208,316 KB
testcase_29 AC 1,116 ms
195,828 KB
testcase_30 AC 1,058 ms
201,528 KB
testcase_31 AC 1,121 ms
189,304 KB
testcase_32 AC 1,036 ms
199,292 KB
testcase_33 AC 1,043 ms
209,372 KB
testcase_34 AC 1,057 ms
192,908 KB
testcase_35 AC 1,093 ms
188,380 KB
testcase_36 AC 1,097 ms
200,228 KB
testcase_37 TLE -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

from random import randrange

def isroot(p, r):
    seen = [0]*p
    a = 1
    for _ in range(p-1):
        if seen[a]: return False
        seen[a] = 1
        a = a*r%p
    return True

def solve():
    v, x = LI()
    p = v*x+1
    r = 2
    while not isroot(p, r):
        r = randrange(3, p)

    a = pow(r, v, p)
    ans = [a]
    for _ in range(x-1):
        ans.append(ans[-1]*a%p)

    ans.sort()
    print(*ans)

for _ in range(II()):
    solve()
0