結果
問題 |
No.2055 12x34...
|
ユーザー |
|
提出日時 | 2022-08-21 14:12:15 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,444 bytes |
コンパイル時間 | 7,904 ms |
コンパイル使用メモリ | 167,968 KB |
実行使用メモリ | 203,936 KB |
最終ジャッジ日時 | 2024-10-10 06:11:17 |
合計ジャッジ時間 | 15,472 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 36 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (100 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/
ソースコード
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); } } }