Is Lisa Learning ?

2.7

37 votes
Easy
Problem

Lisa is learning to count. Uncle John is helping her out to count. In order to test her, he gives her to write the counting from L to R. But since it is her first stage of learning uncle allows her to write the count in any order from L to R.

Since uncle has to go out to market . You need to check whether Lisa has written the counting correctly, despite the order of the elements of the count written by her. You don't know about L and R. The only thing you have is the written text by Lisa

INPUT:
The first line of input contains t denoting the number of test cases . For each test case you are given n denoting the number of elements in the array Next n lines contains the elements of the array. a[0] ,a[1] , ...a[n-1]

OUTPUT :
Print "Correct" if Lisa has done the job nicely else "Wrong"

CONSTRAINTS
0 < t <= 100
0 < n <= 100000
0 <= a[i] <= 100000

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

For test case 1 , the sorted order will be 2 3 4 5 6 7 which is correct for L = 2 and R= 7

For test case 2, the sorted order will be 1 2 3 4 6 which is correct for no values of L and R. Lisa wrote it wrong

Editor Image

?