結果
問題 | No.1868 Teleporting Cyanmond |
ユーザー |
|
提出日時 | 2021-11-23 09:30:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 2,737 ms |
コンパイル使用メモリ | 192,988 KB |
最終ジャッジ日時 | 2025-01-26 00:34:21 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 5 |
ソースコード
#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 = max_element(R.begin(), R.begin() + R[now]) - R.begin();++ans;}cout << ans + 1 << endl;}