diff --git "a/khj20006/202509/08 BOJ P1 \355\212\270\353\246\254\354\231\200 XOR \354\277\274\353\246\254.md" "b/khj20006/202509/08 BOJ P1 \355\212\270\353\246\254\354\231\200 XOR \354\277\274\353\246\254.md" new file mode 100644 index 00000000..99775e91 --- /dev/null +++ "b/khj20006/202509/08 BOJ P1 \355\212\270\353\246\254\354\231\200 XOR \354\277\274\353\246\254.md" @@ -0,0 +1,172 @@ +```java +import java.io.*; +import java.util.*; + +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); + } + +} + +public class Main { + + static IOController io; + + // + + static int N, Q; + static int[][] seg, lazy; + static int[] in, out, rev, d, par; + static List[] graph; + static int order = 0; + + public static void main(String[] args) throws Exception { + + io = new IOController(); + + N = io.nextInt(); + graph = new List[N+1]; + in = new int[N+1]; + out = new int[N+1]; + rev = new int[N+1]; + d = new int[N+1]; + par = new int[N+1]; + seg = new int[4*N][20]; + lazy = new int[4*N][20]; + for(int i=1;i<=N;i++) graph[i] = new ArrayList<>(); + for(int i=1;i0;) { + int o = io.nextInt(); + int x = io.nextInt(); + int y = io.nextInt(); + if(o == 1) { + int g = par[x] ^ y; + for(int k=0;k<20;k++) if((g & (1<>1; + init(s,m,n*2,x); + init(m+1,e,n*2+1,x); + seg[n][x] = seg[n*2][x] + seg[n*2+1][x]; + } + + static void prop(int s, int e, int n, int x) { + if(lazy[n][x] != 0) { + seg[n][x] = e-s+1 - seg[n][x]; + if(s != e) { + lazy[n*2][x] ^= 1; + lazy[n*2+1][x] ^= 1; + } + lazy[n][x] = 0; + } + } + + static void update(int s, int e, int l, int r, int n, int x) { + prop(s,e,n,x); + if(l>r || l>e || r>1; + update(s,m,l,r,n*2,x); + update(m+1,e,l,r,n*2+1,x); + seg[n][x] = seg[n*2][x] + seg[n*2+1][x]; + } + + static int find(int s, int e, int l, int r, int n, int x) { + prop(s,e,n,x); + if(l>r || l>e || r>1; + return find(s,m,l,r,n*2,x) + find(m+1,e,l,r,n*2+1,x); + } + +} +```