結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2018-03-19 20:29:52 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 2,558 ms |
コンパイル使用メモリ | 105,728 KB |
実行使用メモリ | 19,968 KB |
最終ジャッジ日時 | 2024-06-11 14:50:19 |
合計ジャッジ時間 | 4,968 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;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));}}}