From e4d62fd50514f8cbd1e91613722c62918d2eaa43 Mon Sep 17 00:00:00 2001 From: Ukj0ng <90972240+Ukj0ng@users.noreply.github.com> Date: Tue, 13 Jan 2026 12:16:22 +0900 Subject: [PATCH] =?UTF-8?q?[20260113]=20BOJ=20/=20G1=20/=20=EA=B5=AC?= =?UTF-8?q?=EB=91=90=20=EC=88=98=EC=84=A0=EA=B3=B5=20/=20=ED=95=9C?= =?UTF-8?q?=EC=A2=85=EC=9A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 \354\210\230\354\204\240\352\263\265.md" | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 "Ukj0ng/202601/13 BOJ G1 \352\265\254\353\221\220 \354\210\230\354\204\240\352\263\265.md" diff --git "a/Ukj0ng/202601/13 BOJ G1 \352\265\254\353\221\220 \354\210\230\354\204\240\352\263\265.md" "b/Ukj0ng/202601/13 BOJ G1 \352\265\254\353\221\220 \354\210\230\354\204\240\352\263\265.md" new file mode 100644 index 00000000..f4f189db --- /dev/null +++ "b/Ukj0ng/202601/13 BOJ G1 \352\265\254\353\221\220 \354\210\230\354\204\240\352\263\265.md" @@ -0,0 +1,55 @@ +``` +import java.io.*; +import java.util.*; + +public class Main { + private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + private static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + private static PriorityQueue pq; + private static int[][] task; + private static int N; + + public static void main(String[] args) throws IOException { + init(); + + while (!pq.isEmpty()) { + bw.write(pq.poll().index + " "); + } + bw.flush(); + bw.close(); + br.close(); + } + + private static void init() throws IOException { + N = Integer.parseInt(br.readLine()); + task = new int[N+1][2]; + + for (int i = 1; i <= N; i++) { + StringTokenizer st = new StringTokenizer(br.readLine()); + task[i][0] = Integer.parseInt(st.nextToken()); + task[i][1] = Integer.parseInt(st.nextToken()); + } + + pq = new PriorityQueue<>((o1, o2) -> { + if (o1.val != o2.val) return Double.compare(o2.val, o1.val); + return Integer.compare(o1.index, o2.index); + }); + + for (int i = 1; i <= N; i++) { + pq.add(new Task(i, (double)task[i][1]/task[i][0], task[i][0])); + } + } + + static class Task { + int index; + double val; + int time; + + public Task(int index, double val, int time) { + this.index = index; + this.val = val; + this.time = time; + } + } +} +```