You are viewing a single comment's thread. Return to all comments →
Python 3 Version
n = int(input()) numarr = list(map(int,input().split())) for i in range(0,n): try : if i+1 != numarr[numarr[i]-1]: print ("NO") exit(0) except IndexError: print ("NO") exit(0) print ("YES")
Seems like cookies are disabled on this browser, please enable them to open this website
Security Involution
You are viewing a single comment's thread. Return to all comments →
Python 3 Version