結果
| 問題 | No.2449 square_permutation |
| ユーザー |
|
| 提出日時 | 2023-09-01 17:40:46 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 69 ms / 2,000 ms |
| コード長 | 742 bytes |
| 記録 | |
| コンパイル時間 | 5,023 ms |
| コンパイル使用メモリ | 103,936 KB |
| 実行使用メモリ | 32,000 KB |
| 最終ジャッジ日時 | 2026-06-06 12:49:35 |
| 合計ジャッジ時間 | 7,573 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic;
public class Hello{
public static void Main(){
// Your code here!
int n = int.Parse(System.Console.ReadLine());
int[] ans = new int[n+1];
for(int i=0;i<n+1;i++) ans[i] = 0;
for(int i=1;i<n+1;i++){
if(ans[i] != 0) continue;
List<int> tmp = new List<int>();
for(int j=1;i*j*j<=n;j++){
tmp.Add(i*j*j);
}
for(int j=0;j<tmp.Count;j++){
ans[tmp[j]] = tmp[tmp.Count-1-j];
}
}
int[] anss = new int[n];
for(int i=0;i<n;i++){
anss[i] = ans[i+1];
}
System.Console.WriteLine(string.Join(" ",anss));
}
}