Submission #112988

# Submission time Handle Problem Language Result Execution time Memory
112988 2019-05-23T02:09:48 Z model_code Lock Puzzle (innopolis2018_final_A) Java 11
100 / 100
206 ms 11840 KB
import java.io.*;
import java.util.*;

public class A {

    void solve() {
        int n = in.nextInt(), m = in.nextInt();
        String s = in.next(), t = in.next();
        List<Pair> pairsS = new ArrayList<Pair>(), pairsT = new ArrayList<Pair>();
        for (int i = 0; i < n; i++) {
            pairsS.add(new Pair(s.charAt(i), i));
            pairsT.add(new Pair(t.charAt(i), i));
        }
        Collections.sort(pairsS);
        Collections.sort(pairsT);
        int[] permutation = new int[n];
        for (int i = 0; i < n; i++) {
            if (pairsS.get(i).ch != pairsT.get(i).ch) {
                out.println(-1);
                return;
            }
            permutation[pairsS.get(i).pos] = pairsT.get(i).pos;
        }

        solveForPermutation(permutation);
        out.println(moves.size());
        for (int i : moves) {
            out.print((n - i) + " ");
        }
    }

    List<Integer> moves = new ArrayList<>();

    private void solveForPermutation(int[] permutation) {
        int n = permutation.length;
        int left = permutation[n - 1], right = left;
        int size = 1;
        boolean increasing = true;
        while (size < n - 1) {
            int nextVal = increasing ? (left + n - 1) % n : (left + 1) % n;
            makeAMove(permutation, pos(permutation, nextVal) + 1);
            makeAMove(permutation, 0);
            size++;
            makeAMove(permutation, pos(permutation, left));
            if (size == n - 1) {
                break;
            }

            int newLeft = right;
            int newRight = nextVal;
            left = newLeft;
            right = newRight;
            increasing = !increasing;

            nextVal = increasing ? (left + n - 1) % n : (left + 1) % n;
            makeAMove(permutation, pos(permutation, nextVal));
            makeAMove(permutation, pos(permutation, right) + 1);
            size++;

            left = nextVal;
        }

        finishWithCyclicShift(permutation);
        if (moves.size() > 2.5 * permutation.length) {
            throw new AssertionError();
        }
    }

    private void finishWithCyclicShift(int[] permutation) {
        int n = permutation.length;
        for (int d : new int[]{-1, 1}) {
            boolean ok = true;
            for (int i = 0; i < permutation.length; i++) {
                ok &= (permutation[(i + 1) % n] - permutation[i] + n - d) % n == 0;
            }
            if (ok) {
                if (d == -1) {
                    int size = permutation[0];
                    makeAMove(permutation, size + 1);
                    makeAMove(permutation, n - size - 1);
                } else {
                    int size = n - permutation[0];
                    makeAMove(permutation, size);
                    makeAMove(permutation, n - size);
                    makeAMove(permutation, 0);
                }
                return;
            }
        }
        throw new AssertionError();
    }

    int pos(int[] a, int val) {
        for (int i = 0; i < a.length; i++) {
            if (a[i] == val) {
                return i;
            }
        }
        return -1;
    }

    void makeAMove(int[] a, int pos) {
        moves.add(pos);
        reverse(a, 0, pos - 1);
        reverse(a, 0, a.length - 1);
    }

