結果
問題 | No.490 yukiソート |
ユーザー | test |
提出日時 | 2022-11-24 16:30:19 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 311 ms / 2,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 79 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 44,820 KB |
最終ジャッジ日時 | 2024-10-01 06:53:39 |
合計ジャッジ時間 | 4,944 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
function arrInt(arr) { return arr.map(str => parseInt(str, 10)); } function Main(input) { const src = input.split("\n"); const n = parseInt(src[0]); const a = arrInt(src[1].split(" ")); for (let i = 1; i < 2 * n - 3; i++) { for (let p = 0; p < n - 1; p++) { let q = i - p; if (p < q && a[p] > a[q]) { [a[p], a[q]] = [a[q], a[p]]; } } } console.log(a.join(" ")); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));