Submission #410361

# Submission time Handle Problem Language Result Execution time Memory
410361 2021-05-22T15:05:31 Z jhwest2 IOI Fever (JOI21_fever) C++14
100 / 100
2345 ms 28992 KB
#include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<int, pint> pip;

const int M = 1e5 + 10;
const int Dx[8] = { 2, 1, 0, -1, -2, -1, 0, 1 };
const int Dy[8] = { 0, 1, 2, 1, 0, -1, -2, -1 };

int n, ans, X[M], Y[M], Dir[M], Dist[M][4], Chk[M];
vector<int> V[8][3];
vector<pint> G[M][4];

int dist(int a, int b) {
    return abs(X[a] - X[b]) + abs(Y[a] - Y[b]);
}
int get_x(int a, int axis) {
    return X[a] * Dx[axis] + Y[a] * Dy[axis];
}
void solve() {
    // 0 = Right, 2 = Up, 4 = Left, 6 = Down;
    // 1 = Right-Up, 3 = Left-Up, 5 = Left-Down, 7 = Right-Down
    for (int i = 2; i <= n; i++) {
        if (Y[i] >= X[i] && Y[i] <= -X[i]) Dir[i] = 0;
        if (Y[i] < X[i] && Y[i] <= -X[i]) Dir[i] = 2;
        if (Y[i] < X[i] && Y[i] > -X[i]) Dir[i] = 4;
        if (Y[i] >= X[i] && Y[i] > -X[i]) Dir[i] = 6;
    }
    // V[i][j] : Vertices with direction j, when we set direction i as right
    // 0 : y = x, 1 : y = 0, 2 : y = -x;
    for (int j = 0; j < 3; j++) {
        for (int i = 0; i < 8; i += 2) V[i][j].clear();
    }
    for (int i = 1; i <= n; i++) {
        V[(Dir[i] + 2) % 8][0].push_back(i);
        V[(Dir[i] + 4) % 8][1].push_back(i);
        V[(Dir[i] + 6) % 8][2].push_back(i);
    }
    for (int i = 0; i < 8; i += 2) {
        for (int j = 0; j < 3; j++) {
            // Direction of x-axis, y-axis
            int dx = (i - j + 7) % 8, dy = (i - j + 9) % 8;
            sort(V[i][j].begin(), V[i][j].end(), [&](int a, int b) {
                pint u = { get_x(a, dx), get_x(a, dy) };
                pint v = { get_x(b, dx), get_x(b, dy) };
                return u < v;
                });
        }
    }
    // Add edges between adjacent vertices
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 3; j++) G[i][j].clear();
    }
    for (int i = 0; i < 8; i += 2) for (int j = 0; j < 3; j++) {
        int dx = (i - j + 7) % 8;
        for (int k = 0; k + 1 < V[i][j].size(); k++) {
            int u = V[i][j][k], v = V[i][j][k + 1];
            if (get_x(u, dx) != get_x(v, dx)) continue;
            G[u][j].emplace_back(dist(u, v) / 2, v);
        }
    }
    /* for (int i = 1; i <= n; i++) {
        cout << i << "!\n";
        for (auto [d, x] : G[i]) {
            cout << d << ' ' << x << '\n';
        }
    } */
    // Run Dijkstra
    priority_queue<pip, vector<pip>, greater<pip>> Q;
    Q.emplace(0, pint(1, 3));
    memset(Dist, -1, sizeof Dist); memset(Chk, 0, sizeof Chk);
    int cnt = 0;
    while (!Q.empty()) {
        auto [d, t] = Q.top(); auto [x, p] = t; Q.pop();
        if (Dist[x][p] != -1) continue; Dist[x][p] = d;
        if (!Chk[x]) ++cnt; Chk[x] = 1;

        // Using adjacent edges
        for (auto [e, y] : G[x][p]) {
            Q.emplace(d + e, pint(y, p));
        }
        // Transfer state
        int i = Dir[x];
        for (int j = 0; j < 3; j++) {
            int dx = (i - j + 7) % 8, dy = (i - j + 9) % 8;
            X[0] = X[x] + Dx[dy] * d;
            Y[0] = Y[x] + Dy[dy] * d;
            auto it = lower_bound(V[i][j].begin(), V[i][j].end(), 0, [&](int a, int b) {
                pint u = { get_x(a, dx), get_x(a, dy) };
                pint v = { get_x(b, dx), get_x(b, dy) };
                return u == v ? a < b : u < v;
                });

            if (it == V[i][j].end() || get_x(0, dx) != get_x(*it, dx)) continue;

            Q.emplace(dist(x, *it) / 2, pint(*it, j));
        }
    }
    ans = max(ans, cnt);
}
int main() {
    cin.tie(0); ios_base::sync_with_stdio(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> X[i] >> Y[i];
        X[i] *= 2; Y[i] *= 2;
        if (i >= 2) X[i] -= X[1], Y[i] -= Y[1];
    }
    X[1] = Y[1] = 0;
    for (int i = 0; i < 4; i++) {
        solve();
        // Rotate 90 degrees
        for (int j = 2; j <= n; j++) {
            swap(X[j], Y[j]); Y[j] = -Y[j];
        }
    }
    cout << ans << '\n';
}

