From 3c5cc26fc0020ba19a9f294823970f254dfd9df8 Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 17 Mar 2026 07:58:50 +0900 Subject: [PATCH] =?UTF-8?q?[20260317]=20BOJ=20/=20P1=20/=20=EC=A7=80?= =?UTF-8?q?=ED=98=95=20=ED=8F=89=ED=83=84=ED=99=94=20=ED=83=90=EC=83=89?= =?UTF-8?q?=EA=B8=B0=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \355\203\220\354\203\211\352\270\260.md" | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 "khj20006/202603/17 BOJ P1 \354\247\200\355\230\225 \355\217\211\355\203\204\355\231\224 \355\203\220\354\203\211\352\270\260.md" diff --git "a/khj20006/202603/17 BOJ P1 \354\247\200\355\230\225 \355\217\211\355\203\204\355\231\224 \355\203\220\354\203\211\352\270\260.md" "b/khj20006/202603/17 BOJ P1 \354\247\200\355\230\225 \355\217\211\355\203\204\355\231\224 \355\203\220\354\203\211\352\270\260.md" new file mode 100644 index 00000000..717f4cca --- /dev/null +++ "b/khj20006/202603/17 BOJ P1 \354\247\200\355\230\225 \355\217\211\355\203\204\355\231\224 \355\203\220\354\203\211\352\270\260.md" @@ -0,0 +1,127 @@ +```java +import java.io.*; +import java.util.*; + +public class BOJ33908 { + + static class Count { + int[] count; + Count() { + count = new int[1953125]; + } + + void add(int value) { + if(value < 0) return; + count[value]++; + } + + void remove(int value) { + if(value < 0) return; + count[value]--; + } + + int get(int value) { + return count[value]; + } + } + + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + + static int N, M, Q; + static int[][] arr; + + static Count[][] type; + + public static void main(String[] args) throws Exception { + // 0. Input + + st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + arr = new int[N][M]; + for(int i=0;i 0) { + st = new StringTokenizer(br.readLine()); + int q = Integer.parseInt(st.nextToken()); + if(q == 1) { + int x = Integer.parseInt(st.nextToken()) - 1; + int y = Integer.parseInt(st.nextToken()) - 1; + int h = Integer.parseInt(st.nextToken()) - 1; + for(int r=1;r<=9;r++) for(int c=1;r*c<=9;c++) { + for(int i=Math.max(x-r+1, 0);i<=Math.min(x, N-r);i++) for(int j=Math.max(y-c+1, 0);j<=Math.min(y, M-c);j++) { + type[r][c].remove(compute(i, j, r, c)); + } + } + arr[x][y] = h; + for(int r=1;r<=9;r++) for(int c=1;r*c<=9;c++) { + for(int i=Math.max(x-r+1, 0);i<=Math.min(x, N-r);i++) for(int j=Math.max(y-c+1, 0);j<=Math.min(y, M-c);j++) { + type[r][c].add(compute(i, j, r, c)); + } + } + } + else { + int r = Integer.parseInt(st.nextToken()); + int c = Integer.parseInt(st.nextToken()); + int[][] arr2 = new int[r][c]; + int min = 4, max = -1; + for(int i=0;i