結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2018-09-14 15:32:13 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 729 bytes |
コンパイル時間 | 1,482 ms |
コンパイル使用メモリ | 103,552 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-07-05 17:14:33 |
合計ジャッジ時間 | 3,506 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;public class Hello{public static void Main(){var n = int.Parse(Console.ReadLine().Trim());string[] line = Console.ReadLine().Trim().Split(' ');var a = Array.ConvertAll(line, int.Parse);for (int i = 1; i < 2 * n - 3; i++)swapPQ(a, i);Console.WriteLine(string.Join(" ",a));}public static void swapPQ (int[] a, int b){var n = a.Length;for (int p = 0; p < n-1; p++){var q = b - p;if (q > p && q <= n - 1 && a[p] > a[q]) swap(a, p, q);}}public static void swap (int[] a , int i , int j){var t = a[i];a[i] = a[j];a[j] = t;}}