結果

問題 No.2535 多重同値
ユーザー volhalinkvolhalink
提出日時 2023-11-10 23:15:46
言語 C#
(.NET 8.0.203)
結果
TLE  
実行時間 -
コード長 1,146 bytes
コンパイル時間 9,273 ms
コンパイル使用メモリ 158,736 KB
実行使用メモリ 154,352 KB
最終ジャッジ日時 2023-11-10 23:16:02
合計ジャッジ時間 11,897 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
31,012 KB
testcase_01 AC 56 ms
31,012 KB
testcase_02 AC 56 ms
31,012 KB
testcase_03 AC 55 ms
31,012 KB
testcase_04 AC 59 ms
31,012 KB
testcase_05 AC 55 ms
31,012 KB
testcase_06 AC 71 ms
31,012 KB
testcase_07 AC 56 ms
31,012 KB
testcase_08 AC 58 ms
31,012 KB
testcase_09 AC 55 ms
31,012 KB
testcase_10 AC 57 ms
31,012 KB
testcase_11 AC 55 ms
31,012 KB
testcase_12 AC 55 ms
31,012 KB
testcase_13 AC 56 ms
31,012 KB
testcase_14 AC 55 ms
31,012 KB
testcase_15 AC 59 ms
31,268 KB
testcase_16 AC 118 ms
31,652 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (103 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;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var p = new bool[n];
        var r = new bool[n];
        var tr = -1;
        var cont = true;
        var input = Console.ReadLine();
        if (input == "Yes")
        {
            p[0] = true;
            tr = 0;
        }
        else
        {
            cont = false;
            p[0] = false;
        }
        for (int i = 1; i < n; i++)
        {
            input = Console.ReadLine();
            if (input == "Yes")
            {
                p[i] = true;
                if (cont) tr = i;
            }
            else
            {
                cont = false;
                p[i] = false;
            }
        }

        for(int i = n - 1; i >= 0; i--)
        {
            r[i] = p[i];
            if (i >= tr)
            {
                for (int j = i + 1; j < n; j++)
                {
                    r[j] = r[j] == p[i];
                }
            }
        }

        for (int i = 0; i < n; i++)
        {
            Console.WriteLine(r[i] ? "Yes" : "No");
        }
    }
}
0