    void reverse(int[] a, int from, int to) {
        for (int i = from, j = to; i < j; i++, j--) {
            int tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
    }

    class Pair implements Comparable<Pair> {
        char ch;
        int pos;

        public Pair(char ch, int pos) {
            this.ch = ch;
            this.pos = pos;
        }


        @Override
        public int compareTo(Pair o) {
            if (ch != o.ch) {
                return Character.compare(ch, o.ch);
            }
            return Integer.compare(pos, o.pos);
        }
    }

    FastScanner in;
    PrintWriter out;

    void run() {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public boolean hasMoreTokens() {
            while (st == null || !st.hasMoreElements()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    return false;
                }
                if (line == null) {
                    return false;
                }
                st = new StringTokenizer(line);
            }
            return true;
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextInt();
            }
            return ret;
        }
    }


    public static void main(String[] args) {
        new A().run();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 72 ms 9848 KB [n = 1, m = 10000], OK, 2 operations
2 Correct 72 ms 9704 KB [n = 2, m = 10000], OK, 2 operations
3 Correct 74 ms 9684 KB [n = 8, m = 10000], OK, 17 operations
4 Correct 76 ms 9588 KB [n = 8, m = 10000], OK, 17 operations
5 Correct 74 ms 9848 KB [n = 8, m = 10000], OK, 17 operations
6 Correct 75 ms 9820 KB [n = 8, m = 10000], OK: No solution
7 Correct 76 ms 9992 KB [n = 8, m = 10000], OK, 17 operations
8 Correct 78 ms 9672 KB [n = 8, m = 10000], OK, 17 operations
# Verdict Execution time Memory Grader output
1 Correct 72 ms 9848 KB [n = 1, m = 10000], OK, 2 operations
2 Correct 72 ms 9704 KB [n = 2, m = 10000], OK, 2 operations
3 Correct 74 ms 9684 KB [n = 8, m = 10000], OK, 17 operations
4 Correct 76 ms 9588 KB [n = 8, m = 10000], OK, 17 operations
5 Correct 74 ms 9848 KB [n = 8, m = 10000], OK, 17 operations
6 Correct 75 ms 9820 KB [n = 8, m = 10000], OK: No solution
7 Correct 76 ms 9992 KB [n = 8, m = 10000], OK, 17 operations
8 Correct 78 ms 9672 KB [n = 8, m = 10000], OK, 17 operations
9 Correct 84 ms 9664 KB [n = 49, m = 10000], OK, 121 operations
10 Correct 84 ms 9792 KB [n = 50, m = 10000], OK, 123 operations
11 Correct 88 ms 9844 KB [n = 100, m = 10000], OK, 247 operations
12 Correct 89 ms 9764 KB [n = 99, m = 10000], OK, 245 operations
13 Correct 89 ms 9668 KB [n = 50, m = 10000], OK, 123 operations
14 Correct 83 ms 9592 KB [n = 50, m = 10000], OK, 123 operations
15 Correct 78 ms 9636 KB [n = 50, m = 10000], OK: No solution
16 Correct 85 ms 9848 KB [n = 50, m = 10000], OK, 123 operations
17 Correct 83 ms 9800 KB [n = 50, m = 10000], OK, 123 operations
# Verdict Execution time Memory Grader output
1 Correct 72 ms 9848 KB [n = 1, m = 10000], OK, 2 operations
2 Correct 72 ms 9704 KB [n = 2, m = 10000], OK, 2 operations
3 Correct 74 ms 9684 KB [n = 8, m = 10000], OK, 17 operations
4 Correct 76 ms 9588 KB [n = 8, m = 10000], OK, 17 operations
5 Correct 74 ms 9848 KB [n = 8, m = 10000], OK, 17 operations
6 Correct 75 ms 9820 KB [n = 8, m = 10000], OK: No solution
7 Correct 76 ms 9992 KB [n = 8, m = 10000], OK, 17 operations
8 Correct 78 ms 9672 KB [n = 8, m = 10000], OK, 17 operations
9 Correct 84 ms 9664 KB [n = 49, m = 10000], OK, 121 operations
10 Correct 84 ms 9792 KB [n = 50, m = 10000], OK, 123 operations
11 Correct 88 ms 9844 KB [n = 100, m = 10000], OK, 247 operations
12 Correct 89 ms 9764 KB [n = 99, m = 10000], OK, 245 operations
13 Correct 89 ms 9668 KB [n = 50, m = 10000], OK, 123 operations
14 Correct 83 ms 9592 KB [n = 50, m = 10000], OK, 123 operations
15 Correct 78 ms 9636 KB [n = 50, m = 10000], OK: No solution
16 Correct 85 ms 9848 KB [n = 50, m = 10000], OK, 123 operations
17 Correct 83 ms 9800 KB [n = 50, m = 10000], OK, 123 operations
18 Correct 128 ms 10756 KB [n = 1000, m = 10000], OK, 2497 operations
19 Correct 123 ms 11068 KB [n = 999, m = 10000], OK, 2495 operations
20 Correct 126 ms 10892 KB [n = 998, m = 10000], OK, 2493 operations
21 Correct 128 ms 10940 KB [n = 997, m = 10000], OK, 2491 operations
22 Correct 130 ms 10912 KB [n = 1000, m = 10000], OK, 2497 operations
23 Correct 127 ms 11028 KB [n = 1000, m = 10000], OK, 2497 operations
24 Correct 97 ms 9808 KB [n = 1000, m = 10000], OK: No solution
25 Correct 206 ms 11128 KB [n = 1000, m = 10000], OK, 2497 operations
26 Correct 116 ms 11032 KB [n = 1000, m = 10000], OK, 2497 operations
# Verdict Execution time Memory Grader output
1 Correct 72 ms 9848 KB [n = 1, m = 10000], OK, 2 operations
2 Correct 72 ms 9704 KB [n = 2, m = 10000], OK, 2 operations
3 Correct 74 ms 9684 KB [n = 8, m = 10000], OK, 17 operations
4 Correct 76 ms 9588 KB [n = 8, m = 10000], OK, 17 operations
5 Correct 74 ms 9848 KB [n = 8, m = 10000], OK, 17 operations
6 Correct 75 ms 9820 KB [n = 8, m = 10000], OK: No solution
7 Correct 76 ms 9992 KB [n = 8, m = 10000], OK, 17 operations
8 Correct 78 ms 9672 KB [n = 8, m = 10000], OK, 17 operations
9 Correct 84 ms 9664 KB [n = 49, m = 10000], OK, 121 operations
10 Correct 84 ms 9792 KB [n = 50, m = 10000], OK, 123 operations
11 Correct 88 ms 9844 KB [n = 100, m = 10000], OK, 247 operations
12 Correct 89 ms 9764 KB [n = 99, m = 10000], OK, 245 operations
13 Correct 89 ms 9668 KB [n = 50, m = 10000], OK, 123 operations
14 Correct 83 ms 9592 KB [n = 50, m = 10000], OK, 123 operations
15 Correct 78 ms 9636 KB [n = 50, m = 10000], OK: No solution
16 Correct 85 ms 9848 KB [n = 50, m = 10000], OK, 123 operations
17 Correct 83 ms 9800 KB [n = 50, m = 10000], OK, 123 operations
18 Correct 128 ms 10756 KB [n = 1000, m = 10000], OK, 2497 operations
19 Correct 123 ms 11068 KB [n = 999, m = 10000], OK, 2495 operations
20 Correct 126 ms 10892 KB [n = 998, m = 10000], OK, 2493 operations
21 Correct 128 ms 10940 KB [n = 997, m = 10000], OK, 2491 operations
22 Correct 130 ms 10912 KB [n = 1000, m = 10000], OK, 2497 operations
23 Correct 127 ms 11028 KB [n = 1000, m = 10000], OK, 2497 operations
24 Correct 97 ms 9808 KB [n = 1000, m = 10000], OK: No solution
25 Correct 206 ms 11128 KB [n = 1000, m = 10000], OK, 2497 operations
26 Correct 116 ms 11032 KB [n = 1000, m = 10000], OK, 2497 operations
27 Correct 141 ms 11652 KB [n = 2000, m = 10000], OK, 4997 operations
28 Correct 144 ms 11732 KB [n = 1999, m = 10000], OK, 4995 operations
29 Correct 156 ms 11528 KB [n = 1998, m = 10000], OK, 4993 operations
30 Correct 147 ms 11452 KB [n = 1997, m = 10000], OK, 4991 operations
31 Correct 133 ms 11660 KB [n = 2000, m = 10000], OK, 4997 operations
32 Correct 159 ms 11460 KB [n = 2000, m = 10000], OK, 4997 operations
33 Correct 90 ms 10028 KB [n = 2000, m = 10000], OK: No solution
34 Correct 140 ms 11088 KB [n = 2000, m = 10000], OK, 4997 operations
35 Correct 144 ms 11596 KB [n = 2000, m = 10000], OK, 4997 operations
# Verdict Execution time Memory Grader output
1 Correct 72 ms 9848 KB [n = 1, m = 10000], OK, 2 operations
2 Correct 72 ms 9704 KB [n = 2, m = 10000], OK, 2 operations
3 Correct 74 ms 9684 KB [n = 8, m = 10000], OK, 17 operations
4 Correct 76 ms 9588 KB [n = 8, m = 10000], OK, 17 operations
5 Correct 74 ms 9848 KB [n = 8, m = 10000], OK, 17 operations
6 Correct 75 ms 9820 KB [n = 8, m = 10000], OK: No solution
7 Correct 76 ms 9992 KB [n = 8, m = 10000], OK, 17 operations
8 Correct 78 ms 9672 KB [n = 8, m = 10000], OK, 17 operations
9 Correct 84 ms 9664 KB [n = 49, m = 10000], OK, 121 operations
10 Correct 84 ms 9792 KB [n = 50, m = 10000], OK, 123 operations
11 Correct 88 ms 9844 KB [n = 100, m = 10000], OK, 247 operations
12 Correct 89 ms 9764 KB [n = 99, m = 10000], OK, 245 operations
13 Correct 89 ms 9668 KB [n = 50, m = 10000], OK, 123 operations
14 Correct 83 ms 9592 KB [n = 50, m = 10000], OK, 123 operations
15 Correct 78 ms 9636 KB [n = 50, m = 10000], OK: No solution
16 Correct 85 ms 9848 KB [n = 50, m = 10000], OK, 123 operations
17 Correct 83 ms 9800 KB [n = 50, m = 10000], OK, 123 operations
18 Correct 128 ms 10756 KB [n = 1000, m = 10000], OK, 2497 operations
19 Correct 123 ms 11068 KB [n = 999, m = 10000], OK, 2495 operations
20 Correct 126 ms 10892 KB [n = 998, m = 10000], OK, 2493 operations
21 Correct 128 ms 10940 KB [n = 997, m = 10000], OK, 2491 operations
22 Correct 130 ms 10912 KB [n = 1000, m = 10000], OK, 2497 operations
23 Correct 127 ms 11028 KB [n = 1000, m = 10000], OK, 2497 operations
24 Correct 97 ms 9808 KB [n = 1000, m = 10000], OK: No solution
25 Correct 206 ms 11128 KB [n = 1000, m = 10000], OK, 2497 operations
26 Correct 116 ms 11032 KB [n = 1000, m = 10000], OK, 2497 operations
27 Correct 141 ms 11652 KB [n = 2000, m = 10000], OK, 4997 operations
28 Correct 144 ms 11732 KB [n = 1999, m = 10000], OK, 4995 operations
29 Correct 156 ms 11528 KB [n = 1998, m = 10000], OK, 4993 operations
30 Correct 147 ms 11452 KB [n = 1997, m = 10000], OK, 4991 operations
31 Correct 133 ms 11660 KB [n = 2000, m = 10000], OK, 4997 operations
32 Correct 159 ms 11460 KB [n = 2000, m = 10000], OK, 4997 operations
33 Correct 90 ms 10028 KB [n = 2000, m = 10000], OK: No solution
34 Correct 140 ms 11088 KB [n = 2000, m = 10000], OK, 4997 operations
35 Correct 144 ms 11596 KB [n = 2000, m = 10000], OK, 4997 operations
36 Correct 150 ms 11428 KB [n = 2000, m = 8100], OK, 4997 operations
37 Correct 150 ms 11600 KB [n = 1999, m = 8100], OK, 4995 operations
38 Correct 146 ms 11392 KB [n = 1998, m = 8100], OK, 4993 operations
39 Correct 146 ms 11448 KB [n = 1997, m = 8100], OK, 4991 operations
40 Correct 149 ms 11840 KB [n = 1996, m = 8100], OK, 4987 operations
41 Correct 142 ms 11352 KB [n = 2000, m = 8100], OK, 4997 operations
42 Correct 144 ms 11604 KB [n = 2000, m = 8100], OK, 4997 operations
43 Correct 86 ms 9952 KB [n = 2000, m = 8100], OK: No solution
44 Correct 143 ms 11556 KB [n = 2000, m = 8100], OK, 4997 operations
45 Correct 146 ms 11692 KB [n = 2000, m = 8100], OK, 4997 operations
# Verdict Execution time Memory Grader output
1 Correct 72 ms 9848 KB [n = 1, m = 10000], OK, 2 operations
2 Correct 72 ms 9704 KB [n = 2, m = 10000], OK, 2 operations
3 Correct 74 ms 9684 KB [n = 8, m = 10000], OK, 17 operations
4 Correct 76 ms 9588 KB [n = 8, m = 10000], OK, 17 operations
5 Correct 74 ms 9848 KB [n = 8, m = 10000], OK, 17 operations
6 Correct 75 ms 9820 KB [n = 8, m = 10000], OK: No solution
7 Correct 76 ms 9992 KB [n = 8, m = 10000], OK, 17 operations
8 Correct 78 ms 9672 KB [n = 8, m = 10000], OK, 17 operations
9 Correct 84 ms 9664 KB [n = 49, m = 10000], OK, 121 operations
10 Correct 84 ms 9792 KB [n = 50, m = 10000], OK, 123 operations
11 Correct 88 ms 9844 KB [n = 100, m = 10000], OK, 247 operations
12 Correct 89 ms 9764 KB [n = 99, m = 10000], OK, 245 operations
13 Correct 89 ms 9668 KB [n = 50, m = 10000], OK, 123 operations
14 Correct 83 ms 9592 KB [n = 50, m = 10000], OK, 123 operations
15 Correct 78 ms 9636 KB [n = 50, m = 10000], OK: No solution
16 Correct 85 ms 9848 KB [n = 50, m = 10000], OK, 123 operations
17 Correct 83 ms 9800 KB [n = 50, m = 10000], OK, 123 operations
18 Correct 128 ms 10756 KB [n = 1000, m = 10000], OK, 2497 operations
19 Correct 123 ms 11068 KB [n = 999, m = 10000], OK, 2495 operations
20 Correct 126 ms 10892 KB [n = 998, m = 10000], OK, 2493 operations
21 Correct 128 ms 10940 KB [n = 997, m = 10000], OK, 2491 operations
22 Correct 130 ms 10912 KB [n = 1000, m = 10000], OK, 2497 operations
23 Correct 127 ms 11028 KB [n = 1000, m = 10000], OK, 2497 operations
24 Correct 97 ms 9808 KB [n = 1000, m = 10000], OK: No solution
25 Correct 206 ms 11128 KB [n = 1000, m = 10000], OK, 2497 operations
26 Correct 116 ms 11032 KB [n = 1000, m = 10000], OK, 2497 operations
27 Correct 141 ms 11652 KB [n = 2000, m = 10000], OK, 4997 operations
28 Correct 144 ms 11732 KB [n = 1999, m = 10000], OK, 4995 operations
29 Correct 156 ms 11528 KB [n = 1998, m = 10000], OK, 4993 operations
30 Correct 147 ms 11452 KB [n = 1997, m = 10000], OK, 4991 operations
31 Correct 133 ms 11660 KB [n = 2000, m = 10000], OK, 4997 operations
32 Correct 159 ms 11460 KB [n = 2000, m = 10000], OK, 4997 operations
33 Correct 90 ms 10028 KB [n = 2000, m = 10000], OK: No solution
34 Correct 140 ms 11088 KB [n = 2000, m = 10000], OK, 4997 operations
35 Correct 144 ms 11596 KB [n = 2000, m = 10000], OK, 4997 operations
36 Correct 150 ms 11428 KB [n = 2000, m = 8100], OK, 4997 operations
37 Correct 150 ms 11600 KB [n = 1999, m = 8100], OK, 4995 operations
38 Correct 146 ms 11392 KB [n = 1998, m = 8100], OK, 4993 operations
39 Correct 146 ms 11448 KB [n = 1997, m = 8100], OK, 4991 operations
40 Correct 149 ms 11840 KB [n = 1996, m = 8100], OK, 4987 operations
41 Correct 142 ms 11352 KB [n = 2000, m = 8100], OK, 4997 operations
42 Correct 144 ms 11604 KB [n = 2000, m = 8100], OK, 4997 operations
43 Correct 86 ms 9952 KB [n = 2000, m = 8100], OK: No solution
44 Correct 143 ms 11556 KB [n = 2000, m = 8100], OK, 4997 operations
45 Correct 146 ms 11692 KB [n = 2000, m = 8100], OK, 4997 operations
46 Correct 144 ms 11732 KB [n = 2000, m = 6100], OK, 4997 operations
47 Correct 139 ms 11596 KB [n = 1999, m = 6100], OK, 4995 operations
48 Correct 149 ms 11728 KB [n = 1998, m = 6100], OK, 4993 operations
49 Correct 136 ms 11680 KB [n = 1997, m = 6100], OK, 4991 operations
50 Correct 135 ms 11400 KB [n = 1996, m = 6100], OK, 4987 operations
51 Correct 140 ms 11516 KB [n = 2000, m = 6100], OK, 4997 operations
52 Correct 138 ms 11496 KB [n = 2000, m = 6100], OK, 4997 operations
53 Correct 96 ms 10064 KB [n = 2000, m = 6100], OK: No solution
54 Correct 141 ms 11348 KB [n = 2000, m = 6100], OK, 4997 operations
55 Correct 137 ms 11592 KB [n = 2000, m = 6100], OK, 4997 operations
# Verdict Execution time Memory Grader output
1 Correct 72 ms 9848 KB [n = 1, m = 10000], OK, 2 operations
2 Correct 72 ms 9704 KB [n = 2, m = 10000], OK, 2 operations
3 Correct 74 ms 9684 KB [n = 8, m = 10000], OK, 17 operations
4 Correct 76 ms 9588 KB [n = 8, m = 10000], OK, 17 operations
5 Correct 74 ms 9848 KB [n = 8, m = 10000], OK, 17 operations
6 Correct 75 ms 9820 KB [n = 8, m = 10000], OK: No solution
7 Correct 76 ms 9992 KB [n = 8, m = 10000], OK, 17 operations
8 Correct 78 ms 9672 KB [n = 8, m = 10000], OK, 17 operations
9 Correct 84 ms 9664 KB [n = 49, m = 10000], OK, 121 operations
10 Correct 84 ms 9792 KB [n = 50, m = 10000], OK, 123 operations
11 Correct 88 ms 9844 KB [n = 100, m = 10000], OK, 247 operations
12 Correct 89 ms 9764 KB [n = 99, m = 10000], OK, 245 operations
13 Correct 89 ms 9668 KB [n = 50, m = 10000], OK, 123 operations
14 Correct 83 ms 9592 KB [n = 50, m = 10000], OK, 123 operations
15 Correct 78 ms 9636 KB [n = 50, m = 10000], OK: No solution
16 Correct 85 ms 9848 KB [n = 50, m = 10000], OK, 123 operations
17 Correct 83 ms 9800 KB [n = 50, m = 10000], OK, 123 operations
18 Correct 128 ms 10756 KB [n = 1000, m = 10000], OK, 2497 operations
19 Correct 123 ms 11068 KB [n = 999, m = 10000], OK, 2495 operations
20 Correct 126 ms 10892 KB [n = 998, m = 10000], OK, 2493 operations
21 Correct 128 ms 10940 KB [n = 997, m = 10000], OK, 2491 operations
22 Correct 130 ms 10912 KB [n = 1000, m = 10000], OK, 2497 operations
23 Correct 127 ms 11028 KB [n = 1000, m = 10000], OK, 2497 operations
24 Correct 97 ms 9808 KB [n = 1000, m = 10000], OK: No solution
25 Correct 206 ms 11128 KB [n = 1000, m = 10000], OK, 2497 operations
26 Correct 116 ms 11032 KB [n = 1000, m = 10000], OK, 2497 operations
27 Correct 141 ms 11652 KB [n = 2000, m = 10000], OK, 4997 operations
28 Correct 144 ms 11732 KB [n = 1999, m = 10000], OK, 4995 operations
29 Correct 156 ms 11528 KB [n = 1998, m = 10000], OK, 4993 operations
30 Correct 147 ms 11452 KB [n = 1997, m = 10000], OK, 4991 operations
31 Correct 133 ms 11660 KB [n = 2000, m = 10000], OK, 4997 operations
32 Correct 159 ms 11460 KB [n = 2000, m = 10000], OK, 4997 operations
33 Correct 90 ms 10028 KB [n = 2000, m = 10000], OK: No solution
34 Correct 140 ms 11088 KB [n = 2000, m = 10000], OK, 4997 operations
35 Correct 144 ms 11596 KB [n = 2000, m = 10000], OK, 4997 operations
36 Correct 150 ms 11428 KB [n = 2000, m = 8100], OK, 4997 operations
37 Correct 150 ms 11600 KB [n = 1999, m = 8100], OK, 4995 operations
38 Correct 146 ms 11392 KB [n = 1998, m = 8100], OK, 4993 operations
39 Correct 146 ms 11448 KB [n = 1997, m = 8100], OK, 4991 operations
40 Correct 149 ms 11840 KB [n = 1996, m = 8100], OK, 4987 operations
41 Correct 142 ms 11352 KB [n = 2000, m = 8100], OK, 4997 operations
42 Correct 144 ms 11604 KB [n = 2000, m = 8100], OK, 4997 operations
43 Correct 86 ms 9952 KB [n = 2000, m = 8100], OK: No solution
44 Correct 143 ms 11556 KB [n = 2000, m = 8100], OK, 4997 operations
45 Correct 146 ms 11692 KB [n = 2000, m = 8100], OK, 4997 operations
46 Correct 144 ms 11732 KB [n = 2000, m = 6100], OK, 4997 operations
47 Correct 139 ms 11596 KB [n = 1999, m = 6100], OK, 4995 operations
48 Correct 149 ms 11728 KB [n = 1998, m = 6100], OK, 4993 operations
49 Correct 136 ms 11680 KB [n = 1997, m = 6100], OK, 4991 operations
50 Correct 135 ms 11400 KB [n = 1996, m = 6100], OK, 4987 operations
51 Correct 140 ms 11516 KB [n = 2000, m = 6100], OK, 4997 operations
52 Correct 138 ms 11496 KB [n = 2000, m = 6100], OK, 4997 operations
53 Correct 96 ms 10064 KB [n = 2000, m = 6100], OK: No solution
54 Correct 141 ms 11348 KB [n = 2000, m = 6100], OK, 4997 operations
55 Correct 137 ms 11592 KB [n = 2000, m = 6100], OK, 4997 operations
56 Correct 137 ms 11460 KB [n = 2000, m = 5100], OK, 4997 operations
57 Correct 136 ms 11500 KB [n = 1999, m = 5100], OK, 4995 operations
58 Correct 142 ms 11212 KB [n = 1998, m = 5100], OK, 4993 operations
59 Correct 144 ms 11348 KB [n = 1997, m = 5100], OK, 4991 operations
60 Correct 145 ms 11560 KB [n = 1996, m = 5100], OK, 4987 operations
61 Correct 150 ms 11592 KB [n = 1995, m = 5100], OK, 4985 operations
62 Correct 143 ms 11576 KB [n = 1994, m = 5100], OK, 4983 operations
63 Correct 145 ms 11508 KB [n = 2000, m = 5100], OK, 4997 operations
64 Correct 141 ms 11156 KB [n = 2000, m = 5100], OK, 4997 operations
65 Correct 141 ms 11504 KB [n = 2000, m = 5100], OK, 4997 operations
66 Correct 99 ms 9996 KB [n = 2000, m = 5100], OK: No solution
67 Correct 149 ms 11208 KB [n = 2000, m = 5100], OK, 4997 operations