結果
| 問題 |
No.2449 square_permutation
|
| ユーザー |
|
| 提出日時 | 2023-08-31 23:26:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 706 bytes |
| コンパイル時間 | 425 ms |
| コンパイル使用メモリ | 82,100 KB |
| 実行使用メモリ | 245,444 KB |
| 最終ジャッジ日時 | 2025-01-03 05:03:19 |
| 合計ジャッジ時間 | 38,646 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 11 |
ソースコード
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)