Question: Problem B. Unique set Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Anton has an array a


Problem B. Unique set Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Anton has an array a of size n, where the value of each element is in the range from 1 to k (inclusively). Anton wants to know: is there any segment of size k, containing all the values from 1 to k? If there is such segment, you should print the beginning position of this segment (elements are enumerated from 1). Otherwise, print - 1. If there are different possible answers, then print the minimum value. Input The first line contains two integers n and k (1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
