-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContest902A.java
More file actions
45 lines (40 loc) · 1.07 KB
/
Copy pathContest902A.java
File metadata and controls
45 lines (40 loc) · 1.07 KB
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
/**
*
* @author rn-sshawish
*/
public class Contest902A {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int m = input.nextInt();
int [] state = new int[m+2];
for (int i = 0; i < n; i++) {
int start = input.nextInt();
if (start == 0) {
state[start] += 1;
}else{
state[start+1] += 1;
}
state[input.nextInt()+1] += -1;
}
boolean st = true;
for (int i = 1; i <= m; i++) {
state[i] = state[i] + state[i-1];
if (state[i]==0) {
st = false;
break;
}
}
if (st) {
System.out.println("YES");
}else{
System.out.println("No");
}
}
}