結果
| 問題 | No.921 ずんだアロー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-07 22:52:26 |
| 言語 | C# (.NET 10.0.101) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,056 bytes |
| 記録 | |
| コンパイル時間 | 9,471 ms |
| コンパイル使用メモリ | 167,540 KB |
| 実行使用メモリ | 208,524 KB |
| 最終ジャッジ日時 | 2026-01-07 22:52:39 |
| 合計ジャッジ時間 | 12,992 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 5 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (121 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
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 n = NN;
var a = NList;
var list = new List<(int ai, int count)>{ (a[0], 1 )};
for (var i = 1; i < n; ++i)
{
if (list[^1].ai == a[i]) list[^1] = (a[i], list[^1].count + 1);
else list.Add((a[i], 1));
}
var dp = new int[list.Count];
dp[0] = list[0].count;
if (dp.Length > 1) dp[1] = list[1].count;
var max = dp[0];
for (var i = 2; i < dp.Length; ++i)
{
dp[i] = max + list[i].count;
max = Math.Max(max, dp[i - 1]);
}
WriteLine(dp.Max());
}
}