Chef and Rainbow Array Problem Code: RAINBOWA

Chef likes all arrays equally. But he likes some arrays more equally than others. In particular, he loves Rainbow Arrays.

An array is Rainbow if it has the following structure:

  • First a1 elements equal 1.
  • Next a2 elements equal 2.
  • Next a3 elements equal 3.
  • Next a4 elements equal 4.
  • Next a5 elements equal 5.
  • Next a6 elements equal 6.
  • Next a7 elements equal 7.
  • Next a6 elements equal 6.
  • Next a5 elements equal 5.
  • Next a4 elements equal 4.
  • Next a3 elements equal 3.
  • Next a2 elements equal 2.
  • Next a1 elements equal 1.
  • ai can be any non-zero positive integer.
  • There are no other elements in array.

Help Chef in finding out if the given array is a Rainbow Array or not.

Input

  • The first line of the input contains an integer T denoting the number of test cases.
  • The first line of each test case contains an integer N, denoting the number of elements in the given array.
  • The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of array.

Output

  • For each test case, output a line containing "yes" or "no" (without quotes) corresponding to the case if the array is rainbow array or not.

Constraints

  • 1 ≤ T ≤ 100
  • 7 ≤ N ≤ 100
  • 1 ≤ Ai ≤ 10

Subtasks

  • Subtask 1 (100 points) : Original constraints

Example

Input
3
19
1 2 3 4 4 5 6 6 6 7 6 6 6 5 4 4 3 2 1
14
1 2 3 4 5 6 7 6 5 4 3 2 1 1
13
1 2 3 4 5 6 8 6 5 4 3 2 1 Output
yes
no
no

Explanation

The first example satisfies all the conditions.

The second example has 1 element of value 1 at the beginning and 2 elements of value 1 at the end.

The third one has no elements with value 7 after elements with value 6.

————————————————————————————————————————

cc暂时没给中文翻译 所以只好搬英文辣

不然我简述一下题意吧

就是要判断一个序列是否只出现并且都出现了1-7

还要求是个回文串并且只有一个峰(也就是单峰)

codechef AUG17 T1 Chef and Rainbow Array的更多相关文章

  1. codechef AUG17 T5 Chef And Fibonacci Array

    Chef has an array A = (A1, A2, ..., AN), which has N integers in it initially. Chef found that for i ...

  2. codechef AUG17 T2 Chef and Mover

    Chef and Mover Problem Code: CHEFMOVR Chef's dog Snuffles has so many things to play with! This time ...

  3. codechef AUG17 T3 Greedy Candidates

    Greedy Candidates Problem Code: GCAC The placements/recruitment season is going on in various colleg ...

  4. 【CodeVS 5032】【省队集训2016 Day5 T1】Play with array

    一开始我用分块大法,分成$\sqrt{n}$块,每个块上维护一个Splay,然后balabala维护一下,时间复杂度是$O(n\sqrt{n}logn)$.后来对拍的时候发现比$O(n^2)$的暴力跑 ...

  5. CodeChef SADPAIRS:Chef and Sad Pairs

    vjudge 首先显然要建立圆方树 对于每一种点建立虚树,考虑这一种点贡献,对于虚树上已经有的点就直接算 否则对虚树上的一条边 \((u, v)\),\(u\) 为父亲,假设上面连通块大小为 \(x\ ...

  6. codechef AUG17 T4 Palindromic Game

    Palindromic Game Problem Code: PALINGAM There are two players A, B playing a game. Player A has a st ...

  7. CF&&CC百套计划2 CodeChef December Challenge 2017 Chef And Easy Xor Queries

    https://www.codechef.com/DEC17/problems/CHEFEXQ 题意: 位置i的数改为k 询问区间[1,i]内有多少个前缀的异或和为k 分块 sum[i][j] 表示第 ...

  8. CodeChef CHEFSOC2 Chef and Big Soccer 水dp

    Chef and Big Soccer   Problem code: CHEFSOC2 Tweet     ALL SUBMISSIONS All submissions for this prob ...

  9. Codechef FNCS Chef and Churu

    Disciption Chef has recently learnt Function and Addition. He is too exited to teach this to his fri ...

随机推荐

  1. PHP小练习题

    前几天在百度知道里面看到有位网友询问如何制作一下的小程序:用php语言设计一个小程序,计算今天到达下月的天数.全部输出这些天数,并使得每天的日期以三种颜色循环显示,设置三个表单,让用户选择字体颜色,然 ...

  2. python 获取类中除内置方法外的所有方法名

    #!/usr/bin/env python# !-*- coding:utf-8 -*- class Menu: def __init__(self): pass def updateProject( ...

  3. SQL Server 数据库内部版本号

    数据库还原或版本升级出现版本错误时可参考 可以利用SQL语句查看本机数据库版本:select @@VERSION 如果你不确定是源数据库的版本,下面的映射表的SQL Server版本的内部版本号,以便 ...

  4. POJ:2377-Bad Cowtractors

    传送门:http://poj.org/problem?id=2377 Bad Cowtractors Time Limit: 1000MS Memory Limit: 65536K Total Sub ...

  5. 笔记-restful

    笔记-restful 1.      restful简介 restful:representational state transfer,简称REST,描述了一个架构样式的网络系统. 值得注意的是RE ...

  6. 12,DBUtils - Python数据库连接池

    创建数据库连接池: import time import pymysql import threading from DBUtils.PooledDB import PooledDB, SharedD ...

  7. 解决 ld: library not found for -lPods的问题

    现在打开有pods建好的workspace文件,尝试编译,会报ld: library not found for -lPods错误,原因就是工程里面的设置项覆盖了pods中xcconfig中的设置.解 ...

  8. Java入门 手把手教你配置环境变量

    很多人觉得配置Java开发的环境变量很麻烦,很容易忘记,时常被它搞得晕头转向.如果出现这样的情况,那么原因只有一个,你不了解为毛需要配置环境变量,不配置环境变量就不能开发了吗? 答案是:NO!,那么下 ...

  9. Java进制间的转换

    最近学习了Java间的进制转换,记录下自己的学习心得,希望可以帮到前来查看的朋友们,如果有不懂的地方可以在下方评论留言,我们一起学习进步,只有自己足够强大才能弥补不足,多学习, 任意进制到十进制的转换 ...

  10. python-isinstance,issubclass

    1 #当存在继承关系时,两个类中存在相同的方法,如何执行父类的方法,通过super 2 class C1: 3 def f1(self): 4 print('c1.f1') 5 6 7 class C ...