diff --git "a/suyeun84/202507/16 BOJ G5 \352\260\225\354\235\230\354\213\244 \353\260\260\354\240\225.md" "b/suyeun84/202507/16 BOJ G5 \352\260\225\354\235\230\354\213\244 \353\260\260\354\240\225.md" new file mode 100644 index 00000000..0b1d2077 --- /dev/null +++ "b/suyeun84/202507/16 BOJ G5 \352\260\225\354\235\230\354\213\244 \353\260\260\354\240\225.md" @@ -0,0 +1,43 @@ +```java +import java.util.*; +import java.io.*; + +public class boj11000 { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static StringTokenizer st; + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + + public static void main(String[] args) throws Exception { + nextLine(); + int N = nextInt(); + int answer = 0; + PriorityQueue rooms = new PriorityQueue<>(); + Time[] lec = new Time[N]; + for (int i = 0; i < N; i++) { + nextLine(); + int S = nextInt(); + int T = nextInt(); + lec[i] = new Time(S, T); + } + Arrays.sort(lec, (o1, o2) -> { + if (o1.s == o2.s) return o1.e - o2.e; + else return o1.s - o2.s; + }); + rooms.add(lec[0].e); + for (int i = 1; i < N; i++) { + if (rooms.peek() <= lec[i].s) rooms.poll(); + rooms.add(lec[i].e); + answer = Math.max(answer, rooms.size()); + } + System.out.println(answer); + } + static class Time { + int s, e; + public Time(int s, int e) { + this.s = s; + this.e = e; + } + } +} +```