Created
March 14, 2015 04:34
-
-
Save shohan4556/ade81aa02ba762420110 to your computer and use it in GitHub Desktop.
URI 1663 solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ///URI OJ :1663 | |
| ///Author : Shohanur Rahaman | |
| #include<stdio.h> | |
| int ara[1000005]; | |
| int invara[1000005]; | |
| int main() | |
| { | |
| int n,i,count; | |
| while(scanf("%d",&n)==1){ | |
| count=0; | |
| if(n==0) | |
| break; | |
| for(i=1;i<=n;i++){ | |
| scanf("%d",&ara[i]); | |
| invara[ara[i]]=i; | |
| } | |
| for(i=1;i<=n;i++){ | |
| if(ara[i]==invara[i]) | |
| count++; | |
| } | |
| if(count==n) | |
| printf("ambiguous\n"); | |
| else | |
| printf("not ambiguous\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment