結果

問題 No.2055 12x34...
ユーザー デカブツデカブツ
提出日時 2022-08-21 14:12:15
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,444 bytes
コンパイル時間 7,195 ms
コンパイル使用メモリ 169,132 KB
実行使用メモリ 205,356 KB
最終ジャッジ日時 2024-04-18 12:58:37
合計ジャッジ時間 14,130 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
29,568 KB
testcase_01 AC 47 ms
29,432 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 109 ms
52,504 KB
testcase_13 AC 146 ms
66,460 KB
testcase_14 AC 98 ms
44,800 KB
testcase_15 AC 99 ms
45,056 KB
testcase_16 AC 143 ms
66,916 KB
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 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (102 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;

namespace test
{
    static class Program
    {
        static void Main()
        {
            long n = long.Parse(Console.ReadLine());
            string[] astr = Console.ReadLine().Split(' ');
            long[] a = new long[n];
            for(int i = 0; i < n; i++)
            {
                a[i] = long.Parse(astr[i]);
            }
            Dictionary<long,long> dict = new Dictionary<long,long>();
            for (int i = 0; i < n; i++)
            {
                if (dict.ContainsKey(a[i] - 1))
                {
                    if (dict.ContainsKey(a[i]))
                    {
                        dict[a[i]] = (dict[a[i]] +dict[a[i] - 1] + 1)%998244353;
                    }
                    else
                    {
                        dict.Add(a[i], (dict[a[i] - 1] + 1)%998244353);
                    }
                }
                else
                {
                    if (dict.ContainsKey(a[i]))
                    {
                        dict[a[i]] = (dict[a[i]]+1)%998244353;
                    }
                    else
                    {
                        dict.Add(a[i], 1);
                    }
                }
            }
            long count = 0;
            foreach (var item in dict)
            {
                count += item.Value;
            }
            Console.WriteLine(count - n);
        }
    }
}
0