結果
問題 |
No.1868 Teleporting Cyanmond
|
ユーザー |
![]() |
提出日時 | 2022-03-12 01:53:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 428 bytes |
コンパイル時間 | 2,022 ms |
コンパイル使用メモリ | 193,604 KB |
最終ジャッジ日時 | 2025-01-28 09:11:51 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 25 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int dp[100100]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector<int> R(n-1); rep(i,n-1){ cin>>R[i]; R[i]--; } dp[n-1]=0; for(int i=n-2;i>=0;i--) dp[i]=dp[R[i]]+1; cout<<dp[0]<<endl; return 0; }