5497: G-Link with Limit
内存限制:256 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:1
解决:1
题目描述
输入
The input consists of multiple test cases.
The first line contains an integer T (1≤T≤100) -- the number of test cases.
For each test case:
In the first line, there is an integer n (1≤n≤105).
In the second line, there are n integers, the i-th integer shows the value of f(i) (1≤f(i)≤n).
It is guaranteed that the sum of n over all test cases will not exceed 106.
The first line contains an integer T (1≤T≤100) -- the number of test cases.
For each test case:
In the first line, there is an integer n (1≤n≤105).
In the second line, there are n integers, the i-th integer shows the value of f(i) (1≤f(i)≤n).
It is guaranteed that the sum of n over all test cases will not exceed 106.
输出
For each test case, output 'YES' if all x have the same power. Otherwise, output 'NO'.
样例输入 复制
2
2
1 2
2
1 1
样例输出 复制
NO
YES