結果
| 問題 |
No.2055 12x34...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-21 13:34:22 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,378 bytes |
| コンパイル時間 | 7,328 ms |
| コンパイル使用メモリ | 166,484 KB |
| 実行使用メモリ | 68,020 KB |
| 最終ジャッジ日時 | 2024-10-10 06:06:14 |
| 合計ジャッジ時間 | 14,597 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 36 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (92 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] - 1]+1;
}
else
{
dict.Add(a[i], dict[a[i] - 1]+1);
}
}
else
{
if (dict.ContainsKey(a[i]))
{
dict[a[i]]++;
}
else
{
dict.Add(a[i], 1);
}
}
}
long count = 0;
foreach (var item in dict)
{
count += item.Value;
}
Console.WriteLine(count-n);
}
}
}