From fb29e88a702ca89d81abde1a7cb155808506e30c Mon Sep 17 00:00:00 2001 From: oncsr Date: Thu, 20 Mar 2025 17:46:22 +0900 Subject: [PATCH] =?UTF-8?q?[20250320]=20BOJ=20/=20G1=20/=20=EB=B2=84?= =?UTF-8?q?=EC=8A=A4=20=EA=B0=88=EC=95=84=ED=83=80=EA=B8=B0=20/=20?= =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...10\354\225\204\355\203\200\352\270\260.md" | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 "khj20006/202503/20 BOJ G1 \353\262\204\354\212\244 \352\260\210\354\225\204\355\203\200\352\270\260.md" diff --git "a/khj20006/202503/20 BOJ G1 \353\262\204\354\212\244 \352\260\210\354\225\204\355\203\200\352\270\260.md" "b/khj20006/202503/20 BOJ G1 \353\262\204\354\212\244 \352\260\210\354\225\204\355\203\200\352\270\260.md" new file mode 100644 index 00000000..c1b02dbc --- /dev/null +++ "b/khj20006/202503/20 BOJ G1 \353\262\204\354\212\244 \352\260\210\354\225\204\355\203\200\352\270\260.md" @@ -0,0 +1,148 @@ +```java + +import java.util.*; +import java.io.*; + +class Bus{ + int x1, y1, x2, y2; + Bus(int x1, int y1, int x2, int y2){ + this.x1 = x1; + this.y1 = y1; + this.x2 = x2; + this.y2 = y2; + } + + boolean intersect(Bus other) { + + if(this.x1 == this.x2 && other.x1 == other.x2) { + if(this.x1 != other.x1) return false; + if(this.y1 > other.y2 || this.y2 < other.y1) return false; + return true; + } + + if(this.y1 == this.y2 && other.y1 == other.y2) { + if(this.y1 != other.y1) return false; + if(this.x1 > other.x2 || this.x2 < other.x1) return false; + return true; + } + + if(this.x1 == this.x2) { + if(other.x1 <= this.x1 && this.x1 <= other.x2 && this.y1 <= other.y1 && other.y1 <= this.y2) { + return true; + } + + return false; + } + if(other.y1 <= this.y1 && this.y1 <= other.y2 && this.x1 <= other.x1 && other.x1 <= this.x2) { + return true; + } + + return false; + } +} + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + if(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int M, N, K, sx, sy, ex, ey; + static Bus[] bs; + static boolean[] starts, ends; + + static boolean[][] V; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + M = nextInt(); + N = nextInt(); + K = nextInt(); + bs = new Bus[K]; + V = new boolean[K][K]; + for(int i=0;i Q = new LinkedList<>(); + boolean[] vis = new boolean[K]; + for(int i=0;i