結果
| 問題 |
No.1868 Teleporting Cyanmond
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2022-04-28 07:38:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 475 bytes |
| コンパイル時間 | 1,267 ms |
| コンパイル使用メモリ | 95,508 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-28 07:53:20 |
| 合計ジャッジ時間 | 2,990 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 25 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <cstdio>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n - 1; i++) {
cin >> a[i];
}
int j = 0;
int cnt = 0;
while (true) {
j = a[j] - 1;
cnt++;
if (j == n - 1) break;
}
cout << cnt << endl;
return 0;
}
mmn15277198