From d48396b32d1a58ca058ed7d40b4acec384dc05dd Mon Sep 17 00:00:00 2001 From: siwon Date: Tue, 3 Feb 2026 16:56:53 +0900 Subject: [PATCH 1/4] =?UTF-8?q?solve:=20=EC=95=84=EC=8B=9C=EC=95=84=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EC=98=AC=EB=A6=BC=ED=94=BC=EC=95=84=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mun.java" | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 "02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Mun.java" diff --git "a/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Mun.java" "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Mun.java" new file mode 100644 index 0000000..08dec47 --- /dev/null +++ "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Mun.java" @@ -0,0 +1,36 @@ +import java.io.*; +import java.util.*; + +public class Mun { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + ArrayList list = new ArrayList<>(); + for(int i=0;i { + return o2[2] - o1[2]; + }); + StringBuilder sb = new StringBuilder(""); + int[] check = new int[N+1]; + int count = 1; + for(int[] arr : list) { + if(count == 3 && check[arr[0]] == 2) { + continue; + } + check[arr[0]]++; + sb.append(arr[0]).append(" ").append(arr[1]).append("\n"); + count++; + if(count > 3) { + break; + } + } + System.out.print(sb.toString()); + } +} \ No newline at end of file From 0968ff2e1f577dccb21bc0ec803aaf7616058b33 Mon Sep 17 00:00:00 2001 From: siwon Date: Tue, 3 Feb 2026 16:57:07 +0900 Subject: [PATCH 2/4] =?UTF-8?q?solve:=20=EC=98=AC=EB=B0=94=EB=A5=B8=20?= =?UTF-8?q?=EB=B0=B0=EC=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mun.java" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Mun.java" diff --git "a/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Mun.java" "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Mun.java" new file mode 100644 index 0000000..82ea54e --- /dev/null +++ "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Mun.java" @@ -0,0 +1,29 @@ +import java.io.*; +import java.util.*; + +public class Mun { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + HashSet set = new HashSet<>(); + for(int i=0;i iterator = set.iterator(); + int min = 4; + while(iterator.hasNext()) { + long num = iterator.next(); + int p = 4; + for(long i=num+1;i Date: Tue, 3 Feb 2026 16:57:15 +0900 Subject: [PATCH 3/4] =?UTF-8?q?solve:=20=ED=86=B1=EB=8B=88=EB=B0=94?= =?UTF-8?q?=ED=80=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mun.java" | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 "02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Mun.java" diff --git "a/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Mun.java" "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Mun.java" new file mode 100644 index 0000000..fb85511 --- /dev/null +++ "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Mun.java" @@ -0,0 +1,64 @@ +import java.io.*; +import java.util.*; + +public class Mun { + static int[][] cogwheel = new int[4][8]; + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + for(int i=0;i<4;i++) { + String[] input = br.readLine().split(""); + for(int j=0;j<8;j++) { + cogwheel[i][j] = Integer.parseInt(input[j]); + } + } + int K = Integer.parseInt(br.readLine()); + for(int i=0;i que = new LinkedList<>(); + que.add(cr); + while(que.size() > 0) { + int now = que.poll(); + if(now > 0 && change[now-1] == 0 && (cogwheel[now][6] != cogwheel[now-1][2])) { + change[now-1] = change[now] * -1; + que.add(now-1); + } + if(now < 3 && change[now+1] == 0 && (cogwheel[now][2] != cogwheel[now+1][6])) { + change[now+1] = change[now] * -1; + que.add(now+1); + } + } + for(int j=0;j<4;j++) { + Rotation(j, change[j]); + } + } + + int[] score = {1, 2, 4, 8}; + int sum = 0; + for(int i=0;i<4;i++) { + if(cogwheel[i][0] == 1) { + sum+=score[i]; + } + } + System.out.print(sum); + } + + private static void Rotation(int num, int dir) { + if(dir == 0) { + return; + } + int[] copy = cogwheel[num].clone(); + int w = (dir > 0) ? -1 : 1; + for(int i=0;i<8;i++) { + int nuwD = i+w; + if(nuwD < 0) { + nuwD = 7; + } + cogwheel[num][i] = copy[nuwD%8]; + } + } +} \ No newline at end of file From dc3e8673b65b3a3d9c33a7fd29f54acba7989a1f Mon Sep 17 00:00:00 2001 From: siwon Date: Tue, 3 Feb 2026 16:57:26 +0900 Subject: [PATCH 4/4] =?UTF-8?q?solve:=20=EC=B6=A9=EB=8F=8C=EC=9C=84?= =?UTF-8?q?=ED=97=98=EC=B0=BE=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mun.java" | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 "02\354\233\224/1\354\243\274\354\260\250/[PRGRMS] \354\266\251\353\217\214\354\234\204\355\227\230 \354\260\276\352\270\260/Mun.java" diff --git "a/02\354\233\224/1\354\243\274\354\260\250/[PRGRMS] \354\266\251\353\217\214\354\234\204\355\227\230 \354\260\276\352\270\260/Mun.java" "b/02\354\233\224/1\354\243\274\354\260\250/[PRGRMS] \354\266\251\353\217\214\354\234\204\355\227\230 \354\260\276\352\270\260/Mun.java" new file mode 100644 index 0000000..84d8556 --- /dev/null +++ "b/02\354\233\224/1\354\243\274\354\260\250/[PRGRMS] \354\266\251\353\217\214\354\234\204\355\227\230 \354\260\276\352\270\260/Mun.java" @@ -0,0 +1,79 @@ +import java.util.*; + +class Mun { + + class Robot { + int r, c, nextIdx; + boolean exited; + + public Robot(int r, int c, int nextIdx, boolean exited) { + this.r = r; + this.c = c; + this.nextIdx = nextIdx; + this.exited = exited; + } + } + + public int solution(int[][] points, int[][] routes) { + int n = routes.length; + Robot[] robots = new Robot[n]; + + for (int i=0;i count = new HashMap<>(); + boolean allExited = true; + + for(Robot rb : robots) { + if(rb.exited) { + continue; + } + + allExited = false; + int key = rb.r * 1000 + rb.c; + count.put(key, count.getOrDefault(key, 0) + 1); + } + + for(int v : count.values()) { + if(v >= 2) { + danger++; + } + } + + if(allExited) { + break; + } + + for (int i = 0; i < n; i++) { + Robot rb = robots[i]; + if(rb.exited) { + continue; + } + + if(rb.nextIdx == routes[i].length) { + rb.exited = true; + continue; + } + + int[] target = points[routes[i][rb.nextIdx] - 1]; + + if (rb.r != target[0]) { + rb.r += rb.r < target[0] ? 1 : -1; + } else if (rb.c != target[1]) { + rb.c += rb.c < target[1] ? 1 : -1; + } + + if (rb.r == target[0] && rb.c == target[1]) { + rb.nextIdx++; + } + } + } + + return danger; + } +}