結果

問題 No.1409 Simple Math in yukicoder
ユーザー googol_S0googol_S0
提出日時 2021-02-26 22:23:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 753 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 83,884 KB
最終ジャッジ日時 2024-04-10 13:08:37
合計ジャッジ時間 49,585 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
68,968 KB
testcase_01 AC 42 ms
68,656 KB
testcase_02 AC 44 ms
67,508 KB
testcase_03 AC 42 ms
67,580 KB
testcase_04 AC 40 ms
67,484 KB
testcase_05 AC 40 ms
67,648 KB
testcase_06 AC 43 ms
67,672 KB
testcase_07 AC 146 ms
83,452 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 119 ms
83,244 KB
testcase_15 AC 166 ms
83,228 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 299 ms
83,448 KB
testcase_23 AC 111 ms
81,388 KB
testcase_24 WA -
testcase_25 AC 268 ms
83,428 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 479 ms
83,444 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 1,251 ms
83,280 KB
testcase_58 AC 1,255 ms
83,452 KB
testcase_59 AC 1,278 ms
83,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

F=[1]*100003
L=[]
for i in range(2,100001):
  if F[i]^1:
    continue
  L.append(i)
  for j in range(i*2,i,100001):
    F[j]=0
def BG(X,Y,M):
  D=dict()
  D[1]=0
  S=int(M**0.5)+1
  Z=1
  for i in range(1,S+1):
    Z=Z*X%M
    D[Z]=i
  if D.get(Y,-1)!=-1:
    if D[Y]:
      return D[Y]
  R=pow(Z,M-2,M)
  for i in range(1,S+1):
    Y=Y*R%M
    if D.get(Y,-1)!=-1:
      return D[Y]+i*S
  return -1

def solve():
  V,X=map(int,input().split())
  P=V*X+1
  Y=0
  for i in range(len(L)):
    x=BG(L[i],1,P)
    if x%X==0:
      Y=pow(L[i],x//X,P)
      break
  A=[1]
  for i in range(X-1):
    A.append(A[i]*Y%P)
  A.sort()
  for k in range(1,X+1):
    Z=0
    for i in range(X):
      Z+=pow(A[i],k,P)
  print(*A)

for i in range(int(input())):
  solve()
0