結果
問題 |
No.1868 Teleporting Cyanmond
|
ユーザー |
![]() |
提出日時 | 2022-03-12 07:01:14 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 5,304 ms |
コンパイル使用メモリ | 103,168 KB |
実行使用メモリ | 26,496 KB |
最終ジャッジ日時 | 2024-09-16 12:29:21 |
合計ジャッジ時間 | 6,914 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 25 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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); } }