codechef AUG17 T1 Chef and Rainbow Array
2017-08-04 21:50
1466 查看
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 T5 Chef And Fibonacci Array
- CodeChef Mahesh and his lost array
- [DP] Codechef .Chef And Fibonacci Array
- codechef AUG17 T2 Chef and Mover
- Mongodb: Array and Join
- 【golang学习笔记】slice and array
- Codeforces Round #312 (Div. 2) B. Amr and The Large Array
- cf D. Levko and Array
- Chef Sereja and Sorting 2
- ANSI C, Variable Length Array, Dynamic Memory Allocation, Memory Reservation and Late Binding
- Eugeny and Array
- CC150-Array and string 1.1
- Codeforces Round #331 (Div. 2) B. Wilbur and Array
- Save and read double array in a binary file
- codeforce 558B Amr and The Large Array 思维题
- Levko and Array
- Codeforces Round #284 (Div. 1) C. Array and Operations 二分图最大匹配
- 线段树维护矩阵【CF718C】 Sasha and Array
- Kei编译出错:Symbol array mutiply difined (in main.o and crc.o),
- Given an array of size N in which every number is between 1 and N, determine if there are any dupli