Submission #2714904
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } int index = 1, num = 0; while(1) { index = a[index - 1]; if(index == 2) { cout << num + 1; return 0; } if(num > 100000) { cout << -1; return 0; } num++; } }
Submission Info
Submission Time | |
---|---|
Task | A - Expired? |
User | Akari_Mizunashi |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 485 Byte |
Status | RE |
Exec Time | 1392 ms |
Memory | 512896 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 1 ms | 256 KB |
02.txt | WA | 1 ms | 256 KB |
03.txt | WA | 1 ms | 256 KB |
04.txt | RE | 98 ms | 256 KB |
05.txt | RE | 1392 ms | 512896 KB |
06.txt | RE | 98 ms | 1024 KB |
s1.txt | WA | 1 ms | 256 KB |
s2.txt | WA | 1 ms | 256 KB |
s3.txt | RE | 97 ms | 256 KB |