0

Did not understand the last testcase when t ==7

2nd Mar 2021, 10:08 AM
RuntimeERROR
RuntimeERROR - avatar
3 Respostas
+ 2
Share links in description , not in question place, it wont work there.. https://open.kattis.com/problems/basicprogramming1 : edited thanks for edit..
2nd Mar 2021, 10:10 AM
Jayakrishna 🇮🇳
+ 1
7. a. Start from index i=0; b. Jump to index i=A[i] c. If the current index i is outside the valid bound of [0..N-1], print “Out” and stop; d. Else if the current index i is index N-1, print “Done” and stop; e1. Otherwise, repeat step b; e2. If doing this leads to an infinite loop, print “Cyclic” and stop;   Sample : 3 7 1 0 4 Here, A) starts from i=0, B) i=a[i]= a[0]=1 C) Current index is i<7 ,within the range (else print "out" .) so e1) repeat B, i=a[1]=0 so this will get repeated so according to e2: print "cyclic" D) if(i==7) print done hope it helps...
2nd Mar 2021, 10:27 AM
Jayakrishna 🇮🇳
2nd Mar 2021, 10:13 AM
RuntimeERROR
RuntimeERROR - avatar