結果

問題 No.365 ジェンガソート
ユーザー bluemeganebluemegane
提出日時 2020-09-10 20:53:50
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 1,516 ms
コンパイル使用メモリ 63,428 KB
実行使用メモリ 28,932 KB
最終ジャッジ日時 2023-08-25 15:34:12
合計ジャッジ時間 6,378 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,640 KB
testcase_01 AC 57 ms
20,680 KB
testcase_02 AC 57 ms
18,800 KB
testcase_03 AC 57 ms
22,728 KB
testcase_04 WA -
testcase_05 AC 56 ms
18,568 KB
testcase_06 AC 56 ms
20,796 KB
testcase_07 AC 56 ms
18,764 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 93 ms
26,892 KB
testcase_37 AC 92 ms
28,932 KB
testcase_38 WA -
testcase_39 AC 91 ms
26,948 KB
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, a);
    }
    static void getAns(int n, int[] a)
    {
        var np = 0;
        for (int i = 0; i < n; i++)
        {
            if (a[i] == n) { np = i; break; }
        }
        var count = 1;
        var t = n;
        for (int i = np - 1; i >= 0; i--)
        {
            if (a[i] < t) { count++; t = a[i]; }
        }
        Console.WriteLine(n - count);
    }
}
0