-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
29 lines (24 loc) · 731 Bytes
/
Main.java
File metadata and controls
29 lines (24 loc) · 731 Bytes
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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int t=0; t<T; t++){
int N = sc.nextInt();
int[] employees = new int[N+1];
for(int i=1; i<N+1; i++){
employees[sc.nextInt()] = sc.nextInt();
}
int cnt = 1;
int priorEmployee = employees[1];
for(int i=2; i<N+1; i++){
if(employees[i] < priorEmployee){
priorEmployee = employees[i];
cnt++;
}
}
System.out.println(cnt);
}
sc.close();
}
}