Compilation message

fever.cpp: In function 'void solve()':
fever.cpp:59:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         for (int k = 0; k + 1 < V[i][j].size(); k++) {
      |                         ~~~~~~^~~~~~~~~~~~~~~~
fever.cpp:77:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   77 |         auto [d, t] = Q.top(); auto [x, p] = t; Q.pop();
      |              ^
fever.cpp:77:37: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   77 |         auto [d, t] = Q.top(); auto [x, p] = t; Q.pop();
      |                                     ^
fever.cpp:78:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   78 |         if (Dist[x][p] != -1) continue; Dist[x][p] = d;
      |         ^~
fever.cpp:78:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   78 |         if (Dist[x][p] != -1) continue; Dist[x][p] = d;
      |                                         ^~~~
fever.cpp:79:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   79 |         if (!Chk[x]) ++cnt; Chk[x] = 1;
      |         ^~
fever.cpp:79:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   79 |         if (!Chk[x]) ++cnt; Chk[x] = 1;
      |                             ^~~
fever.cpp:82:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   82 |         for (auto [e, y] : G[x][p]) {
      |                   ^
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11576 KB Output is correct
2 Correct 8 ms 11596 KB Output is correct
3 Correct 8 ms 11612 KB Output is correct
4 Correct 8 ms 11596 KB Output is correct
5 Correct 8 ms 11596 KB Output is correct
6 Correct 8 ms 11596 KB Output is correct
7 Correct 8 ms 11596 KB Output is correct
8 Correct 8 ms 11596 KB Output is correct
9 Correct 8 ms 11596 KB Output is correct
10 Correct 8 ms 11596 KB Output is correct
11 Correct 8 ms 11596 KB Output is correct
12 Correct 8 ms 11596 KB Output is correct
13 Correct 8 ms 11680 KB Output is correct
14 Correct 8 ms 11596 KB Output is correct
15 Correct 8 ms 11596 KB Output is correct
16 Correct 8 ms 11596 KB Output is correct
17 Correct 8 ms 11596 KB Output is correct
18 Correct 8 ms 11596 KB Output is correct
19 Correct 8 ms 11680 KB Output is correct
20 Correct 8 ms 11596 KB Output is correct
21 Correct 9 ms 11672 KB Output is correct
22 Correct 8 ms 11596 KB Output is correct
23 Correct 8 ms 11596 KB Output is correct
24 Correct 8 ms 11584 KB Output is correct
25 Correct 8 ms 11596 KB Output is correct
26 Correct 8 ms 11572 KB Output is correct
27 Correct 8 ms 11596 KB Output is correct
28 Correct 8 ms 11672 KB Output is correct
29 Correct 7 ms 11596 KB Output is correct
30 Correct 8 ms 11596 KB Output is correct
31 Correct 8 ms 11596 KB Output is correct
32 Correct 8 ms 11596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11576 KB Output is correct
2 Correct 8 ms 11596 KB Output is correct
3 Correct 8 ms 11612 KB Output is correct
4 Correct 8 ms 11596 KB Output is correct
5 Correct 8 ms 11596 KB Output is correct
6 Correct 8 ms 11596 KB Output is correct
7 Correct 8 ms 11596 KB Output is correct
8 Correct 8 ms 11596 KB Output is correct
9 Correct 8 ms 11596 KB Output is correct
10 Correct 8 ms 11596 KB Output is correct
11 Correct 8 ms 11596 KB Output is correct
12 Correct 8 ms 11596 KB Output is correct
13 Correct 8 ms 11680 KB Output is correct
14 Correct 8 ms 11596 KB Output is correct
15 Correct 8 ms 11596 KB Output is correct
16 Correct 8 ms 11596 KB Output is correct
17 Correct 8 ms 11596 KB Output is correct
18 Correct 8 ms 11596 KB Output is correct
19 Correct 8 ms 11680 KB Output is correct
20 Correct 8 ms 11596 KB Output is correct
21 Correct 9 ms 11672 KB Output is correct
22 Correct 8 ms 11596 KB Output is correct
23 Correct 8 ms 11596 KB Output is correct
24 Correct 8 ms 11584 KB Output is correct
25 Correct 8 ms 11596 KB Output is correct
26 Correct 8 ms 11572 KB Output is correct
27 Correct 8 ms 11596 KB Output is correct
28 Correct 8 ms 11672 KB Output is correct
29 Correct 7 ms 11596 KB Output is correct
30 Correct 8 ms 11596 KB Output is correct
31 Correct 8 ms 11596 KB Output is correct
32 Correct 8 ms 11596 KB Output is correct
33 Correct 8 ms 11596 KB Output is correct
34 Correct 9 ms 11652 KB Output is correct
35 Correct 8 ms 11596 KB Output is correct
36 Correct 8 ms 11596 KB Output is correct
37 Correct 8 ms 11596 KB Output is correct
38 Correct 8 ms 11620 KB Output is correct
39 Correct 9 ms 11596 KB Output is correct
40 Correct 8 ms 11596 KB Output is correct
41 Correct 8 ms 11596 KB Output is correct
42 Correct 8 ms 11564 KB Output is correct
43 Correct 8 ms 11596 KB Output is correct
44 Correct 8 ms 11596 KB Output is correct
45 Correct 8 ms 11640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11584 KB Output is correct
2 Correct 8 ms 11596 KB Output is correct
3 Correct 8 ms 11668 KB Output is correct
4 Correct 8 ms 11596 KB Output is correct
5 Correct 8 ms 11596 KB Output is correct
6 Correct 8 ms 11596 KB Output is correct
7 Correct 8 ms 11596 KB Output is correct
8 Correct 8 ms 11596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11576 KB Output is correct
2 Correct 8 ms 11596 KB Output is correct
3 Correct 8 ms 11612 KB Output is correct
4 Correct 8 ms 11596 KB Output is correct
5 Correct 8 ms 11596 KB Output is correct
6 Correct 8 ms 11596 KB Output is correct
7 Correct 8 ms 11596 KB Output is correct
8 Correct 8 ms 11596 KB Output is correct
9 Correct 8 ms 11596 KB Output is correct
10 Correct 8 ms 11596 KB Output is correct
11 Correct 8 ms 11596 KB Output is correct
12 Correct 8 ms 11596 KB Output is correct
13 Correct 8 ms 11680 KB Output is correct
14 Correct 8 ms 11596 KB Output is correct
15 Correct 8 ms 11596 KB Output is correct
16 Correct 8 ms 11596 KB Output is correct
17 Correct 8 ms 11596 KB Output is correct
18 Correct 8 ms 11596 KB Output is correct
19 Correct 8 ms 11680 KB Output is correct
20 Correct 8 ms 11596 KB Output is correct
21 Correct 9 ms 11672 KB Output is correct
22 Correct 8 ms 11596 KB Output is correct
23 Correct 8 ms 11596 KB Output is correct
24 Correct 8 ms 11584 KB Output is correct
25 Correct 8 ms 11596 KB Output is correct
26 Correct 8 ms 11572 KB Output is correct
27 Correct 8 ms 11596 KB Output is correct
28 Correct 8 ms 11672 KB Output is correct
29 Correct 7 ms 11596 KB Output is correct
30 Correct 8 ms 11596 KB Output is correct
31 Correct 8 ms 11596 KB Output is correct
32 Correct 8 ms 11596 KB Output is correct
33 Correct 8 ms 11596 KB Output is correct
34 Correct 9 ms 11652 KB Output is correct
35 Correct 8 ms 11596 KB Output is correct
36 Correct 8 ms 11596 KB Output is correct
37 Correct 8 ms 11596 KB Output is correct
38 Correct 8 ms 11620 KB Output is correct
39 Correct 9 ms 11596 KB Output is correct
40 Correct 8 ms 11596 KB Output is correct
41 Correct 8 ms 11596 KB Output is correct
42 Correct 8 ms 11564 KB Output is correct
43 Correct 8 ms 11596 KB Output is correct
44 Correct 8 ms 11596 KB Output is correct
45 Correct 8 ms 11640 KB Output is correct
46 Correct 8 ms 11584 KB Output is correct
47 Correct 8 ms 11596 KB Output is correct
48 Correct 8 ms 11668 KB Output is correct
49 Correct 8 ms 11596 KB Output is correct
50 Correct 8 ms 11596 KB Output is correct
51 Correct 8 ms 11596 KB Output is correct
52 Correct 8 ms 11596 KB Output is correct
53 Correct 8 ms 11596 KB Output is correct
54 Correct 8 ms 11596 KB Output is correct
55 Correct 8 ms 11596 KB Output is correct
56 Correct 8 ms 11664 KB Output is correct
57 Correct 8 ms 11640 KB Output is correct
58 Correct 8 ms 11596 KB Output is correct
59 Correct 8 ms 11596 KB Output is correct
60 Correct 8 ms 11596 KB Output is correct
61 Correct 8 ms 11596 KB Output is correct
62 Correct 8 ms 11596 KB Output is correct
63 Correct 8 ms 11600 KB Output is correct
64 Correct 8 ms 11596 KB Output is correct
65 Correct 8 ms 11572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11576 KB Output is correct
2 Correct 8 ms 11596 KB Output is correct
3 Correct 8 ms 11612 KB Output is correct
4 Correct 8 ms 11596 KB Output is correct
5 Correct 8 ms 11596 KB Output is correct
6 Correct 8 ms 11596 KB Output is correct
7 Correct 8 ms 11596 KB Output is correct
8 Correct 8 ms 11596 KB Output is correct
9 Correct 8 ms 11596 KB Output is correct
10 Correct 8 ms 11596 KB Output is correct
11 Correct 8 ms 11596 KB Output is correct
12 Correct 8 ms 11596 KB Output is correct
13 Correct 8 ms 11680 KB Output is correct
14 Correct 8 ms 11596 KB Output is correct
15 Correct 8 ms 11596 KB Output is correct
16 Correct 8 ms 11596 KB Output is correct
17 Correct 8 ms 11596 KB Output is correct
18 Correct 8 ms 11596 KB Output is correct
19 Correct 8 ms 11680 KB Output is correct
20 Correct 8 ms 11596 KB Output is correct
21 Correct 9 ms 11672 KB Output is correct
22 Correct 8 ms 11596 KB Output is correct
23 Correct 8 ms 11596 KB Output is correct
24 Correct 8 ms 11584 KB Output is correct
25 Correct 8 ms 11596 KB Output is correct
26 Correct 8 ms 11572 KB Output is correct
27 Correct 8 ms 11596 KB Output is correct
28 Correct 8 ms 11672 KB Output is correct
29 Correct 7 ms 11596 KB Output is correct
30 Correct 8 ms 11596 KB Output is correct
31 Correct 8 ms 11596 KB Output is correct
32 Correct 8 ms 11596 KB Output is correct
33 Correct 8 ms 11596 KB Output is correct
34 Correct 9 ms 11652 KB Output is correct
35 Correct 8 ms 11596 KB Output is correct
36 Correct 8 ms 11596 KB Output is correct
37 Correct 8 ms 11596 KB Output is correct
38 Correct 8 ms 11620 KB Output is correct
39 Correct 9 ms 11596 KB Output is correct
40 Correct 8 ms 11596 KB Output is correct
41 Correct 8 ms 11596 KB Output is correct
42 Correct 8 ms 11564 KB Output is correct
43 Correct 8 ms 11596 KB Output is correct
44 Correct 8 ms 11596 KB Output is correct
45 Correct 8 ms 11640 KB Output is correct
46 Correct 8 ms 11584 KB Output is correct
47 Correct 8 ms 11596 KB Output is correct
48 Correct 8 ms 11668 KB Output is correct
49 Correct 8 ms 11596 KB Output is correct
50 Correct 8 ms 11596 KB Output is correct
51 Correct 8 ms 11596 KB Output is correct
52 Correct 8 ms 11596 KB Output is correct
53 Correct 8 ms 11596 KB Output is correct
54 Correct 8 ms 11596 KB Output is correct
55 Correct 8 ms 11596 KB Output is correct
56 Correct 8 ms 11664 KB Output is correct
57 Correct 8 ms 11640 KB Output is correct
58 Correct 8 ms 11596 KB Output is correct
59 Correct 8 ms 11596 KB Output is correct
60 Correct 8 ms 11596 KB Output is correct
61 Correct 8 ms 11596 KB Output is correct
62 Correct 8 ms 11596 KB Output is correct
63 Correct 8 ms 11600 KB Output is correct
64 Correct 8 ms 11596 KB Output is correct
65 Correct 8 ms 11572 KB Output is correct
66 Correct 14 ms 11828 KB Output is correct
67 Correct 14 ms 11968 KB Output is correct
68 Correct 13 ms 11912 KB Output is correct
69 Correct 40 ms 12108 KB Output is correct
70 Correct 19 ms 12084 KB Output is correct
71 Correct 18 ms 12028 KB Output is correct
72 Correct 15 ms 11892 KB Output is correct
73 Correct 13 ms 11844 KB Output is correct
74 Correct 15 ms 12108 KB Output is correct
75 Correct 16 ms 12044 KB Output is correct
76 Correct 14 ms 11852 KB Output is correct
77 Correct 15 ms 11980 KB Output is correct
78 Correct 15 ms 11852 KB Output is correct
79 Correct 14 ms 11888 KB Output is correct
80 Correct 13 ms 11784 KB Output is correct
81 Correct 15 ms 11784 KB Output is correct
82 Correct 15 ms 12088 KB Output is correct
83 Correct 15 ms 12040 KB Output is correct
84 Correct 12 ms 12168 KB Output is correct
85 Correct 15 ms 12168 KB Output is correct
86 Correct 14 ms 12108 KB Output is correct
87 Correct 13 ms 12168 KB Output is correct
88 Correct 13 ms 12092 KB Output is correct
89 Correct 15 ms 11856 KB Output is correct
90 Correct 15 ms 11724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11576 KB Output is correct
2 Correct 8 ms 11596 KB Output is correct
3 Correct 8 ms 11612 KB Output is correct
4 Correct 8 ms 11596 KB Output is correct
5 Correct 8 ms 11596 KB Output is correct
6 Correct 8 ms 11596 KB Output is correct
7 Correct 8 ms 11596 KB Output is correct
8 Correct 8 ms 11596 KB Output is correct
9 Correct 8 ms 11596 KB Output is correct
10 Correct 8 ms 11596 KB Output is correct
11 Correct 8 ms 11596 KB Output is correct
12 Correct 8 ms 11596 KB Output is correct
13 Correct 8 ms 11680 KB Output is correct
14 Correct 8 ms 11596 KB Output is correct
15 Correct 8 ms 11596 KB Output is correct
16 Correct 8 ms 11596 KB Output is correct
17 Correct 8 ms 11596 KB Output is correct
18 Correct 8 ms 11596 KB Output is correct
19 Correct 8 ms 11680 KB Output is correct
20 Correct 8 ms 11596 KB Output is correct
21 Correct 9 ms 11672 KB Output is correct
22 Correct 8 ms 11596 KB Output is correct
23 Correct 8 ms 11596 KB Output is correct
24 Correct 8 ms 11584 KB Output is correct
25 Correct 8 ms 11596 KB Output is correct
26 Correct 8 ms 11572 KB Output is correct
27 Correct 8 ms 11596 KB Output is correct
28 Correct 8 ms 11672 KB Output is correct
29 Correct 7 ms 11596 KB Output is correct
30 Correct 8 ms 11596 KB Output is correct
31 Correct 8 ms 11596 KB Output is correct
32 Correct 8 ms 11596 KB Output is correct
33 Correct 8 ms 11596 KB Output is correct
34 Correct 9 ms 11652 KB Output is correct
35 Correct 8 ms 11596 KB Output is correct
36 Correct 8 ms 11596 KB Output is correct
37 Correct 8 ms 11596 KB Output is correct
38 Correct 8 ms 11620 KB Output is correct
39 Correct 9 ms 11596 KB Output is correct
40 Correct 8 ms 11596 KB Output is correct
41 Correct 8 ms 11596 KB Output is correct
42 Correct 8 ms 11564 KB Output is correct
43 Correct 8 ms 11596 KB Output is correct
44 Correct 8 ms 11596 KB Output is correct
45 Correct 8 ms 11640 KB Output is correct
46 Correct 8 ms 11584 KB Output is correct
47 Correct 8 ms 11596 KB Output is correct
48 Correct 8 ms 11668 KB Output is correct
49 Correct 8 ms 11596 KB Output is correct
50 Correct 8 ms 11596 KB Output is correct
51 Correct 8 ms 11596 KB Output is correct
52 Correct 8 ms 11596 KB Output is correct
53 Correct 8 ms 11596 KB Output is correct
54 Correct 8 ms 11596 KB Output is correct
55 Correct 8 ms 11596 KB Output is correct
56 Correct 8 ms 11664 KB Output is correct
57 Correct 8 ms 11640 KB Output is correct
58 Correct 8 ms 11596 KB Output is correct
59 Correct 8 ms 11596 KB Output is correct
60 Correct 8 ms 11596 KB Output is correct
61 Correct 8 ms 11596 KB Output is correct
62 Correct 8 ms 11596 KB Output is correct
63 Correct 8 ms 11600 KB Output is correct
64 Correct 8 ms 11596 KB Output is correct
65 Correct 8 ms 11572 KB Output is correct
66 Correct 226 ms 15940 KB Output is correct
67 Correct 311 ms 17824 KB Output is correct
68 Correct 299 ms 17992 KB Output is correct
69 Correct 363 ms 24112 KB Output is correct
70 Correct 444 ms 23292 KB Output is correct
71 Correct 277 ms 17464 KB Output is correct
72 Correct 281 ms 16824 KB Output is correct
73 Correct 364 ms 22168 KB Output is correct
74 Correct 279 ms 17048 KB Output is correct
75 Correct 287 ms 16516 KB Output is correct
76 Correct 376 ms 19440 KB Output is correct
77 Correct 279 ms 16452 KB Output is correct
78 Correct 371 ms 16600 KB Output is correct
79 Correct 369 ms 16424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11576 KB Output is correct
2 Correct 8 ms 11596 KB Output is correct
3 Correct 8 ms 11612 KB Output is correct
4 Correct 8 ms 11596 KB Output is correct
5 Correct 8 ms 11596 KB Output is correct
6 Correct 8 ms 11596 KB Output is correct
7 Correct 8 ms 11596 KB Output is correct
8 Correct 8 ms 11596 KB Output is correct
9 Correct 8 ms 11596 KB Output is correct
10 Correct 8 ms 11596 KB Output is correct
11 Correct 8 ms 11596 KB Output is correct
12 Correct 8 ms 11596 KB Output is correct
13 Correct 8 ms 11680 KB Output is correct
14 Correct 8 ms 11596 KB Output is correct
15 Correct 8 ms 11596 KB Output is correct
16 Correct 8 ms 11596 KB Output is correct
17 Correct 8 ms 11596 KB Output is correct
18 Correct 8 ms 11596 KB Output is correct
19 Correct 8 ms 11680 KB Output is correct
20 Correct 8 ms 11596 KB Output is correct
21 Correct 9 ms 11672 KB Output is correct
22 Correct 8 ms 11596 KB Output is correct
23 Correct 8 ms 11596 KB Output is correct
24 Correct 8 ms 11584 KB Output is correct
25 Correct 8 ms 11596 KB Output is correct
26 Correct 8 ms 11572 KB Output is correct
27 Correct 8 ms 11596 KB Output is correct
28 Correct 8 ms 11672 KB Output is correct
29 Correct 7 ms 11596 KB Output is correct
30 Correct 8 ms 11596 KB Output is correct
31 Correct 8 ms 11596 KB Output is correct
32 Correct 8 ms 11596 KB Output is correct
33 Correct 8 ms 11596 KB Output is correct
34 Correct 9 ms 11652 KB Output is correct
35 Correct 8 ms 11596 KB Output is correct
36 Correct 8 ms 11596 KB Output is correct
37 Correct 8 ms 11596 KB Output is correct
38 Correct 8 ms 11620 KB Output is correct
39 Correct 9 ms 11596 KB Output is correct
40 Correct 8 ms 11596 KB Output is correct
41 Correct 8 ms 11596 KB Output is correct
42 Correct 8 ms 11564 KB Output is correct
43 Correct 8 ms 11596 KB Output is correct
44 Correct 8 ms 11596 KB Output is correct
45 Correct 8 ms 11640 KB Output is correct
46 Correct 8 ms 11584 KB Output is correct
47 Correct 8 ms 11596 KB Output is correct
48 Correct 8 ms 11668 KB Output is correct
49 Correct 8 ms 11596 KB Output is correct
50 Correct 8 ms 11596 KB Output is correct
51 Correct 8 ms 11596 KB Output is correct
52 Correct 8 ms 11596 KB Output is correct
53 Correct 8 ms 11596 KB Output is correct
54 Correct 8 ms 11596 KB Output is correct
55 Correct 8 ms 11596 KB Output is correct
56 Correct 8 ms 11664 KB Output is correct
57 Correct 8 ms 11640 KB Output is correct
58 Correct 8 ms 11596 KB Output is correct
59 Correct 8 ms 11596 KB Output is correct
60 Correct 8 ms 11596 KB Output is correct
61 Correct 8 ms 11596 KB Output is correct
62 Correct 8 ms 11596 KB Output is correct
63 Correct 8 ms 11600 KB Output is correct
64 Correct 8 ms 11596 KB Output is correct
65 Correct 8 ms 11572 KB Output is correct
66 Correct 14 ms 11828 KB Output is correct
67 Correct 14 ms 11968 KB Output is correct
68 Correct 13 ms 11912 KB Output is correct
69 Correct 40 ms 12108 KB Output is correct
70 Correct 19 ms 12084 KB Output is correct
71 Correct 18 ms 12028 KB Output is correct
72 Correct 15 ms 11892 KB Output is correct
73 Correct 13 ms 11844 KB Output is correct
74 Correct 15 ms 12108 KB Output is correct
75 Correct 16 ms 12044 KB Output is correct
76 Correct 14 ms 11852 KB Output is correct
77 Correct 15 ms 11980 KB Output is correct
78 Correct 15 ms 11852 KB Output is correct
79 Correct 14 ms 11888 KB Output is correct
80 Correct 13 ms 11784 KB Output is correct
81 Correct 15 ms 11784 KB Output is correct
82 Correct 15 ms 12088 KB Output is correct
83 Correct 15 ms 12040 KB Output is correct
84 Correct 12 ms 12168 KB Output is correct
85 Correct 15 ms 12168 KB Output is correct
86 Correct 14 ms 12108 KB Output is correct
87 Correct 13 ms 12168 KB Output is correct
88 Correct 13 ms 12092 KB Output is correct
89 Correct 15 ms 11856 KB Output is correct
90 Correct 15 ms 11724 KB Output is correct
91 Correct 226 ms 15940 KB Output is correct
92 Correct 311 ms 17824 KB Output is correct
93 Correct 299 ms 17992 KB Output is correct
94 Correct 363 ms 24112 KB Output is correct
95 Correct 444 ms 23292 KB Output is correct
96 Correct 277 ms 17464 KB Output is correct
97 Correct 281 ms 16824 KB Output is correct
98 Correct 364 ms 22168 KB Output is correct
99 Correct 279 ms 17048 KB Output is correct
100 Correct 287 ms 16516 KB Output is correct
101 Correct 376 ms 19440 KB Output is correct
102 Correct 279 ms 16452 KB Output is correct
103 Correct 371 ms 16600 KB Output is correct
104 Correct 369 ms 16424 KB Output is correct
105 Correct 982 ms 23120 KB Output is correct
106 Correct 1166 ms 26048 KB Output is correct
107 Correct 2345 ms 24844 KB Output is correct
108 Correct 1295 ms 25628 KB Output is correct
109 Correct 419 ms 23528 KB Output is correct
110 Correct 320 ms 19144 KB Output is correct
111 Correct 294 ms 17640 KB Output is correct
112 Correct 285 ms 17132 KB Output is correct
113 Correct 288 ms 16020 KB Output is correct
114 Correct 959 ms 24520 KB Output is correct
115 Correct 367 ms 21916 KB Output is correct
116 Correct 295 ms 17028 KB Output is correct
117 Correct 303 ms 16324 KB Output is correct
118 Correct 676 ms 20160 KB Output is correct
119 Correct 447 ms 19444 KB Output is correct
120 Correct 283 ms 15876 KB Output is correct
121 Correct 310 ms 16456 KB Output is correct
122 Correct 377 ms 16196 KB Output is correct
123 Correct 381 ms 22608 KB Output is correct
124 Correct 361 ms 22908 KB Output is correct
125 Correct 166 ms 25428 KB Output is correct
126 Correct 255 ms 28356 KB Output is correct
127 Correct 341 ms 26764 KB Output is correct
128 Correct 278 ms 28992 KB Output is correct
129 Correct 208 ms 27556 KB Output is correct