Other articles


  1. ABC015C

    I solved the problem with DFS using recursion, stack and stack with pruning.

    Main part

        import java.util.Scanner;
        import java.util.Stack;
    
        public class ABC015C {
            static int n, k;
            static int[][] field;
            static boolean[][] visited;
            public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                n = sc …
    read more
  2. ABC095D

    To solve this problem and get full score, O(N) algorithm is needed. Naive solution takes O(N^3) time, however, by calculating information that is independent from the variable we loop through, we get O(N^2) and O(N) algorithms.

    O(N^3)

        public class ABC095D {
            int n …
    read more