結果

問題 No.1498 Factorization from -1 to 1
ユーザー convexineqconvexineq
提出日時 2021-05-07 19:26:11
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 406 ms / 3,000 ms
コード長 315 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 114,228 KB
最終ジャッジ日時 2023-10-13 10:30:58
合計ジャッジ時間 10,568 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 225 ms
95,272 KB
testcase_01 AC 216 ms
95,312 KB
testcase_02 AC 218 ms
95,140 KB
testcase_03 AC 270 ms
114,228 KB
testcase_04 AC 334 ms
112,928 KB
testcase_05 AC 380 ms
113,060 KB
testcase_06 AC 375 ms
113,124 KB
testcase_07 AC 400 ms
113,048 KB
testcase_08 AC 406 ms
113,704 KB
testcase_09 AC 398 ms
113,264 KB
testcase_10 AC 247 ms
95,580 KB
testcase_11 AC 239 ms
95,784 KB
testcase_12 AC 239 ms
95,764 KB
testcase_13 AC 251 ms
95,880 KB
testcase_14 AC 255 ms
95,688 KB
testcase_15 AC 222 ms
95,276 KB
testcase_16 AC 225 ms
95,172 KB
testcase_17 AC 221 ms
95,396 KB
testcase_18 AC 223 ms
95,164 KB
testcase_19 AC 219 ms
95,276 KB
testcase_20 AC 220 ms
95,284 KB
testcase_21 AC 218 ms
95,184 KB
testcase_22 AC 219 ms
95,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

R = list(range(1<<17))
v = [i*i+1 for i in R]
lst = [[] for _ in R]
for i in R:
    p = v[i]
    if p == 1:
        continue
    for j in R[i::p]+R[p-i::p]:
        while v[j]%p == 0:
            v[j] //= p
            lst[j].append(p)
Q,*qs = map(int,open(0).read().split())
for x in qs:
    print(*sorted(lst[x]))
0