結果

問題 No.365 ジェンガソート
ユーザー akichi
提出日時 2017-08-15 09:08:23
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 532 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 104,704 KB
実行使用メモリ 29,568 KB
最終ジャッジ日時 2024-10-13 10:55:01
合計ジャッジ時間 6,235 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 TLE * 1 -- * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
class Program {
    static void Main() {
        int ans = 0;
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

        for (int i = n; 0 <= i; i--) {
            int ai = a.IndexOf(i);
            for (int j = i - 1; 0 <= j; j--) {
                if (ai < a.IndexOf(j)) {
                    ans = Math.Max(ans, j);
                    break;
                }
            }
        }
        Console.WriteLine(ans);
    }
}
0