結果

問題 No.1868 Teleporting Cyanmond
ユーザー bluemeganebluemegane
提出日時 2022-03-12 07:01:14
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 3,396 ms
コンパイル使用メモリ 65,400 KB
実行使用メモリ 30,108 KB
最終ジャッジ日時 2023-10-14 18:23:36
合計ジャッジ時間 6,655 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
20,696 KB
testcase_01 AC 50 ms
20,760 KB
testcase_02 AC 50 ms
20,704 KB
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 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = ("0 " + Console.ReadLine().Trim()).Split(' ');
        var r = Array.ConvertAll(line, int.Parse);
        getAns(n, r);
    }
    static void getAns(int n, int[] r)
    {
        var step = 0;
        var p = 1;
        while (p < n)
        {
            var imax = r[p];
            var nextmax = 0;
            for (int i = p; i <= imax; i++) nextmax = Max(nextmax, r[p]);
            p = nextmax;
            step++;
        }
        Console.WriteLine(step);
    }
}
0