#include<iostream>
#include<stdio.h>
#include<vector>
using namespace std; int main()
{
//freopen("acm.acm","r",stdin);
vector<int> coll;
int num;
int a;
int i;
bool * boo;
while()
{
scanf("%d",&num);
if(num == )
break;
boo = new bool[num];
memset(boo,false,sizeof(bool)*num);
for(i = ; i < num; ++ i)
{
scanf("%d",&a);
coll.push_back(a);
}
for(i = ; i < num; ++ i)
{
if(boo[i])
{
continue;
}
else
{
if(coll[coll[i] - ] != i +)
{
cout<<"not ambiguous"<<endl;
break;
}
else
{
boo[coll[i] - ] = true;
//boo[i] = true;
} } }
if(i == num)
{
cout<<"ambiguous"<<endl;
}
delete[] boo;
coll.clear();
}
}

POJ 2470的更多相关文章

  1. POJ 2470 Ambiguous permutations(简单题 理解题意)

    [题目简述]:事实上就是依据题目描写叙述:A permutation of the integers 1 to n is an ordering of these integers. So the n ...

  2. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  3. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  4. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  5. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  6. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  7. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  8. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

  9. POJ 2752 Seek the Name, Seek the Fame [kmp]

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17898   Ac ...

随机推荐

  1. 牛客训练三:处女座和小姐姐(三)(数位dp)

    题目链接:传送门 思路:数位dp的记忆化搜索模板 从高位向低位枚举,逐位确定每一位的6的个数,dp[i][s]表示处理到第i条边,状态为s时的数字的个数. 注意,要使用long long类型. #in ...

  2. boost-容器

    1.array array相当于是一个增加了STL容器接口的数组,但它不像vector等容器一样可以动态增长,如果需要动态变动array的容量可以使用boost::scoped_array.array ...

  3. Unable to fetch some archives ,maybe run apt-get update or try with --fix-missing?

    今天在liunx下要解压zip包时,发现系统里面没有装unzip包,于是就运行sudo apt-get install unzip,可是总是没办法安装,于是上网找原因,有的说源文件需要修改,于是就运行 ...

  4. javascript总结集合

    前言:下面的总结都是自己测试过的,绝大多数都是没问题的,但是不敢保证一定全面,还需要诸君自己独立思考: 1)基础:在nodejs里全局对象是global,而网页里js的全局对象是window:对于所有 ...

  5. Linux创建一个周期任务来定期删除过期的文件

    一:需求 在开发中存在这样的情况,为了防止文件的误删,不允许开发人员直接删除项目中要用到的文件,而是将它们移动到某个目录,然后由一个周期任务去检测并删除内部过期的文件: 二:检测文件是否是过期文件 有 ...

  6. 快速创建一个 Servlet 项目(1)

    1. 新建一个 maven project (web app) 得到如下项目 2. 添加 servlet 和 jsp 依赖 通常 servlet 和 jsp 依赖由web容器提供,这个编译错误并不会影 ...

  7. onsyscommand

    简介 OnSysCommand()这个函数主要是截获控制命令的,msdn上的解释如下: The framework calls this member function when the user s ...

  8. 标记化结构初始化语法 在结构体成员前加上小数点 如 “.open .write .close ”C99编译器 .

    今天在看串口驱动(四)的时候 有这样一个结构体初始化 我很不理解 如下: static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] ...

  9. POJ3723--Conscription(MST)WRONG

    Description Windy has a country, and he wants to build an army to protect his country. He has picked ...

  10. c# json转换成dynamic对象,然后在dynamic对象中动态获取指定字符串列表中的值

    using Newtonsoft.Json;using System;using System.Collections.Generic;using System.Linq;using System.T ...