求翻译题面
  • 板块灌水区
  • 楼主Zhu_Ziyu
  • 当前回复7
  • 已保存回复7
  • 发布时间2022/8/6 23:27
  • 上次更新2023/10/27 16:40:52
查看原帖
求翻译题面
665925
Zhu_Ziyu楼主2022/8/6 23:27

RT,百度翻译看不懂

就时我这个蒟蒻看不懂今天CF2,3题题意,求翻译。

第二题:

Consider an array a of n positive integers.

You may perform the following operation:

select two indices l and r (1≤l≤r≤n), then
decrease all elements al,al+1,…,ar by 1.
Let's call f(a) the minimum number of operations needed to change array a into an array of n zeros.

Determine if for all permutations† b of a, f(a)≤f(b) is true.

† An array b is a permutation of an array a if b consists of the elements of a in arbitrary order. For example, [4,2,3,4] is a permutation of [3,2,4,4] while [1,2,2] is not a permutation of [1,2,3].

Input
The first line contains a single integer t (1≤t≤104) — the number of test cases.

The first line of each test case contains a single integer n (1≤n≤105) — the length of the array a.

The second line contains n integers a1,a2,…,an (1≤ai≤109) — description of the array a.

It is guaranteed that the sum of n over all test cases does not exceed 105.

Output
For each test case, print "YES" (without quotes) if for all permutations b of a, f(a)≤f(b) is true, and "NO" (without quotes) otherwise.

You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).

第三题:

A 0-indexed array a of size n is called good if for all valid indices i (0≤i≤n−1), ai+i is a perfect square†.

Given an integer n. Find a permutation‡ p of [0,1,2,…,n−1] that is good or determine that no such permutation exists.

† An integer x is said to be a perfect square if there exists an integer y such that x=y2.

‡ An array b is a permutation of an array a if b consists of the elements of a in arbitrary order. For example, [4,2,3,4] is a permutation of [3,2,4,4] while [1,2,2] is not a permutation of [1,2,3].

Input
The first line contains a single integer t (1≤t≤104) — the number of test cases.

The only line of each test case contains a single integer n (1≤n≤105) — the length of the permutation p.

It is guaranteed that the sum of n over all test cases does not exceed 105.

Output
For each test case, output n distinct integers p0,p1,…,pn−1 (0≤pi≤n−1) — the permutation p — if the answer exists, and −1 otherwise.
2022/8/6 23:27
加载中...