結果

問題 No.2449 square_permutation
ユーザー ShirotsumeShirotsume
提出日時 2023-08-31 23:26:46
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 706 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 125,884 KB
最終ジャッジ日時 2023-08-31 23:27:02
合計ジャッジ時間 16,194 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
74,136 KB
testcase_01 AC 110 ms
74,052 KB
testcase_02 AC 113 ms
74,264 KB
testcase_03 AC 113 ms
74,684 KB
testcase_04 AC 122 ms
78,936 KB
testcase_05 AC 136 ms
79,616 KB
testcase_06 AC 752 ms
99,240 KB
testcase_07 AC 840 ms
101,556 KB
testcase_08 AC 939 ms
101,764 KB
testcase_09 AC 1,109 ms
101,640 KB
testcase_10 AC 1,765 ms
119,388 KB
testcase_11 AC 1,985 ms
123,296 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

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)]

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

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

print(*ans)
0