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