結果
| 問題 | No.1868 Teleporting Cyanmond |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-20 18:50:37 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 670 bytes |
| 記録 | |
| コンパイル時間 | 1,356 ms |
| コンパイル使用メモリ | 84,128 KB |
| 実行使用メモリ | 51,700 KB |
| 最終ジャッジ日時 | 2026-09-04 16:13:21 |
| 合計ジャッジ時間 | 10,389 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 17 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] rs = new int[n];
for(int i = 0 ; i < n - 1 ; i++){
rs[i] = sc.nextInt();
}
rs[n-1] = n;
int now = 1;
int ans = 0;
while(rs[now-1] != n){
int max = -1;
for(int i = now, len = rs[now-1] ; i < len ; i++){
max = Math.max(max , rs[i-1]);
}
now = max;
ans++;
}
System.out.println(ans+1);
}
}