Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

getting wrong anwer ambiguous permutations

$
0
0

include<iostream>

using namespace std;

int main(){ int a[100000]; unsigned long int b; unsigned long int c; unsigned long int x; unsigned long int l=0; while(b!=0){ scanf("%d",b); if(b!=0){ for(int i=1;i<b+1;i++){ scanf("%d",c); a[i]=c; } for(int m=1;m<b+1;m++){ x=a[m]; if(a[x]==m){ l++; } } if(l==b){ cout<<"\n ambiguous"; } else{cout<<"\n not ambiguous"; } l=0; } else{break;} } return 0; }


Viewing all articles
Browse latest Browse all 39796

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>