結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2018-08-29 00:47:51 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 811 bytes |
コンパイル時間 | 2,293 ms |
コンパイル使用メモリ | 107,008 KB |
実行使用メモリ | 20,096 KB |
最終ジャッジ日時 | 2024-07-18 13:05:10 |
合計ジャッジ時間 | 4,303 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Linq;class No490{static void Main(){var n = Int32.Parse(Console.ReadLine());var num = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();var length = num.Length;for (int i = 0; i < 2*n-3; ++i){for (int p = 0; p < n - 1; ++p){var q = i - p;if (p >= q) break;if (q >= length) continue;if (num[p] > num[q]){var temp = num[p];num[p] = num[q];num[q] = temp;}}}foreach (var a in num){Console.Write(" ");Console.Write(a);}Console.WriteLine();}}