-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC.java
65 lines (62 loc) · 1.39 KB
/
C.java
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
58
59
60
61
62
63
64
65
import java.util.*;
import java.io.*;
public class Extermination {
public static void main(String [] args) {
Reader in = new Reader();
Writer out = new Writer();
int t = in.nextInt();
for(int cs = 0; cs < t; cs++) {
int n = in.nextInt();
int [] a = new int [n];
for(int i = 0; i < n; i++) a[i] = in.nextInt();
if(a[0] < a[n - 1]) {
out.writeln("YES");
} else {
out.writeln("NO");
}
}
out.flush();
}
}
class Reader {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer s = new StringTokenizer("");
Reader () {}
String nextLine() {
try {
return in.readLine();
} catch (Exception e) {
e.printStackTrace();
return "Error";
}
}
String next() {
while(!s.hasMoreTokens()) {
s = new StringTokenizer(nextLine());
}
return s.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
}
class Writer {
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
StringBuilder s = new StringBuilder("");
void write(Object variable) {
s.append(variable.toString());
}
void writeln(Object variable) {
write(variable);
s.append("\n");
}
void flush() {
try {
out.write(new String(s));
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}