結果
問題 |
No.365 ジェンガソート
|
ユーザー |
![]() |
提出日時 | 2017-08-21 12:50:53 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,305 bytes |
コンパイル時間 | 891 ms |
コンパイル使用メモリ | 106,240 KB |
実行使用メモリ | 24,448 KB |
最終ジャッジ日時 | 2024-10-15 00:48:23 |
合計ジャッジ時間 | 5,937 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 7 TLE * 1 -- * 24 |
コンパイルメッセージ
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 GengaSort { class Program { static void Main(string[] args) { int[] Xn = new int[int.Parse( Console.ReadLine() )]; int[] An = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); int ix = 0, count =0; while(ix > -1) { ix = -1; for (int i = 0; i < An.Length - 1; i++) { if ( An[i] > An[i + 1] && ( ix == -1 || An[ix] < An[i + 1])) ix = i + 1; } if (ix > -1) { count++; for (int i = 0; i < An.Length; i++) { if (i == ix) { Xn[0] = An[i]; } else if (i < ix) { Xn[i + 1] = An[i]; } else { Xn[i] = An[i]; } } Array.Copy(Xn, An, Xn.Length); } } Console.WriteLine(count); } } }