spoj 379
题是水题 但丫的题目意思太难懂 ....... 英语水平 ......
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue> using namespace std;
int a[100010];
int main()
{
int n;
while(scanf("%d",&n) && n)
{
for(int i = 1; i <= n; i++)
{
scanf("%d",&a[i]);
}
bool flag = true;
for(int i = 1; i <= n; i++)
{
if(a[a[i]] != i)
{
flag = false;
break;
}
}
if(flag)
puts("ambiguous");
else
puts("not ambiguous");
}
return 0;
}
spoj 379的更多相关文章
- BZOJ 2588: Spoj 10628. Count on a tree [树上主席树]
2588: Spoj 10628. Count on a tree Time Limit: 12 Sec Memory Limit: 128 MBSubmit: 5217 Solved: 1233 ...
- SPOJ DQUERY D-query(主席树)
题目 Source http://www.spoj.com/problems/DQUERY/en/ Description Given a sequence of n numbers a1, a2, ...
- SPOJ GSS3 Can you answer these queries III[线段树]
SPOJ - GSS3 Can you answer these queries III Description You are given a sequence A of N (N <= 50 ...
- Codeforces Round #370 - #379 (Div. 2)
题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi ...
- 【填坑向】spoj COT/bzoj2588 Count on a tree
这题是学主席树的时候就想写的,,, 但是当时没写(懒) 现在来填坑 = =日常调半天lca(考虑以后背板) 主席树还是蛮好写的,但是代码出现重复,不太好,导致调试的时候心里没底(虽然事实证明主席树部分 ...
- 379. Design Phone Directory
379. Design Phone Directory Design a Phone Directory which supports the following operations: get: P ...
- SPOJ bsubstr
题目大意:给你一个长度为n的字符串,求出所有不同长度的字符串出现的最大次数. n<=250000 如:abaaa 输出: 4 2 1 1 1 spoj上的时限卡的太严,必须使用O(N)的算法那才 ...
- 【SPOJ 7258】Lexicographical Substring Search
http://www.spoj.com/problems/SUBLEX/ 好难啊. 建出后缀自动机,然后在后缀自动机的每个状态上记录通过这个状态能走到的不同子串的数量.该状态能走到的所有状态的f值的和 ...
- 【SPOJ 1812】Longest Common Substring II
http://www.spoj.com/problems/LCS2/ 这道题想了好久. 做法是对第一个串建后缀自动机,然后用后面的串去匹配它,并在走过的状态上记录走到这个状态时的最长距离.每匹配完一个 ...
随机推荐
- Ajax-jQuery实现
load方法: 对上一篇中的javascript原生实现(数据格式为html),用jqury的post方法进行改造: 下面这句中“h2 a”,实现了对返回内容的选择: $.get()\$.post ...
- Entity Framework 6.1-Code First
原文:Entity Framework 6.1-Code First Code First-代码优先,先创建好领域模型.新建MyDbContext继承DbContext.根据代码自动生成数据库 Cod ...
- 基于Tengine的反向代理详细配置
系统环境: SUSE Linux Enterprise Server 10 SP1 (x86_64) 注:所有软件包都放置在/data/software目录下 nginx_tcp_proxy_modu ...
- iOS - 字典(NSDictionary)
1. 字典类型的常用处理 //---------------不可变字典 //1.字典的创建 NSArray *array1 = [NSArray arrayWithObjects:@"zha ...
- 给label text 上色 && 给textfiled placeholder 上色
1.给label text 上色: NSInteger stringLength = ; stringLength = model.ToUserNickName.length; NSMutableAt ...
- (转) 读取xml文件转成List<T>对象的两种方法
读取xml文件,是项目中经常要用到的,所以就总结一下,最近项目中用到的读取xml文件并且转成List<T>对象的方法,加上自己知道的另一种实现方法. 就以一个简单的xml做例子. xml格 ...
- [Bootstrap]全局样式(五)
辅助样式 1.情景文本色 .text-muted .text-primary .text-success .text-info .text-warning .text-danger {c ...
- Session 的配置和特性
session的配置 对于session的配置是php.ini中配置 session数据都是保存在文本文件中 设置session文件的保存位置 说明: 默认是保存在windows/temp目录 ...
- 鼠标按键自定义软件-X-Mouse Button Control
转载说明 本篇文章可能已经更新,最新文章请转:http://www.sollyu.com/mouse-button-x-mouse-button-custom-software-control/ 说明 ...
- grails环境搭建
关于grails,前方有大坑,入坑需谨慎. 使用grails,最好有人指点,因为有很多坑等着你去跳.如果完全是自己折腾,每前进一步都会花一些时间,且不说这些时间用来干其他事情有更多回报,光是像堵车一样 ...