poj2470
简单题
View Code
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define maxn 100005
int f[maxn], pos[maxn];
int main()
{
//freopen("t.txt", "r", stdin);
int n;
while (scanf("%d", &n), n != 0)
{
for (int i = 1; i <= n; i++)
{
scanf("%d", &f[i]);
pos[f[i]] = i;
}
bool am = true;
for (int i = 1; i <= n; i++)
if (f[i] != pos[i])
{
am = false;
break;
}
if (!am)
printf("not ambiguous\n");
else
printf("ambiguous\n");
}
return 0;
}