diff --git "a/JHLEE325/202511/26 BOJ G5 \352\260\225\354\235\230\354\213\244.md" "b/JHLEE325/202511/26 BOJ G5 \352\260\225\354\235\230\354\213\244.md" new file mode 100644 index 00000000..6626f078 --- /dev/null +++ "b/JHLEE325/202511/26 BOJ G5 \352\260\225\354\235\230\354\213\244.md" @@ -0,0 +1,45 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + + static class study { + int s, e; + study(int s, int e) { + this.s = s; + this.e = e; + } + } + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st; + int N = Integer.parseInt(br.readLine()); + + study[] arr = new study[N]; + + for (int i = 0; i < N; i++) { + st = new StringTokenizer(br.readLine()); + st.nextToken(); + int s = Integer.parseInt(st.nextToken()); + int e = Integer.parseInt(st.nextToken()); + arr[i] = new study(s, e); + } + + Arrays.sort(arr, (a, b) -> a.s - b.s); + + PriorityQueue pq = new PriorityQueue<>(); + + for (study s : arr) { + if (!pq.isEmpty() && pq.peek() <= s.s) { + pq.poll(); + } + + pq.offer(s.e); + } + + System.out.println(pq.size()); + } +} +```