From 3bf3dc310414e5c5813d1a26a993b9241b72404c Mon Sep 17 00:00:00 2001 From: Roshan Date: Sat, 13 Apr 2024 10:01:46 +0530 Subject: [PATCH] chore: day8 hard --- Hard/Day8/Problem.txt | 21 +++++++++++++++++++++ Hard/Day8/Sample.txt | 22 ++++++++++++++++++++++ Hard/Day8/Solution.cpp | 1 + 3 files changed, 44 insertions(+) create mode 100644 Hard/Day8/Problem.txt create mode 100644 Hard/Day8/Sample.txt create mode 100644 Hard/Day8/Solution.cpp diff --git a/Hard/Day8/Problem.txt b/Hard/Day8/Problem.txt new file mode 100644 index 0000000..f230ae6 --- /dev/null +++ b/Hard/Day8/Problem.txt @@ -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. \ No newline at end of file diff --git a/Hard/Day8/Sample.txt b/Hard/Day8/Sample.txt new file mode 100644 index 0000000..33fd114 --- /dev/null +++ b/Hard/Day8/Sample.txt @@ -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 diff --git a/Hard/Day8/Solution.cpp b/Hard/Day8/Solution.cpp new file mode 100644 index 0000000..fc13810 --- /dev/null +++ b/Hard/Day8/Solution.cpp @@ -0,0 +1 @@ +// Write Your Code Here \ No newline at end of file