結果

問題 No.1868 Teleporting Cyanmond
ユーザー 👑 kakel-sankakel-san
提出日時 2023-11-23 23:02:07
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 7,207 ms
コンパイル使用メモリ 157,480 KB
実行使用メモリ 187,636 KB
最終ジャッジ日時 2023-11-23 23:02:23
合計ジャッジ時間 12,609 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
32,548 KB
testcase_01 AC 72 ms
32,548 KB
testcase_02 AC 72 ms
32,548 KB
testcase_03 AC 106 ms
39,972 KB
testcase_04 AC 84 ms
38,180 KB
testcase_05 AC 74 ms
33,060 KB
testcase_06 AC 77 ms
34,212 KB
testcase_07 AC 81 ms
36,516 KB
testcase_08 AC 82 ms
35,108 KB
testcase_09 AC 84 ms
36,132 KB
testcase_10 AC 92 ms
39,332 KB
testcase_11 AC 74 ms
32,804 KB
testcase_12 AC 80 ms
34,724 KB
testcase_13 AC 83 ms
36,644 KB
testcase_14 AC 90 ms
40,356 KB
testcase_15 AC 84 ms
37,924 KB
testcase_16 AC 77 ms
33,956 KB
testcase_17 AC 78 ms
34,596 KB
testcase_18 AC 97 ms
41,124 KB
testcase_19 AC 95 ms
41,124 KB
testcase_20 AC 93 ms
41,124 KB
testcase_21 AC 92 ms
41,124 KB
testcase_22 AC 94 ms
41,124 KB
testcase_23 AC 98 ms
41,124 KB
testcase_24 AC 92 ms
41,124 KB
testcase_25 AC 95 ms
41,124 KB
testcase_26 AC 93 ms
41,124 KB
testcase_27 AC 97 ms
187,636 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (97 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;
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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        var cum = new int[n - 1];
        cum[0] = a[0];
        for (var i = 1; i < a.Length; ++i) cum[i] = Math.Max(cum[i - 1], a[i]);
        var max = 1;
        var ans = 0;
        while (max < n)
        {
            max = cum[max - 1];
            ++ans;
        }
        WriteLine(ans);
    }
}
0