結果

問題 No.2449 square_permutation
ユーザー ShirotsumeShirotsume
提出日時 2023-08-31 23:29:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,707 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 150,544 KB
最終ジャッジ日時 2023-08-31 23:29:58
合計ジャッジ時間 26,216 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
74,196 KB
testcase_01 AC 113 ms
74,472 KB
testcase_02 AC 112 ms
74,648 KB
testcase_03 AC 111 ms
74,556 KB
testcase_04 AC 117 ms
78,876 KB
testcase_05 AC 129 ms
79,568 KB
testcase_06 AC 478 ms
105,752 KB
testcase_07 AC 507 ms
109,088 KB
testcase_08 AC 583 ms
112,524 KB
testcase_09 AC 653 ms
116,848 KB
testcase_10 AC 1,003 ms
121,060 KB
testcase_11 AC 1,106 ms
125,036 KB
testcase_12 AC 1,199 ms
126,448 KB
testcase_13 AC 1,661 ms
150,300 KB
testcase_14 AC 1,691 ms
150,544 KB
testcase_15 AC 1,685 ms
150,476 KB
testcase_16 AC 1,675 ms
150,392 KB
testcase_17 AC 1,707 ms
150,504 KB
testcase_18 AC 1,463 ms
141,600 KB
testcase_19 AC 1,631 ms
145,008 KB
testcase_20 AC 1,696 ms
150,484 KB
testcase_21 AC 1,669 ms
150,452 KB
testcase_22 AC 112 ms
74,280 KB
testcase_23 AC 1,676 ms
150,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n = ii()

D = [[] for _ in range(n + 1)]

s = []
for i in range(1, n + 1):
    now = i
    for j in range(2, now + 1):
        if j * j > now:
            break
        while now % (j * j) == 0:
            now //= (j * j)

    D[now].append(i)
    s.append(now)
ans = []

for i in range(n):
    ans.append(D[s[i]].pop())
print(*ans)
0