結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2017-05-28 01:32:48 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,063 bytes |
コンパイル時間 | 917 ms |
コンパイル使用メモリ | 106,496 KB |
実行使用メモリ | 20,096 KB |
最終ジャッジ日時 | 2024-09-21 14:36:27 |
合計ジャッジ時間 | 2,785 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 5 WA * 29 |
コンパイルメッセージ
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; using System.Text; namespace Yuki { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] a = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray(); for (int i = 1; i < 2 * n - 3 && i < a.Length ; i++) { for (int p = 0; p <= n - 1; p++) { if (p > a.Length - 1) break; int q = i - p; if (q > a.Length - 1) break; if (p >= q) break; if (a[p] > a[q]) { int w = a[p]; a[p] = a[q]; a[q] = w; } } } var sb = new StringBuilder(); foreach (var item in a) { sb.Append(item.ToString() + " "); } Console.WriteLine(sb.ToString().Trim()); } } }