結果
問題 |
No.490 yukiソート
|
ユーザー |
![]() |
提出日時 | 2018-03-19 20:19:56 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 866 ms |
コンパイル使用メモリ | 104,960 KB |
実行使用メモリ | 20,224 KB |
最終ジャッジ日時 | 2024-06-11 07:44:49 |
合計ジャッジ時間 | 3,542 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 WA * 21 |
コンパイルメッセージ
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; namespace _490 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); for (int i = 1; i < 2 * n + 3; i++) { for (int p = 0; p <= Math.Min(i,n - 1); p++) { int q = i - p; if (p >= q) break; if (q < n && x[p] > x[q]) { int a = x[p]; x[p] = x[q]; x[q] = a; } } } Console.WriteLine(string.Join(" ",x)); } } }