結果
| 問題 |
No.1868 Teleporting Cyanmond
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-23 09:38:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 287 bytes |
| コンパイル時間 | 1,629 ms |
| コンパイル使用メモリ | 192,112 KB |
| 最終ジャッジ日時 | 2025-01-26 00:34:30 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N;
vector<int> R(N - 1);
for (int i = 0; i < N - 1; ++i) cin >> R[i];
int ans = 0, now = 0;
while (R[now] != N) {
now = R[now] - 1;
++ans;
}
cout << ans + 1 << endl;
}