結果
| 問題 | No.2449 square_permutation |
| ユーザー |
FromBooska
|
| 提出日時 | 2023-09-01 11:41:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 121 ms / 2,000 ms |
| コード長 | 490 bytes |
| コンパイル時間 | 354 ms |
| コンパイル使用メモリ | 82,584 KB |
| 実行使用メモリ | 90,752 KB |
| 最終ジャッジ日時 | 2025-01-03 06:28:29 |
| 合計ジャッジ時間 | 4,650 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
N = int(input())
pos = [-1]*(N+1)
for n in range(1, N+1):
if pos[n] != -1:
continue
if n > N/2 and pos[n] == -1:
pos[n] = n
continue
candidates = []
for j in range(1, N+1):
if n*j*j > N:
break
if pos[n*j*j] == -1:
candidates.append(n*j*j)
L = len(candidates)
for l in range(L):
pos[candidates[l]] = candidates[L-l-1]
#print('n', n, 'candidates', candidates, 'pos', pos)
print(*pos[1:])
FromBooska