結果

問題 No.2449 square_permutation
ユーザー hiryuNhiryuN
提出日時 2023-08-31 16:08:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 476 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 10,600 KB
実行使用メモリ 26,888 KB
最終ジャッジ日時 2023-08-31 20:30:24
合計ジャッジ時間 9,542 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,952 KB
testcase_01 AC 15 ms
7,800 KB
testcase_02 AC 15 ms
7,780 KB
testcase_03 AC 15 ms
7,788 KB
testcase_04 AC 15 ms
7,740 KB
testcase_05 AC 17 ms
8,348 KB
testcase_06 AC 158 ms
14,568 KB
testcase_07 AC 174 ms
15,096 KB
testcase_08 AC 198 ms
15,728 KB
testcase_09 AC 231 ms
16,916 KB
testcase_10 AC 318 ms
20,520 KB
testcase_11 AC 341 ms
21,796 KB
testcase_12 AC 370 ms
22,676 KB
testcase_13 AC 463 ms
26,764 KB
testcase_14 AC 453 ms
26,844 KB
testcase_15 AC 466 ms
26,872 KB
testcase_16 AC 465 ms
26,808 KB
testcase_17 AC 455 ms
26,828 KB
testcase_18 AC 435 ms
25,020 KB
testcase_19 AC 470 ms
26,416 KB
testcase_20 AC 457 ms
26,844 KB
testcase_21 AC 476 ms
26,848 KB
testcase_22 AC 15 ms
7,800 KB
testcase_23 AC 460 ms
26,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
sw=[None]+[0]*n
for i in range(1,n+1):
    if sw[i]==0:
        sq=[i]
        for q in range(2,10**12):
            if i*q**2>n:
                break
            sq.append(i*q**2)
        for q in range(len(sq)):
            sw[sq[q]]=sq[len(sq)-q-1]
print(*sw[1:])
0