We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
intmain(){intn,c=0,y[20];scanf("%d",&n);for(inti=1;i<=n;i++){scanf("%d",&y[i]);}for(intj=1;j<=n;j++){if(j==y[y[j]])++c;}if(c==n)printf("YES");elseprintf("NO");/* Enter your code here. Read input from STDIN. Print output to STDOUT */return0;}
Cookie support is required to access HackerRank
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 →