結果

問題 No.365 ジェンガソート
ユーザー bluemeganebluemegane
提出日時 2020-09-10 20:59:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 61,308 KB
実行使用メモリ 26,996 KB
最終ジャッジ日時 2023-08-25 15:42:40
合計ジャッジ時間 6,468 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
20,672 KB
testcase_01 AC 48 ms
20,764 KB
testcase_02 AC 48 ms
20,668 KB
testcase_03 AC 48 ms
22,724 KB
testcase_04 AC 48 ms
22,728 KB
testcase_05 AC 49 ms
20,688 KB
testcase_06 AC 48 ms
20,792 KB
testcase_07 AC 49 ms
22,664 KB
testcase_08 AC 48 ms
20,612 KB
testcase_09 AC 49 ms
20,720 KB
testcase_10 AC 49 ms
20,664 KB
testcase_11 AC 49 ms
20,752 KB
testcase_12 AC 49 ms
20,708 KB
testcase_13 AC 49 ms
20,696 KB
testcase_14 AC 49 ms
22,788 KB
testcase_15 AC 49 ms
22,780 KB
testcase_16 AC 73 ms
26,040 KB
testcase_17 AC 77 ms
26,588 KB
testcase_18 AC 57 ms
21,200 KB
testcase_19 AC 77 ms
26,588 KB
testcase_20 AC 62 ms
23,792 KB
testcase_21 AC 60 ms
21,728 KB
testcase_22 AC 75 ms
25,968 KB
testcase_23 AC 65 ms
22,648 KB
testcase_24 AC 73 ms
23,860 KB
testcase_25 AC 60 ms
23,984 KB
testcase_26 AC 68 ms
24,720 KB
testcase_27 AC 79 ms
26,788 KB
testcase_28 AC 69 ms
24,840 KB
testcase_29 AC 76 ms
26,464 KB
testcase_30 AC 69 ms
24,920 KB
testcase_31 AC 62 ms
21,648 KB
testcase_32 AC 60 ms
21,812 KB
testcase_33 AC 78 ms
24,900 KB
testcase_34 AC 59 ms
23,652 KB
testcase_35 AC 73 ms
25,920 KB
testcase_36 AC 79 ms
26,976 KB
testcase_37 AC 78 ms
26,996 KB
testcase_38 AC 79 ms
26,880 KB
testcase_39 AC 79 ms
26,988 KB
testcase_40 AC 78 ms
26,916 KB
権限があれば一括ダウンロードができます

ソースコード

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 - 1;
        for (int i = np - 1; i >= 0; i--)
        {
            if (a[i] == t) { count++; t--; }
        }
        Console.WriteLine(n - count);
    }
}
0