비트마스킹

    게리맨더링 - 17471번

    게리맨더링 - 17471번

    내 코드 package com.company; import java.io.*; import java.util.*; public class Main { static int N, answer; static int[][] arr; static int[] p; static boolean[] visited; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; N = Integer.parseInt(br.readLine()); p = new int[N + 1]; arr = new in..

    달이 차오른다, 가자. - 1194번

    달이 차오른다, 가자. - 1194번

    package com.company; import java.io.*; import java.util.*; public class Main { static int[][] d = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int M = Integer.parseInt(st.nex..