PERMUT2 : Why is this wrong ? It works fine on my system. PLEASE HELP!

#include
#include

using namespace std;

int main(){

int t,t1,i;
cin>>t;
while(t!=0){
	int s[t+1];
	for(i=1;i<t+1;i++)
	scanf("%d",&s[i]);
	
	for(i=1;i<t+1;i++){
		if(s[s[i]]!=i){
		cout<<"Not Ambiguous"<<endl;
		break;
		}
		else if(i==t)
		cout<<"Ambiguous"<<endl;
	}
	scanf("%d",&t);
	
	
	
}
return 0;

}

cout kra dekh bhai

Are you sure it works fine?? Check the input section of your program

Replace :

for(i=1;i<t+1;i++){
        if(s[s[i]]!=i){
        cout<<"Not Ambiguous"<<endl;
        break;
        }
        else if(i==t)
        cout<<"Ambiguous"<<endl;
    }

With:

for(i=1;i<=t;i++)
		{
			if((a[a[i]]!=i))
			flag=1;
		}
		if(flag==0) printf("ambiguous\n");
		else printf("not ambiguous\n");
	}

The String that you are passing to output is wrong. It does not matches to the correct output. See above comment.