From f421ab1ddd6becc340c98ff18dad50b9cce78510 Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Mon, 29 Sep 2025 20:15:12 +0900 Subject: [PATCH] =?UTF-8?q?[20250929]=20BOJ=20/=20G5=20/=20=EC=B5=9C?= =?UTF-8?q?=EC=86=8C=20=ED=9A=8C=EC=9D=98=EC=8B=A4=20=EA=B0=9C=EC=88=98=20?= =?UTF-8?q?/=20=EC=9D=B4=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\230\354\213\244 \352\260\234\354\210\230" | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 "0224LJH/202509/29 BOJ \354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230" diff --git "a/0224LJH/202509/29 BOJ \354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230" "b/0224LJH/202509/29 BOJ \354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230" new file mode 100644 index 00000000..809598d9 --- /dev/null +++ "b/0224LJH/202509/29 BOJ \354\265\234\354\206\214 \355\232\214\354\235\230\354\213\244 \352\260\234\354\210\230" @@ -0,0 +1,80 @@ +```java +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; + +class Main { + + static PriorityQueue mPq = new PriorityQueue<>(); + static int size,ans; + + static class Meeting implements Comparable{ + int start; + int end; + + + public Meeting (int start, int end) { + this.start = start; + this.end = end; + } + + @Override + public int compareTo(Meeting m) { + return Integer.compare(this.start, m.start); + } + } + + + + public static void main(String[] args) throws NumberFormatException, IOException { + init(); + process(); + print(); + + } + + + public static void init() throws NumberFormatException, IOException { + BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); + size = Integer.parseInt(br.readLine()); + + for (int i = 0; i < size; i++) { + StringTokenizer st = new StringTokenizer(br.readLine()); + int start = Integer.parseInt(st.nextToken()); + int end = Integer.parseInt(st.nextToken()); + + Meeting m = new Meeting(start, end); + mPq.add(m); + } + + + } + + public static void process() throws IOException { + PriorityQueue pq = new PriorityQueue<>(); + // pq에 각 회의실 사용이 끝나는 시간을 넣음 -> 가장 작은애가 지금 회의의 시작시간보다 크면 새롭게 추가. 끝. + pq.add(mPq.poll().end); + + while (!mPq.isEmpty()) { + Meeting m = mPq.poll(); + + if ( pq.peek() <= m.start) { + pq.poll(); + } + pq.add(m.end); + + + } + ans = pq.size(); + + + + } + + + public static void print() { + System.out.println(ans); + } +} +```