generated from OPCODE-Open-Spring-Fest/template
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
you've been presented with an array 1,2,…,b1,b2,…,bn along with a claim from an anonymous source. According to this claim, the array | ||
b was derived from another array 1,2,…,a1,a2,…,an through a series of operations. | ||
|
||
Here's how these operations were carried out: | ||
|
||
Initially, there was an array a. | ||
Then, a two-step process was repeated k times: | ||
A specific position x in the array a was chosen. This position x is called a "fixed point" if | ||
1≤x≤n and ax = x. | ||
The array a was shifted cyclically to the left x times. | ||
After k repetitions of these steps, the array b was obtained. | ||
|
||
Your task is to verify whether this explanation is plausible or if it's definitely incorrect. | ||
|
||
Each test contains multiple test cases. The first line contains an integer t (1≤t≤10^4) — the number of test cases. The description of the test cases follows. | ||
|
||
The first line of each test case contains two integers n,k (1≤n≤2⋅105 , 1≤k≤109) — the length of the array b and the number of operations performed. | ||
|
||
The second line of each test case contains n integers b1,b2,…,bn (1≤bi≤109) — the elements of the array b. | ||
|
||
It is guaranteed that the sum of the values of n for all test cases does not exceed 2⋅105. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Input | ||
6 | ||
5 3 | ||
4 3 3 2 3 | ||
3 100 | ||
7 2 1 | ||
5 5 | ||
6 1 1 1 1 | ||
1 1000000000 | ||
1 | ||
8 48 | ||
9 10 11 12 13 14 15 8 | ||
2 1 | ||
1 42 | ||
|
||
Output | ||
Yes | ||
Yes | ||
No | ||
Yes | ||
Yes | ||
No |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Write Your Code Here |