diff --git "a/khj20006/202507/26 BOJ P4 \354\235\200?\355\226\211 \355\204\270!\354\236\220 2.md" "b/khj20006/202507/26 BOJ P4 \354\235\200?\355\226\211 \355\204\270!\354\236\220 2.md" new file mode 100644 index 00000000..91e2b055 --- /dev/null +++ "b/khj20006/202507/26 BOJ P4 \354\235\200?\355\226\211 \355\204\270!\354\236\220 2.md" @@ -0,0 +1,126 @@ +```java +import java.util.*; +import java.io.*; + +class IOController { + BufferedReader br; + BufferedWriter bw; + StringTokenizer st; + + public IOController() { + br = new BufferedReader(new InputStreamReader(System.in)); + bw = new BufferedWriter(new OutputStreamWriter(System.out)); + st = new StringTokenizer(""); + } + + String nextLine() throws Exception { + String line = br.readLine(); + st = new StringTokenizer(line); + return line; + } + + String nextToken() throws Exception { + while (!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + + int nextInt() throws Exception { + return Integer.parseInt(nextToken()); + } + + long nextLong() throws Exception { + return Long.parseLong(nextToken()); + } + + double nextDouble() throws Exception { + return Double.parseDouble(nextToken()); + } + + void close() throws Exception { + bw.flush(); + bw.close(); + } + + void write(String content) throws Exception { + bw.write(content); + } + +} + +class SegTree { + long[] tree; + SegTree(int size) { + tree = new long[size*4]; + } + + void update(int s, int e, int i, long v, int n) { + if(s == e) { + tree[n] = v; + return; + } + int m = (s+e)>>1; + if(i <= m) update(s,m,i,v,n*2); + else update(m+1,e,i,v,n*2+1); + tree[n] = Math.max(tree[n*2], tree[n*2+1]); + } + + long find(int s, int e, int l, int r, int n) { + if(l>r || l>e || r>1; + return Math.max(find(s,m,l,r,n*2), find(m+1,e,l,r,n*2+1)); + } +} + +public class Main { + + static IOController io; + + // + + static int N; + static long[][] infos; + static SegTree seg; + + public static void main(String[] args) throws Exception { + + io = new IOController(); + + init(); + solve(); + + io.close(); + + } + + static void init() throws Exception { + + N = io.nextInt(); + infos = new long[N][]; + for(int i=0;i { + if(a[1]-a[0] == b[1]-b[0]) { + return Long.compare(a[0],b[0]); + } + return Long.compare(a[1]-a[0],b[1]-b[0]); + }); + + for(int i=0;i