-
Notifications
You must be signed in to change notification settings - Fork 0
/
Space Arrays
57 lines (40 loc) · 973 Bytes
/
Space Arrays
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner input = new Scanner(System.in);
long t = input.nextLong();
for (long k = 0; k < t; k++) {
int n = input.nextInt();
int [] arr = new int [n];
for (int i = 0; i < arr.length; i++) {
arr[i]= input.nextInt();
}
Arrays.sort(arr);
boolean b = true ;
int sum =0 ;
for (int i = 0; i < arr.length; i++) {
if (arr[i]>(i+1)) {
b = false ;
}
sum+=(arr[i]-(i+1));
}
if (b==false) {
System.out.println("Second");
}
else {
if (sum%2!=0)System.out.println("First");
else System.out.println("Second");
}
}
input.close();
System.exit(0);
}
}