From bc8f81c2e959913187155a53b5a9a54472343cd4 Mon Sep 17 00:00:00 2001 From: Hara Choi Date: Thu, 23 Dec 2021 14:06:52 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=B5=9C=ED=95=98=EB=9D=BC]=20N=20=EB=B2=88?= =?UTF-8?q?=EC=A7=B8=20=ED=81=B0=20=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\265\234\355\225\230\353\235\274.java" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "solution/BOJ_2075_N\353\262\210\354\247\270-\355\201\260\354\210\230/\354\265\234\355\225\230\353\235\274.java" diff --git "a/solution/BOJ_2075_N\353\262\210\354\247\270-\355\201\260\354\210\230/\354\265\234\355\225\230\353\235\274.java" "b/solution/BOJ_2075_N\353\262\210\354\247\270-\355\201\260\354\210\230/\354\265\234\355\225\230\353\235\274.java" new file mode 100644 index 0000000..c3eb561 --- /dev/null +++ "b/solution/BOJ_2075_N\353\262\210\354\247\270-\355\201\260\354\210\230/\354\265\234\355\225\230\353\235\274.java" @@ -0,0 +1,26 @@ +import java.io.*; +import java.util.*; + +public class Main { + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + + PriorityQueue pq = new PriorityQueue<>(); + for (int i = 0; i < N; i++) { + StringTokenizer st = new StringTokenizer(br.readLine()); + for (int j = 0; j < N; j++) { + int input = Integer.parseInt(st.nextToken()); + if (pq.size() == N) { + if (pq.peek() < input) { + pq.add(input); + pq.poll(); + } + } else { + pq.add(input); + } + } + } + System.out.println(pq.poll()); + } +} \ No newline at end of file