Submission #416357

# Submission time Handle Problem Language Result Execution time Memory
416357 2021-06-02T10:36:18 Z model_code Diamond Hands (innopolis2021_final_B) Java 11
100 / 100
879 ms 32704 KB
import java.io.*;
import java.util.*;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Polyline solver = new Polyline();
        solver.solve(1, in, out);
        out.close();
    }

    static class Polyline {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt() + 1;
            int[] x = new int[n];
            int[] y = new int[n];
            for (int i = 1; i < n; i++) {
                x[i] = in.nextInt();
                y[i] = in.nextInt();
            }
            for (int i = 1; i < n; i++) {
                if ((x[i] + y[i] + x[0] + y[0]) % 2 != 0) {
                    out.println(-1);
                    return;
                }
                if (Math.abs(y[i] - y[i - 1]) > x[i] - x[i - 1]) {
                    out.println(-1);
                    return;
                }
            }

            int INF = Integer.MAX_VALUE / 2;
            int[][] dp = new int[2][n];
            int[][] pr = new int[2][n];
            Arrays.fill(dp[0], INF);
            Arrays.fill(dp[1], INF);
            dp[0][0] = 1;
            dp[1][0] = 1;
            // d = 0 -> dy/dx = -1
            // d = 1 -> dy/dx = 1
            for (int i = 0; i < n - 1; i++) {
                for (int d = 0; d < 2; d++) {
                    int dpVal = dp[d][i];
                    if (y[i + 1] - y[i] == (x[i + 1] - x[i]) * (2 * d - 1) && dp[d][i + 1] > dpVal) {
                        dp[d][i + 1] = dpVal;
                        pr[d][i + 1] = d;
                    }
                    if (Math.abs(y[i + 1] - y[i]) < (x[i + 1] - x[i]) && dp[d][i + 1] > dpVal + 2) {
                        dp[d][i + 1] = dpVal + 2;
                        pr[d][i + 1] = d;
                    }
                    if (dp[d ^ 1][i + 1] > dpVal + 1) {
                        dp[d ^ 1][i + 1] = dpVal + 1;
                        pr[d ^ 1][i + 1] = d;
                    }
                }
            }
            List<Integer> ansX = new ArrayList<>(), ansY = new ArrayList<>();
            ansX.add(x[n - 1]);
            ansY.add(y[n - 1]);

            int d = dp[0][n - 1] < dp[1][n - 1] ? 0 : 1;
            for (int i = n - 1; i > 0; i--) {
                int prevD = pr[d][i];
                if (d == prevD) {
                    if (y[i] - y[i - 1] == (x[i] - x[i - 1]) * (2 * d - 1)) {
                        // skip point
                    } else {
                        // two intermediate points
                        int delta = (y[i] - (y[i - 1] + (2 * prevD - 1) * (x[i] - x[i - 1]))) / -(2 * prevD - 1);
                        if (delta % 2 != 0 || delta < 0) {
                            throw new AssertionError();
                        }
                        ansX.add(x[i - 1] + delta / 2);
                        ansY.add(y[i - 1] - delta / 2 * (2 * d - 1));
                        ansX.add(x[i - 1]);
                        ansY.add(y[i - 1]);
                    }
                } else {
                    int delta = (y[i] - (y[i - 1] + (2 * prevD - 1) * (x[i] - x[i - 1]))) / -(2 * prevD - 1);
                    if (delta % 2 != 0 || delta < 0) {
                        throw new AssertionError();
                    }
                    ansX.add(x[i] - delta / 2);
                    ansY.add(y[i] - delta / 2 * (2 * d - 1));
                }
                d = prevD;
            }
            ansX.add(x[0]);
            ansY.add(y[0]);
            Collections.reverse(ansX);
            Collections.reverse(ansY);
            out.println(ansX.size() - 1);
            for (int i = 0; i + 1 < ansX.size(); i++) {
                int l = ansX.get(i + 1) - ansX.get(i);
                char c = ansY.get(i + 1) > ansY.get(i) ? '+' : '-';
                out.println(l + " " + c);
            }
        }

    }

    static class FastScanner {
        public BufferedReader br;
        public StringTokenizer st;

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

        public FastScanner(String fileName) {
            try {
                br = new BufferedReader(new FileReader(fileName));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

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

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

    }
}

# Verdict Execution time Memory Grader output
1 Correct 131 ms 9936 KB OK, n=2 ans=1
2 Correct 126 ms 9672 KB OK, n=3 ans=1
3 Correct 127 ms 9644 KB OK, n=1 ans=1
4 Correct 121 ms 9524 KB OK, n=5 ans=1
5 Correct 125 ms 9924 KB OK, n=8 ans=1
6 Correct 131 ms 9548 KB OK, n=88 ans=1
7 Correct 188 ms 11424 KB OK, n=888 ans=1
8 Correct 248 ms 13140 KB OK, n=2000 ans=1
9 Correct 250 ms 13028 KB OK, n=2000 ans=1
10 Correct 244 ms 13204 KB OK, n=2000 ans=1
11 Correct 243 ms 13340 KB OK, n=2000 ans=1
12 Correct 134 ms 9392 KB OK, n=2 ans=1
13 Correct 134 ms 9356 KB OK, n=34 ans=1
14 Correct 169 ms 11392 KB OK, n=567 ans=1
15 Correct 231 ms 12952 KB OK, n=1234 ans=1
16 Correct 75 ms 8544 KB OK, no solution, n=2
17 Correct 74 ms 8132 KB OK, no solution, n=3
18 Correct 77 ms 8272 KB OK, no solution, n=40
19 Correct 80 ms 8452 KB OK, no solution, n=118
20 Correct 197 ms 11880 KB OK, no solution, n=2000
21 Correct 203 ms 11852 KB OK, no solution, n=2000
# Verdict Execution time Memory Grader output
1 Correct 131 ms 9936 KB OK, n=2 ans=1
2 Correct 126 ms 9672 KB OK, n=3 ans=1
3 Correct 127 ms 9644 KB OK, n=1 ans=1
4 Correct 121 ms 9524 KB OK, n=5 ans=1
5 Correct 125 ms 9924 KB OK, n=8 ans=1
6 Correct 131 ms 9548 KB OK, n=88 ans=1
7 Correct 188 ms 11424 KB OK, n=888 ans=1
8 Correct 248 ms 13140 KB OK, n=2000 ans=1
9 Correct 250 ms 13028 KB OK, n=2000 ans=1
10 Correct 244 ms 13204 KB OK, n=2000 ans=1
11 Correct 243 ms 13340 KB OK, n=2000 ans=1
12 Correct 134 ms 9392 KB OK, n=2 ans=1
13 Correct 134 ms 9356 KB OK, n=34 ans=1
14 Correct 169 ms 11392 KB OK, n=567 ans=1
15 Correct 231 ms 12952 KB OK, n=1234 ans=1
16 Correct 75 ms 8544 KB OK, no solution, n=2
17 Correct 74 ms 8132 KB OK, no solution, n=3
18 Correct 77 ms 8272 KB OK, no solution, n=40
19 Correct 80 ms 8452 KB OK, no solution, n=118
20 Correct 197 ms 11880 KB OK, no solution, n=2000
21 Correct 203 ms 11852 KB OK, no solution, n=2000
22 Correct 124 ms 9664 KB OK, n=2 ans=2
23 Correct 125 ms 9372 KB OK, n=3 ans=2
24 Correct 133 ms 9616 KB OK, n=4 ans=1
25 Correct 129 ms 9736 KB OK, n=5 ans=2
26 Correct 132 ms 9536 KB OK, n=8 ans=2
27 Correct 129 ms 9680 KB OK, n=88 ans=2
28 Correct 199 ms 11512 KB OK, n=888 ans=2
29 Correct 289 ms 13424 KB OK, n=2000 ans=2
30 Correct 266 ms 12940 KB OK, n=2000 ans=2
31 Correct 265 ms 13008 KB OK, n=2000 ans=2
32 Correct 248 ms 12940 KB OK, n=2000 ans=2
33 Correct 132 ms 9400 KB OK, n=2 ans=1
34 Correct 130 ms 9540 KB OK, n=34 ans=2
35 Correct 150 ms 9652 KB OK, n=567 ans=2
36 Correct 247 ms 12816 KB OK, n=1234 ans=2
37 Correct 79 ms 8200 KB OK, no solution, n=6
38 Correct 89 ms 8012 KB OK, no solution, n=10
39 Correct 82 ms 8088 KB OK, no solution, n=50
40 Correct 136 ms 8168 KB OK, no solution, n=333
41 Correct 213 ms 11596 KB OK, no solution, n=2000
42 Correct 203 ms 11716 KB OK, no solution, n=2000
43 Correct 131 ms 9452 KB OK, n=1 ans=2
44 Correct 139 ms 9604 KB OK, n=1 ans=2
# Verdict Execution time Memory Grader output
1 Correct 131 ms 9936 KB OK, n=2 ans=1
2 Correct 126 ms 9672 KB OK, n=3 ans=1
3 Correct 127 ms 9644 KB OK, n=1 ans=1
4 Correct 121 ms 9524 KB OK, n=5 ans=1
5 Correct 125 ms 9924 KB OK, n=8 ans=1
6 Correct 131 ms 9548 KB OK, n=88 ans=1
7 Correct 188 ms 11424 KB OK, n=888 ans=1
8 Correct 248 ms 13140 KB OK, n=2000 ans=1
9 Correct 250 ms 13028 KB OK, n=2000 ans=1
10 Correct 244 ms 13204 KB OK, n=2000 ans=1
11 Correct 243 ms 13340 KB OK, n=2000 ans=1
12 Correct 134 ms 9392 KB OK, n=2 ans=1
13 Correct 134 ms 9356 KB OK, n=34 ans=1
14 Correct 169 ms 11392 KB OK, n=567 ans=1
15 Correct 231 ms 12952 KB OK, n=1234 ans=1
16 Correct 75 ms 8544 KB OK, no solution, n=2
17 Correct 74 ms 8132 KB OK, no solution, n=3
18 Correct 77 ms 8272 KB OK, no solution, n=40
19 Correct 80 ms 8452 KB OK, no solution, n=118
20 Correct 197 ms 11880 KB OK, no solution, n=2000
21 Correct 203 ms 11852 KB OK, no solution, n=2000
22 Correct 131 ms 9300 KB OK, n=4 ans=2
23 Correct 142 ms 9272 KB OK, n=6 ans=2
24 Correct 131 ms 9340 KB OK, n=15 ans=2
25 Correct 140 ms 9388 KB OK, n=200 ans=2
26 Correct 192 ms 11336 KB OK, n=1000 ans=2
27 Correct 451 ms 14468 KB OK, n=10000 ans=2
28 Correct 461 ms 15420 KB OK, n=100000 ans=2
29 Correct 480 ms 17712 KB OK, n=159807 ans=2
30 Correct 530 ms 18724 KB OK, n=200000 ans=2
31 Correct 537 ms 18152 KB OK, n=200000 ans=2
32 Correct 532 ms 17820 KB OK, n=200000 ans=2
33 Correct 125 ms 9480 KB OK, n=3 ans=2
34 Correct 139 ms 9324 KB OK, n=45 ans=2
35 Correct 186 ms 11164 KB OK, n=789 ans=2
36 Correct 254 ms 13140 KB OK, n=2345 ans=2
37 Correct 488 ms 15300 KB OK, n=67890 ans=2
38 Correct 361 ms 15228 KB OK, no solution, n=159807
39 Correct 395 ms 15544 KB OK, no solution, n=200000
40 Correct 393 ms 15540 KB OK, no solution, n=200000
41 Correct 363 ms 15508 KB OK, no solution, n=200000
# Verdict Execution time Memory Grader output
1 Correct 130 ms 9356 KB OK, n=5 ans=3
2 Correct 128 ms 9428 KB OK, n=10 ans=4
3 Correct 132 ms 9532 KB OK, n=20 ans=5
4 Correct 129 ms 9368 KB OK, n=50 ans=9
5 Correct 134 ms 9404 KB OK, n=100 ans=18
6 Correct 147 ms 9464 KB OK, n=200 ans=46
7 Correct 152 ms 9388 KB OK, n=100 ans=5
8 Correct 149 ms 9452 KB OK, n=200 ans=20
9 Correct 154 ms 9476 KB OK, n=400 ans=76
10 Correct 167 ms 9504 KB OK, n=1000 ans=196
11 Correct 183 ms 9508 KB OK, n=1000 ans=434
12 Correct 167 ms 9728 KB OK, n=1000 ans=582
13 Correct 183 ms 9688 KB OK, n=1000 ans=798
14 Correct 166 ms 9540 KB OK, n=1000 ans=867
15 Correct 247 ms 12512 KB OK, n=2000 ans=200
16 Correct 252 ms 12604 KB OK, n=1998 ans=500
17 Correct 250 ms 12624 KB OK, n=2000 ans=800
18 Correct 276 ms 12812 KB OK, n=1995 ans=1000
19 Correct 259 ms 12844 KB OK, n=2000 ans=1500
20 Correct 292 ms 11848 KB OK, n=2000 ans=2000
21 Correct 88 ms 8284 KB OK, no solution, n=10
22 Correct 77 ms 8324 KB OK, no solution, n=50
23 Correct 88 ms 8376 KB OK, no solution, n=400
24 Correct 106 ms 8668 KB OK, no solution, n=1000
25 Correct 186 ms 11316 KB OK, no solution, n=2000
26 Correct 180 ms 11296 KB OK, no solution, n=2000
27 Correct 123 ms 9800 KB OK, n=4 ans=5
28 Correct 126 ms 9556 KB OK, n=30 ans=31
29 Correct 153 ms 9464 KB OK, n=500 ans=501
30 Correct 186 ms 9640 KB OK, n=1000 ans=1001
# Verdict Execution time Memory Grader output
1 Correct 131 ms 9936 KB OK, n=2 ans=1
2 Correct 126 ms 9672 KB OK, n=3 ans=1
3 Correct 127 ms 9644 KB OK, n=1 ans=1
4 Correct 121 ms 9524 KB OK, n=5 ans=1
5 Correct 125 ms 9924 KB OK, n=8 ans=1
6 Correct 131 ms 9548 KB OK, n=88 ans=1
7 Correct 188 ms 11424 KB OK, n=888 ans=1
8 Correct 248 ms 13140 KB OK, n=2000 ans=1
9 Correct 250 ms 13028 KB OK, n=2000 ans=1
10 Correct 244 ms 13204 KB OK, n=2000 ans=1
11 Correct 243 ms 13340 KB OK, n=2000 ans=1
12 Correct 134 ms 9392 KB OK, n=2 ans=1
13 Correct 134 ms 9356 KB OK, n=34 ans=1
14 Correct 169 ms 11392 KB OK, n=567 ans=1
15 Correct 231 ms 12952 KB OK, n=1234 ans=1
16 Correct 75 ms 8544 KB OK, no solution, n=2
17 Correct 74 ms 8132 KB OK, no solution, n=3
18 Correct 77 ms 8272 KB OK, no solution, n=40
19 Correct 80 ms 8452 KB OK, no solution, n=118
20 Correct 197 ms 11880 KB OK, no solution, n=2000
21 Correct 203 ms 11852 KB OK, no solution, n=2000
22 Correct 124 ms 9664 KB OK, n=2 ans=2
23 Correct 125 ms 9372 KB OK, n=3 ans=2
24 Correct 133 ms 9616 KB OK, n=4 ans=1
25 Correct 129 ms 9736 KB OK, n=5 ans=2
26 Correct 132 ms 9536 KB OK, n=8 ans=2
27 Correct 129 ms 9680 KB OK, n=88 ans=2
28 Correct 199 ms 11512 KB OK, n=888 ans=2
29 Correct 289 ms 13424 KB OK, n=2000 ans=2
30 Correct 266 ms 12940 KB OK, n=2000 ans=2
31 Correct 265 ms 13008 KB OK, n=2000 ans=2
32 Correct 248 ms 12940 KB OK, n=2000 ans=2
33 Correct 132 ms 9400 KB OK, n=2 ans=1
34 Correct 130 ms 9540 KB OK, n=34 ans=2
35 Correct 150 ms 9652 KB OK, n=567 ans=2
36 Correct 247 ms 12816 KB OK, n=1234 ans=2
37 Correct 79 ms 8200 KB OK, no solution, n=6
38 Correct 89 ms 8012 KB OK, no solution, n=10
39 Correct 82 ms 8088 KB OK, no solution, n=50
40 Correct 136 ms 8168 KB OK, no solution, n=333
41 Correct 213 ms 11596 KB OK, no solution, n=2000
42 Correct 203 ms 11716 KB OK, no solution, n=2000
43 Correct 131 ms 9452 KB OK, n=1 ans=2
44 Correct 139 ms 9604 KB OK, n=1 ans=2
45 Correct 130 ms 9356 KB OK, n=5 ans=3
46 Correct 128 ms 9428 KB OK, n=10 ans=4
47 Correct 132 ms 9532 KB OK, n=20 ans=5
48 Correct 129 ms 9368 KB OK, n=50 ans=9
49 Correct 134 ms 9404 KB OK, n=100 ans=18
50 Correct 147 ms 9464 KB OK, n=200 ans=46
51 Correct 152 ms 9388 KB OK, n=100 ans=5
52 Correct 149 ms 9452 KB OK, n=200 ans=20
53 Correct 154 ms 9476 KB OK, n=400 ans=76
54 Correct 167 ms 9504 KB OK, n=1000 ans=196
55 Correct 183 ms 9508 KB OK, n=1000 ans=434
56 Correct 167 ms 9728 KB OK, n=1000 ans=582
57 Correct 183 ms 9688 KB OK, n=1000 ans=798
58 Correct 166 ms 9540 KB OK, n=1000 ans=867
59 Correct 247 ms 12512 KB OK, n=2000 ans=200
60 Correct 252 ms 12604 KB OK, n=1998 ans=500
61 Correct 250 ms 12624 KB OK, n=2000 ans=800
62 Correct 276 ms 12812 KB OK, n=1995 ans=1000
63 Correct 259 ms 12844 KB OK, n=2000 ans=1500
64 Correct 292 ms 11848 KB OK, n=2000 ans=2000
65 Correct 88 ms 8284 KB OK, no solution, n=10
66 Correct 77 ms 8324 KB OK, no solution, n=50
67 Correct 88 ms 8376 KB OK, no solution, n=400
68 Correct 106 ms 8668 KB OK, no solution, n=1000
69 Correct 186 ms 11316 KB OK, no solution, n=2000
70 Correct 180 ms 11296 KB OK, no solution, n=2000
71 Correct 123 ms 9800 KB OK, n=4 ans=5
72 Correct 126 ms 9556 KB OK, n=30 ans=31
73 Correct 153 ms 9464 KB OK, n=500 ans=501
74 Correct 186 ms 9640 KB OK, n=1000 ans=1001
75 Correct 242 ms 12808 KB OK, n=2000 ans=1
76 Correct 241 ms 13180 KB OK, n=2000 ans=2
77 Correct 262 ms 13200 KB OK, n=2000 ans=4
78 Correct 246 ms 13196 KB OK, n=2000 ans=10
79 Correct 301 ms 13328 KB OK, n=2000 ans=21
80 Correct 277 ms 13012 KB OK, n=2000 ans=66
81 Correct 260 ms 13092 KB OK, n=2000 ans=200
82 Correct 267 ms 13064 KB OK, n=2000 ans=454
83 Correct 270 ms 13104 KB OK, n=2000 ans=666
84 Correct 260 ms 13080 KB OK, n=2000 ans=818
85 Correct 283 ms 13124 KB OK, n=2000 ans=1027
86 Correct 283 ms 13180 KB OK, n=2000 ans=1198
87 Correct 208 ms 11728 KB OK, no solution, n=2000
88 Correct 199 ms 11940 KB OK, no solution, n=2000
89 Correct 200 ms 11732 KB OK, no solution, n=2000
90 Correct 197 ms 11876 KB OK, no solution, n=2000
91 Correct 128 ms 9480 KB OK, n=20 ans=21
92 Correct 142 ms 9608 KB OK, n=300 ans=301
93 Correct 177 ms 9920 KB OK, n=1000 ans=1001
94 Correct 333 ms 13360 KB OK, n=2000 ans=2001
# Verdict Execution time Memory Grader output
1 Correct 131 ms 9936 KB OK, n=2 ans=1
2 Correct 126 ms 9672 KB OK, n=3 ans=1
3 Correct 127 ms 9644 KB OK, n=1 ans=1
4 Correct 121 ms 9524 KB OK, n=5 ans=1
5 Correct 125 ms 9924 KB OK, n=8 ans=1
6 Correct 131 ms 9548 KB OK, n=88 ans=1
7 Correct 188 ms 11424 KB OK, n=888 ans=1
8 Correct 248 ms 13140 KB OK, n=2000 ans=1
9 Correct 250 ms 13028 KB OK, n=2000 ans=1
10 Correct 244 ms 13204 KB OK, n=2000 ans=1
11 Correct 243 ms 13340 KB OK, n=2000 ans=1
12 Correct 134 ms 9392 KB OK, n=2 ans=1
13 Correct 134 ms 9356 KB OK, n=34 ans=1
14 Correct 169 ms 11392 KB OK, n=567 ans=1
15 Correct 231 ms 12952 KB OK, n=1234 ans=1
16 Correct 75 ms 8544 KB OK, no solution, n=2
17 Correct 74 ms 8132 KB OK, no solution, n=3
18 Correct 77 ms 8272 KB OK, no solution, n=40
19 Correct 80 ms 8452 KB OK, no solution, n=118
20 Correct 197 ms 11880 KB OK, no solution, n=2000
21 Correct 203 ms 11852 KB OK, no solution, n=2000
22 Correct 124 ms 9664 KB OK, n=2 ans=2
23 Correct 125 ms 9372 KB OK, n=3 ans=2
24 Correct 133 ms 9616 KB OK, n=4 ans=1
25 Correct 129 ms 9736 KB OK, n=5 ans=2
26 Correct 132 ms 9536 KB OK, n=8 ans=2
27 Correct 129 ms 9680 KB OK, n=88 ans=2
28 Correct 199 ms 11512 KB OK, n=888 ans=2
29 Correct 289 ms 13424 KB OK, n=2000 ans=2
30 Correct 266 ms 12940 KB OK, n=2000 ans=2
31 Correct 265 ms 13008 KB OK, n=2000 ans=2
32 Correct 248 ms 12940 KB OK, n=2000 ans=2
33 Correct 132 ms 9400 KB OK, n=2 ans=1
34 Correct 130 ms 9540 KB OK, n=34 ans=2
35 Correct 150 ms 9652 KB OK, n=567 ans=2
36 Correct 247 ms 12816 KB OK, n=1234 ans=2
37 Correct 79 ms 8200 KB OK, no solution, n=6
38 Correct 89 ms 8012 KB OK, no solution, n=10
39 Correct 82 ms 8088 KB OK, no solution, n=50
40 Correct 136 ms 8168 KB OK, no solution, n=333
41 Correct 213 ms 11596 KB OK, no solution, n=2000
42 Correct 203 ms 11716 KB OK, no solution, n=2000
43 Correct 131 ms 9452 KB OK, n=1 ans=2
44 Correct 139 ms 9604 KB OK, n=1 ans=2
45 Correct 131 ms 9300 KB OK, n=4 ans=2
46 Correct 142 ms 9272 KB OK, n=6 ans=2
47 Correct 131 ms 9340 KB OK, n=15 ans=2
48 Correct 140 ms 9388 KB OK, n=200 ans=2
49 Correct 192 ms 11336 KB OK, n=1000 ans=2
50 Correct 451 ms 14468 KB OK, n=10000 ans=2
51 Correct 461 ms 15420 KB OK, n=100000 ans=2
52 Correct 480 ms 17712 KB OK, n=159807 ans=2
53 Correct 530 ms 18724 KB OK, n=200000 ans=2
54 Correct 537 ms 18152 KB OK, n=200000 ans=2
55 Correct 532 ms 17820 KB OK, n=200000 ans=2
56 Correct 125 ms 9480 KB OK, n=3 ans=2
57 Correct 139 ms 9324 KB OK, n=45 ans=2
58 Correct 186 ms 11164 KB OK, n=789 ans=2
59 Correct 254 ms 13140 KB OK, n=2345 ans=2
60 Correct 488 ms 15300 KB OK, n=67890 ans=2
61 Correct 361 ms 15228 KB OK, no solution, n=159807
62 Correct 395 ms 15544 KB OK, no solution, n=200000
63 Correct 393 ms 15540 KB OK, no solution, n=200000
64 Correct 363 ms 15508 KB OK, no solution, n=200000
65 Correct 130 ms 9356 KB OK, n=5 ans=3
66 Correct 128 ms 9428 KB OK, n=10 ans=4
67 Correct 132 ms 9532 KB OK, n=20 ans=5
68 Correct 129 ms 9368 KB OK, n=50 ans=9
69 Correct 134 ms 9404 KB OK, n=100 ans=18
70 Correct 147 ms 9464 KB OK, n=200 ans=46
71 Correct 152 ms 9388 KB OK, n=100 ans=5
72 Correct 149 ms 9452 KB OK, n=200 ans=20
73 Correct 154 ms 9476 KB OK, n=400 ans=76
74 Correct 167 ms 9504 KB OK, n=1000 ans=196
75 Correct 183 ms 9508 KB OK, n=1000 ans=434
76 Correct 167 ms 9728 KB OK, n=1000 ans=582
77 Correct 183 ms 9688 KB OK, n=1000 ans=798
78 Correct 166 ms 9540 KB OK, n=1000 ans=867
79 Correct 247 ms 12512 KB OK, n=2000 ans=200
80 Correct 252 ms 12604 KB OK, n=1998 ans=500
81 Correct 250 ms 12624 KB OK, n=2000 ans=800
82 Correct 276 ms 12812 KB OK, n=1995 ans=1000
83 Correct 259 ms 12844 KB OK, n=2000 ans=1500
84 Correct 292 ms 11848 KB OK, n=2000 ans=2000
85 Correct 88 ms 8284 KB OK, no solution, n=10
86 Correct 77 ms 8324 KB OK, no solution, n=50
87 Correct 88 ms 8376 KB OK, no solution, n=400
88 Correct 106 ms 8668 KB OK, no solution, n=1000
89 Correct 186 ms 11316 KB OK, no solution, n=2000
90 Correct 180 ms 11296 KB OK, no solution, n=2000
91 Correct 123 ms 9800 KB OK, n=4 ans=5
92 Correct 126 ms 9556 KB OK, n=30 ans=31
93 Correct 153 ms 9464 KB OK, n=500 ans=501
94 Correct 186 ms 9640 KB OK, n=1000 ans=1001
95 Correct 242 ms 12808 KB OK, n=2000 ans=1
96 Correct 241 ms 13180 KB OK, n=2000 ans=2
97 Correct 262 ms 13200 KB OK, n=2000 ans=4
98 Correct 246 ms 13196 KB OK, n=2000 ans=10
99 Correct 301 ms 13328 KB OK, n=2000 ans=21
100 Correct 277 ms 13012 KB OK, n=2000 ans=66
101 Correct 260 ms 13092 KB OK, n=2000 ans=200
102 Correct 267 ms 13064 KB OK, n=2000 ans=454
103 Correct 270 ms 13104 KB OK, n=2000 ans=666
104 Correct 260 ms 13080 KB OK, n=2000 ans=818
105 Correct 283 ms 13124 KB OK, n=2000 ans=1027
106 Correct 283 ms 13180 KB OK, n=2000 ans=1198
107 Correct 208 ms 11728 KB OK, no solution, n=2000
108 Correct 199 ms 11940 KB OK, no solution, n=2000
109 Correct 200 ms 11732 KB OK, no solution, n=2000
110 Correct 197 ms 11876 KB OK, no solution, n=2000
111 Correct 128 ms 9480 KB OK, n=20 ans=21
112 Correct 142 ms 9608 KB OK, n=300 ans=301
113 Correct 177 ms 9920 KB OK, n=1000 ans=1001
114 Correct 333 ms 13360 KB OK, n=2000 ans=2001
115 Correct 134 ms 9364 KB OK, n=4 ans=3
116 Correct 125 ms 9612 KB OK, n=2 ans=2
117 Correct 77 ms 8116 KB OK, no solution, n=1
118 Correct 472 ms 17976 KB OK, n=200000 ans=1
119 Correct 465 ms 17864 KB OK, n=200000 ans=2
120 Correct 498 ms 18004 KB OK, n=200000 ans=3
121 Correct 494 ms 18072 KB OK, n=200000 ans=4
122 Correct 470 ms 17776 KB OK, n=200000 ans=5
123 Correct 491 ms 18100 KB OK, n=200000 ans=10
124 Correct 516 ms 17976 KB OK, n=200000 ans=20
125 Correct 502 ms 17764 KB OK, n=200000 ans=74
126 Correct 560 ms 17776 KB OK, n=200000 ans=239
127 Correct 485 ms 17764 KB OK, n=200000 ans=500
128 Correct 634 ms 20016 KB OK, n=200000 ans=3998
129 Correct 678 ms 20468 KB OK, n=200000 ans=9964
130 Correct 790 ms 22100 KB OK, n=200000 ans=46259
131 Correct 857 ms 25352 KB OK, n=200000 ans=103531
132 Correct 819 ms 27804 KB OK, n=200000 ans=116810
133 Correct 879 ms 28424 KB OK, n=200000 ans=119975
134 Correct 409 ms 15604 KB OK, no solution, n=200000
135 Correct 368 ms 15668 KB OK, no solution, n=200000
136 Correct 344 ms 15640 KB OK, no solution, n=200000
137 Correct 368 ms 15588 KB OK, no solution, n=200000
138 Correct 375 ms 15768 KB OK, no solution, n=200000
139 Correct 367 ms 15616 KB OK, no solution, n=200000
140 Correct 805 ms 26864 KB OK, n=200000 ans=200001
141 Correct 879 ms 32704 KB OK, n=200000 ans=200001