-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpyDetected.java
32 lines (29 loc) · 889 Bytes
/
SpyDetected.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
import java.util.Scanner;
public class SpyDetected {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
in.nextLine();
for (int t = 0; t < T; t++) {
int Q = in.nextInt();
in.nextLine();
int i = 1, past = in.nextInt();
boolean incremementedEnd = false;
for (int q = 0; q < Q - 1; q++) {
int c = in.nextInt();
if (past != c) {
incremementedEnd = true;
i = q + 1;
}
past = c;
// if (!stopIncrementing)
// i++;
}
if (!incremementedEnd)
i = Q;
System.out.println(i + ", " + incremementedEnd);
in.nextLine();
}
in.close();
}
}