結果

問題 No.2449 square_permutation
ユーザー hiryuNhiryuN
提出日時 2023-03-01 17:40:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 1,093 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 94,124 KB
最終ジャッジ日時 2023-08-31 20:30:07
合計ジャッジ時間 6,737 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
70,868 KB
testcase_01 AC 64 ms
70,928 KB
testcase_02 AC 67 ms
71,140 KB
testcase_03 AC 69 ms
70,864 KB
testcase_04 AC 71 ms
70,992 KB
testcase_05 AC 87 ms
76,156 KB
testcase_06 AC 117 ms
82,628 KB
testcase_07 AC 118 ms
83,124 KB
testcase_08 AC 116 ms
83,832 KB
testcase_09 AC 123 ms
85,044 KB
testcase_10 AC 142 ms
88,668 KB
testcase_11 AC 147 ms
89,244 KB
testcase_12 AC 148 ms
90,352 KB
testcase_13 AC 159 ms
93,716 KB
testcase_14 AC 162 ms
93,716 KB
testcase_15 AC 165 ms
93,904 KB
testcase_16 AC 164 ms
93,728 KB
testcase_17 AC 163 ms
93,780 KB
testcase_18 AC 158 ms
92,188 KB
testcase_19 AC 164 ms
93,572 KB
testcase_20 AC 167 ms
93,912 KB
testcase_21 AC 166 ms
94,124 KB
testcase_22 AC 67 ms
71,128 KB
testcase_23 AC 163 ms
93,496 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