結果

問題 No.2518 Adjacent Larger
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-27 21:44:48
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 1,106 bytes
コンパイル時間 8,802 ms
コンパイル使用メモリ 158,184 KB
実行使用メモリ 193,376 KB
最終ジャッジ日時 2023-10-27 21:45:01
合計ジャッジ時間 11,917 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
32,584 KB
testcase_01 AC 122 ms
40,784 KB
testcase_02 AC 90 ms
40,828 KB
testcase_03 AC 92 ms
40,752 KB
testcase_04 AC 94 ms
40,744 KB
testcase_05 AC 96 ms
40,808 KB
testcase_06 AC 81 ms
35,844 KB
testcase_07 AC 79 ms
35,940 KB
testcase_08 AC 81 ms
36,036 KB
testcase_09 AC 81 ms
35,948 KB
testcase_10 AC 77 ms
35,912 KB
testcase_11 AC 81 ms
35,780 KB
testcase_12 AC 80 ms
36,084 KB
testcase_13 AC 82 ms
35,788 KB
testcase_14 AC 82 ms
35,716 KB
testcase_15 AC 82 ms
35,860 KB
testcase_16 AC 100 ms
47,400 KB
testcase_17 AC 86 ms
39,920 KB
testcase_18 AC 91 ms
40,364 KB
testcase_19 AC 86 ms
38,700 KB
testcase_20 AC 95 ms
44,184 KB
testcase_21 AC 100 ms
47,560 KB
testcase_22 AC 104 ms
47,560 KB
testcase_23 AC 101 ms
47,552 KB
testcase_24 AC 98 ms
45,724 KB
testcase_25 AC 102 ms
46,136 KB
testcase_26 AC 98 ms
46,136 KB
testcase_27 AC 98 ms
47,812 KB
testcase_28 AC 99 ms
193,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (177 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var t = NN;
        var ans = new bool[t];
        for (var u = 0; u < t; ++u)
        {
            var n = NN;
            var a = NList;
            var list = new List<int>();
            foreach (var ai in a) if (ai != 1) list.Add(ai);
            var flg = true;
            for (var i = 0; i + 1 < list.Count; ++i)
            {
                if (list[i] == list[i + 1])
                {
                    flg = false;
                    break;
                }
            }
            ans[u] = flg && list.Count > 0 && list[0] != list[^1];
        }
        WriteLine(string.Join("\n", ans.Select(f => f ? "Yes" : "No")));
    }
}
0