結果

問題 No.1409 Simple Math in yukicoder
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-03-02 13:31:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 591 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 264,748 KB
最終ジャッジ日時 2024-04-14 04:35:56
合計ジャッジ時間 42,117 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
61,936 KB
testcase_01 AC 51 ms
54,816 KB
testcase_02 AC 50 ms
54,992 KB
testcase_03 AC 50 ms
54,208 KB
testcase_04 AC 50 ms
54,892 KB
testcase_05 AC 49 ms
54,400 KB
testcase_06 AC 49 ms
55,244 KB
testcase_07 AC 717 ms
151,520 KB
testcase_08 AC 1,917 ms
212,496 KB
testcase_09 AC 683 ms
166,912 KB
testcase_10 AC 1,755 ms
179,556 KB
testcase_11 AC 1,772 ms
210,464 KB
testcase_12 AC 1,647 ms
191,360 KB
testcase_13 AC 672 ms
166,256 KB
testcase_14 AC 601 ms
160,144 KB
testcase_15 AC 755 ms
163,740 KB
testcase_16 AC 957 ms
161,696 KB
testcase_17 TLE -
testcase_18 AC 1,262 ms
188,024 KB
testcase_19 AC 1,613 ms
179,948 KB
testcase_20 AC 1,147 ms
182,072 KB
testcase_21 AC 954 ms
165,788 KB
testcase_22 AC 1,632 ms
189,424 KB
testcase_23 AC 503 ms
130,376 KB
testcase_24 AC 421 ms
136,500 KB
testcase_25 AC 1,620 ms
200,640 KB
testcase_26 AC 1,836 ms
200,568 KB
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
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 #

from random import randint
def main(u,x):
  p=x*u+1
  if u==1:return list(range(1,p))
  if x==1:return [x]
  # p:prime
  # a^(p-1)=1 mod p
  # p=x*u+1
  # a^(x*u)=1 mod p
  # (a^u)^x=1 mod p

  while True:
    i=randint(2,p-1)
    s={i}
    ii=i*i%p
    while ii!=i:
      s.add(ii)
      ii=ii*i%p
    if len(s)==p-1:break
  i=pow(i,u,p)
  ary=[]
  ii=i
  for _ in range(x):
    ary.append(ii)
    ii=ii*i%p
  ary.sort()
  return ary
if __name__=='__main__':
  t=int(input())
  cases=[list(map(int,input().split())) for _ in range(t)]
  for u,x in cases:
    ret=main(u,x)
    print(*ret)
0