Submission #922033

# Submission time Handle Problem Language Result Execution time Memory
922033 2024-02-04T20:25:05 Z SUNWOOOOOOOO Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 171832 KB
#include <bits/stdc++.h>
using namespace std;
using pint = array <int, 2>;
const int INF = 1e9;
vector <vector <int>> ans, G;
vector <vector <pint>> Gelm;
int r, c, n, gno = 0, dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
vector <int> Gvst;
vector <string> A;
deque <pint> dq;
pint s, g;

struct segtree { // +1
    int mxX = 1, mxY = 1;
    vector <vector <pint>> node;
    void init(){
        while (mxX < r) mxX *= 2;
        while (mxY < c) mxY *= 2;
        node.resize(2 * mxX + 1, vector <pint> (2 * mxY + 1, (pint) {INF, INF}));
    }
    void update(int x, int y, pint val){
        x++, y++;
        x += mxX - 1, y += mxY - 1;
        node[x][y] = val;
        for (int cy = y / 2; cy > 0; cy /= 2){
            node[x][cy] = min(node[x][2 * cy], node[x][2 * cy + 1]);
        }
        for (int cx = x / 2; cx > 0; cx /= 2){
            for (int cy = y; cy > 0; cy /= 2){
                node[cx][cy] = min(node[cx * 2][cy], node[cx * 2 + 1][cy]);
            }
        }
    }
    pint query(int L1, int R1, int L2, int R2){
        L1++, R1++, L2++, R2++;
        pint ret = {INF, INF};
        for (L1 += mxX - 1, R1 += mxX - 1; L1 <= R1; L1 /= 2, R1 /= 2){
            if (L1 % 2 == 1){
                for (int cL2 = L2 + mxY - 1, cR2 = R2 + mxY - 1; cL2 <= cR2; cL2 /= 2, cR2 /= 2){
                    if (cL2 % 2 == 1) ret = min(ret, node[L1][cL2++]);
                    if (cR2 % 2 == 0) ret = min(ret, node[L1][cR2--]);
                }
                L1++;
            }
            if (R1 % 2 == 0){
                for (int cL2 = L2 + mxY - 1, cR2 = R2 + mxY - 1; cL2 <= cR2; cL2 /= 2, cR2 /= 2){
                    if (cL2 % 2 == 1) ret = min(ret, node[R1][cL2++]);
                    if (cR2 % 2 == 0) ret = min(ret, node[R1][cR2--]);
                }
                R1--;
            }
        }
        return ret;
    }
} tree;

void val_up(int L1, int R1, int L2, int R2, int val){
    L1 = max(L1, 0), R1 = min(R1, r - 1), L2 = max(L2, 0), R2 = min(R2, c - 1);
    while (1){
        pint ret = tree.query(L1, R1, L2, R2);
        if (ret == (pint) {INF, INF}) break;
        ans[ret[0]][ret[1]] = val;
        tree.update(ret[0], ret[1], (pint) {INF, INF});
        dq.push_back(ret);
    }
}

int main()
{
    scanf("%d %d %d", &r, &c, &n);
    A.resize(r);
    ans.resize(r, vector <int> (c, -1));
    G.resize(r, vector <int> (c, -1));
    scanf("%d %d %d %d", &s[0], &s[1], &g[0], &g[1]);
    s[0]--, s[1]--, g[0]--, g[1]--;
    for (int i = 0; i < r; i++) cin >> A[i];

    for (int i = 0; i < r; i++){
        for (int j = 0; j < c; j++){
            if (G[i][j] != -1) continue;
            if (A[i][j] == '#') continue;
            Gelm.push_back(vector <pint> {});
            queue <pint> q;
            G[i][j] = gno;
            Gelm[gno].push_back({i, j});
            q.push({i, j});
            while (!q.empty()){
                pint now = q.front(); q.pop();
                for (int k : {0, 1, 2, 3}){
                    int nx = now[0] + dx[k], ny = now[1] + dy[k];
                    if (nx < 0 || ny < 0 || nx >= r || ny >= c) continue;
                    if (G[nx][ny] != -1) continue;
                    if (A[nx][ny] == '#') continue;
                    G[nx][ny] = gno;
                    Gelm[gno].push_back({nx, ny});
                    q.push({nx, ny});
                }
            }
            gno++;
        }
    }
    Gvst.resize(gno, 0);

    tree.init();
    for (int i = 0; i < r; i++){
        for (int j = 0; j < c; j++){
            if (A[i][j] != '#') continue;
            tree.update(i, j, {i, j});
        }
    }

    ans[s[0]][s[1]] = 0;
    dq.push_front(s);
    while (!dq.empty()){
        pint now = dq.front(); dq.pop_front();
        for (int k : {0, 1, 2, 3}){
            int nx = now[0] + dx[k], ny = now[1] + dy[k];
            if (nx < 0 || ny < 0 || nx >= r || ny >= c) continue;
            if (A[nx][ny] == '#' || Gvst[G[nx][ny]] == 1) continue;
            for (pint j : Gelm[G[nx][ny]]){
                if (ans[j[0]][j[1]] == -1){
                    ans[j[0]][j[1]] = ans[now[0]][now[1]];
                    dq.push_front(j);
                }
            }
            Gvst[G[nx][ny]] = 1;
        }
        val_up(now[0] - n, now[0] + n, now[1] - n + 1, now[1] + n - 1, ans[now[0]][now[1]] + 1);
        val_up(now[0] - n + 1, now[0] + n - 1, now[1] + n, now[1] + n, ans[now[0]][now[1]] + 1);
        val_up(now[0] - n + 1, now[0] + n - 1, now[1] - n, now[1] - n, ans[now[0]][now[1]] + 1);
    }

    printf("%d\n", ans[g[0]][g[1]]);

    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:70:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |     scanf("%d %d %d", &r, &c, &n);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:74:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |     scanf("%d %d %d %d", &s[0], &s[1], &g[0], &g[1]);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 444 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 31 ms 3264 KB Output is correct
20 Correct 15 ms 5028 KB Output is correct
21 Correct 8 ms 3908 KB Output is correct
22 Correct 27 ms 3728 KB Output is correct
23 Correct 34 ms 3164 KB Output is correct
24 Correct 9 ms 5816 KB Output is correct
25 Correct 21 ms 5232 KB Output is correct
26 Correct 28 ms 3544 KB Output is correct
27 Correct 26 ms 3672 KB Output is correct
28 Correct 31 ms 3212 KB Output is correct
29 Correct 95 ms 10728 KB Output is correct
30 Correct 20 ms 4760 KB Output is correct
31 Correct 24 ms 12496 KB Output is correct
32 Correct 76 ms 11616 KB Output is correct
33 Correct 98 ms 10332 KB Output is correct
34 Correct 26 ms 19984 KB Output is correct
35 Correct 49 ms 18704 KB Output is correct
36 Correct 69 ms 11480 KB Output is correct
37 Correct 77 ms 11572 KB Output is correct
38 Correct 102 ms 10356 KB Output is correct
39 Correct 1424 ms 150128 KB Output is correct
40 Correct 79 ms 12536 KB Output is correct
41 Correct 34 ms 21232 KB Output is correct
42 Correct 152 ms 20496 KB Output is correct
43 Correct 91 ms 17532 KB Output is correct
44 Correct 267 ms 51460 KB Output is correct
45 Correct 467 ms 87452 KB Output is correct
46 Correct 387 ms 171832 KB Output is correct
47 Correct 1118 ms 161608 KB Output is correct
48 Correct 1532 ms 148496 KB Output is correct
49 Correct 207 ms 164188 KB Output is correct
50 Correct 510 ms 150656 KB Output is correct
51 Correct 1091 ms 160860 KB Output is correct
52 Correct 1178 ms 162804 KB Output is correct
53 Correct 1445 ms 148724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 424 KB Output is correct
10 Correct 1 ms 436 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 416 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 21 ms 3164 KB Output is correct
26 Correct 20 ms 5852 KB Output is correct
27 Correct 8 ms 4060 KB Output is correct
28 Correct 13 ms 4152 KB Output is correct
29 Correct 33 ms 3996 KB Output is correct
30 Correct 41 ms 3668 KB Output is correct
31 Correct 35 ms 3676 KB Output is correct
32 Correct 24 ms 3672 KB Output is correct
33 Correct 26 ms 3672 KB Output is correct
34 Correct 87 ms 11476 KB Output is correct
35 Correct 22 ms 12464 KB Output is correct
36 Correct 33 ms 12500 KB Output is correct
37 Correct 88 ms 12172 KB Output is correct
38 Correct 109 ms 11344 KB Output is correct
39 Correct 335 ms 42944 KB Output is correct
40 Correct 946 ms 95152 KB Output is correct
41 Correct 366 ms 171380 KB Output is correct
42 Correct 429 ms 171756 KB Output is correct
43 Correct 1188 ms 168424 KB Output is correct
44 Correct 1564 ms 160708 KB Output is correct
45 Correct 982 ms 163716 KB Output is correct
46 Correct 930 ms 98732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 31 ms 3164 KB Output is correct
34 Correct 1 ms 600 KB Output is correct
35 Correct 2 ms 860 KB Output is correct
36 Correct 23 ms 3164 KB Output is correct
37 Correct 15 ms 5028 KB Output is correct
38 Correct 20 ms 5852 KB Output is correct
39 Correct 8 ms 4056 KB Output is correct
40 Correct 27 ms 3676 KB Output is correct
41 Correct 33 ms 3160 KB Output is correct
42 Correct 13 ms 4060 KB Output is correct
43 Correct 33 ms 3932 KB Output is correct
44 Correct 41 ms 3668 KB Output is correct
45 Correct 8 ms 5744 KB Output is correct
46 Correct 18 ms 5232 KB Output is correct
47 Correct 20 ms 4760 KB Output is correct
48 Correct 31 ms 3672 KB Output is correct
49 Correct 32 ms 5724 KB Output is correct
50 Correct 38 ms 6012 KB Output is correct
51 Correct 45 ms 3676 KB Output is correct
52 Correct 27 ms 4076 KB Output is correct
53 Correct 27 ms 3676 KB Output is correct
54 Correct 32 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 31 ms 3164 KB Output is correct
34 Correct 1 ms 600 KB Output is correct
35 Correct 2 ms 860 KB Output is correct
36 Correct 23 ms 3164 KB Output is correct
37 Correct 15 ms 5028 KB Output is correct
38 Correct 20 ms 5852 KB Output is correct
39 Correct 8 ms 4056 KB Output is correct
40 Correct 27 ms 3676 KB Output is correct
41 Correct 33 ms 3160 KB Output is correct
42 Correct 13 ms 4060 KB Output is correct
43 Correct 33 ms 3932 KB Output is correct
44 Correct 41 ms 3668 KB Output is correct
45 Correct 8 ms 5744 KB Output is correct
46 Correct 18 ms 5232 KB Output is correct
47 Correct 20 ms 4760 KB Output is correct
48 Correct 31 ms 3672 KB Output is correct
49 Correct 32 ms 5724 KB Output is correct
50 Correct 38 ms 6012 KB Output is correct
51 Correct 45 ms 3676 KB Output is correct
52 Correct 27 ms 4076 KB Output is correct
53 Correct 27 ms 3676 KB Output is correct
54 Correct 32 ms 3160 KB Output is correct
55 Correct 93 ms 10472 KB Output is correct
56 Correct 20 ms 4760 KB Output is correct
57 Correct 85 ms 11476 KB Output is correct
58 Correct 82 ms 11796 KB Output is correct
59 Correct 22 ms 12500 KB Output is correct
60 Correct 79 ms 11604 KB Output is correct
61 Correct 98 ms 10332 KB Output is correct
62 Correct 33 ms 12500 KB Output is correct
63 Correct 88 ms 12332 KB Output is correct
64 Correct 111 ms 11452 KB Output is correct
65 Correct 20 ms 19980 KB Output is correct
66 Correct 49 ms 18704 KB Output is correct
67 Correct 53 ms 16048 KB Output is correct
68 Correct 86 ms 11540 KB Output is correct
69 Correct 93 ms 19864 KB Output is correct
70 Correct 95 ms 11668 KB Output is correct
71 Correct 91 ms 11416 KB Output is correct
72 Correct 69 ms 11416 KB Output is correct
73 Correct 76 ms 11600 KB Output is correct
74 Correct 94 ms 10332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 444 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 31 ms 3264 KB Output is correct
20 Correct 15 ms 5028 KB Output is correct
21 Correct 8 ms 3908 KB Output is correct
22 Correct 27 ms 3728 KB Output is correct
23 Correct 34 ms 3164 KB Output is correct
24 Correct 9 ms 5816 KB Output is correct
25 Correct 21 ms 5232 KB Output is correct
26 Correct 28 ms 3544 KB Output is correct
27 Correct 26 ms 3672 KB Output is correct
28 Correct 31 ms 3212 KB Output is correct
29 Correct 95 ms 10728 KB Output is correct
30 Correct 20 ms 4760 KB Output is correct
31 Correct 24 ms 12496 KB Output is correct
32 Correct 76 ms 11616 KB Output is correct
33 Correct 98 ms 10332 KB Output is correct
34 Correct 26 ms 19984 KB Output is correct
35 Correct 49 ms 18704 KB Output is correct
36 Correct 69 ms 11480 KB Output is correct
37 Correct 77 ms 11572 KB Output is correct
38 Correct 102 ms 10356 KB Output is correct
39 Correct 1424 ms 150128 KB Output is correct
40 Correct 79 ms 12536 KB Output is correct
41 Correct 34 ms 21232 KB Output is correct
42 Correct 152 ms 20496 KB Output is correct
43 Correct 91 ms 17532 KB Output is correct
44 Correct 267 ms 51460 KB Output is correct
45 Correct 467 ms 87452 KB Output is correct
46 Correct 387 ms 171832 KB Output is correct
47 Correct 1118 ms 161608 KB Output is correct
48 Correct 1532 ms 148496 KB Output is correct
49 Correct 207 ms 164188 KB Output is correct
50 Correct 510 ms 150656 KB Output is correct
51 Correct 1091 ms 160860 KB Output is correct
52 Correct 1178 ms 162804 KB Output is correct
53 Correct 1445 ms 148724 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 344 KB Output is correct
77 Correct 1 ms 344 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 424 KB Output is correct
95 Correct 1 ms 436 KB Output is correct
96 Correct 1 ms 344 KB Output is correct
97 Correct 1 ms 344 KB Output is correct
98 Correct 1 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 416 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 1 ms 348 KB Output is correct
106 Correct 1 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 1 ms 344 KB Output is correct
109 Correct 2 ms 600 KB Output is correct
110 Correct 21 ms 3164 KB Output is correct
111 Correct 20 ms 5852 KB Output is correct
112 Correct 8 ms 4060 KB Output is correct
113 Correct 13 ms 4152 KB Output is correct
114 Correct 33 ms 3996 KB Output is correct
115 Correct 41 ms 3668 KB Output is correct
116 Correct 35 ms 3676 KB Output is correct
117 Correct 24 ms 3672 KB Output is correct
118 Correct 26 ms 3672 KB Output is correct
119 Correct 87 ms 11476 KB Output is correct
120 Correct 22 ms 12464 KB Output is correct
121 Correct 33 ms 12500 KB Output is correct
122 Correct 88 ms 12172 KB Output is correct
123 Correct 109 ms 11344 KB Output is correct
124 Correct 335 ms 42944 KB Output is correct
125 Correct 946 ms 95152 KB Output is correct
126 Correct 366 ms 171380 KB Output is correct
127 Correct 429 ms 171756 KB Output is correct
128 Correct 1188 ms 168424 KB Output is correct
129 Correct 1564 ms 160708 KB Output is correct
130 Correct 982 ms 163716 KB Output is correct
131 Correct 930 ms 98732 KB Output is correct
132 Correct 31 ms 3164 KB Output is correct
133 Correct 1 ms 600 KB Output is correct
134 Correct 2 ms 860 KB Output is correct
135 Correct 23 ms 3164 KB Output is correct
136 Correct 15 ms 5028 KB Output is correct
137 Correct 20 ms 5852 KB Output is correct
138 Correct 8 ms 4056 KB Output is correct
139 Correct 27 ms 3676 KB Output is correct
140 Correct 33 ms 3160 KB Output is correct
141 Correct 13 ms 4060 KB Output is correct
142 Correct 33 ms 3932 KB Output is correct
143 Correct 41 ms 3668 KB Output is correct
144 Correct 8 ms 5744 KB Output is correct
145 Correct 18 ms 5232 KB Output is correct
146 Correct 20 ms 4760 KB Output is correct
147 Correct 31 ms 3672 KB Output is correct
148 Correct 32 ms 5724 KB Output is correct
149 Correct 38 ms 6012 KB Output is correct
150 Correct 45 ms 3676 KB Output is correct
151 Correct 27 ms 4076 KB Output is correct
152 Correct 27 ms 3676 KB Output is correct
153 Correct 32 ms 3160 KB Output is correct
154 Correct 93 ms 10472 KB Output is correct
155 Correct 20 ms 4760 KB Output is correct
156 Correct 85 ms 11476 KB Output is correct
157 Correct 82 ms 11796 KB Output is correct
158 Correct 22 ms 12500 KB Output is correct
159 Correct 79 ms 11604 KB Output is correct
160 Correct 98 ms 10332 KB Output is correct
161 Correct 33 ms 12500 KB Output is correct
162 Correct 88 ms 12332 KB Output is correct
163 Correct 111 ms 11452 KB Output is correct
164 Correct 20 ms 19980 KB Output is correct
165 Correct 49 ms 18704 KB Output is correct
166 Correct 53 ms 16048 KB Output is correct
167 Correct 86 ms 11540 KB Output is correct
168 Correct 93 ms 19864 KB Output is correct
169 Correct 95 ms 11668 KB Output is correct
170 Correct 91 ms 11416 KB Output is correct
171 Correct 69 ms 11416 KB Output is correct
172 Correct 76 ms 11600 KB Output is correct
173 Correct 94 ms 10332 KB Output is correct
174 Correct 96 ms 12696 KB Output is correct
175 Correct 274 ms 23212 KB Output is correct
176 Correct 357 ms 56424 KB Output is correct
177 Correct 878 ms 87612 KB Output is correct
178 Correct 1225 ms 158508 KB Output is correct
179 Correct 1356 ms 163916 KB Output is correct
180 Correct 1314 ms 161780 KB Output is correct
181 Correct 1204 ms 95612 KB Output is correct
182 Correct 1348 ms 161572 KB Output is correct
183 Correct 881 ms 158760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 444 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 31 ms 3264 KB Output is correct
20 Correct 15 ms 5028 KB Output is correct
21 Correct 8 ms 3908 KB Output is correct
22 Correct 27 ms 3728 KB Output is correct
23 Correct 34 ms 3164 KB Output is correct
24 Correct 9 ms 5816 KB Output is correct
25 Correct 21 ms 5232 KB Output is correct
26 Correct 28 ms 3544 KB Output is correct
27 Correct 26 ms 3672 KB Output is correct
28 Correct 31 ms 3212 KB Output is correct
29 Correct 95 ms 10728 KB Output is correct
30 Correct 20 ms 4760 KB Output is correct
31 Correct 24 ms 12496 KB Output is correct
32 Correct 76 ms 11616 KB Output is correct
33 Correct 98 ms 10332 KB Output is correct
34 Correct 26 ms 19984 KB Output is correct
35 Correct 49 ms 18704 KB Output is correct
36 Correct 69 ms 11480 KB Output is correct
37 Correct 77 ms 11572 KB Output is correct
38 Correct 102 ms 10356 KB Output is correct
39 Correct 1424 ms 150128 KB Output is correct
40 Correct 79 ms 12536 KB Output is correct
41 Correct 34 ms 21232 KB Output is correct
42 Correct 152 ms 20496 KB Output is correct
43 Correct 91 ms 17532 KB Output is correct
44 Correct 267 ms 51460 KB Output is correct
45 Correct 467 ms 87452 KB Output is correct
46 Correct 387 ms 171832 KB Output is correct
47 Correct 1118 ms 161608 KB Output is correct
48 Correct 1532 ms 148496 KB Output is correct
49 Correct 207 ms 164188 KB Output is correct
50 Correct 510 ms 150656 KB Output is correct
51 Correct 1091 ms 160860 KB Output is correct
52 Correct 1178 ms 162804 KB Output is correct
53 Correct 1445 ms 148724 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 344 KB Output is correct
77 Correct 1 ms 344 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 424 KB Output is correct
95 Correct 1 ms 436 KB Output is correct
96 Correct 1 ms 344 KB Output is correct
97 Correct 1 ms 344 KB Output is correct
98 Correct 1 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 416 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 1 ms 348 KB Output is correct
106 Correct 1 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 1 ms 344 KB Output is correct
109 Correct 2 ms 600 KB Output is correct
110 Correct 21 ms 3164 KB Output is correct
111 Correct 20 ms 5852 KB Output is correct
112 Correct 8 ms 4060 KB Output is correct
113 Correct 13 ms 4152 KB Output is correct
114 Correct 33 ms 3996 KB Output is correct
115 Correct 41 ms 3668 KB Output is correct
116 Correct 35 ms 3676 KB Output is correct
117 Correct 24 ms 3672 KB Output is correct
118 Correct 26 ms 3672 KB Output is correct
119 Correct 87 ms 11476 KB Output is correct
120 Correct 22 ms 12464 KB Output is correct
121 Correct 33 ms 12500 KB Output is correct
122 Correct 88 ms 12172 KB Output is correct
123 Correct 109 ms 11344 KB Output is correct
124 Correct 335 ms 42944 KB Output is correct
125 Correct 946 ms 95152 KB Output is correct
126 Correct 366 ms 171380 KB Output is correct
127 Correct 429 ms 171756 KB Output is correct
128 Correct 1188 ms 168424 KB Output is correct
129 Correct 1564 ms 160708 KB Output is correct
130 Correct 982 ms 163716 KB Output is correct
131 Correct 930 ms 98732 KB Output is correct
132 Correct 31 ms 3164 KB Output is correct
133 Correct 1 ms 600 KB Output is correct
134 Correct 2 ms 860 KB Output is correct
135 Correct 23 ms 3164 KB Output is correct
136 Correct 15 ms 5028 KB Output is correct
137 Correct 20 ms 5852 KB Output is correct
138 Correct 8 ms 4056 KB Output is correct
139 Correct 27 ms 3676 KB Output is correct
140 Correct 33 ms 3160 KB Output is correct
141 Correct 13 ms 4060 KB Output is correct
142 Correct 33 ms 3932 KB Output is correct
143 Correct 41 ms 3668 KB Output is correct
144 Correct 8 ms 5744 KB Output is correct
145 Correct 18 ms 5232 KB Output is correct
146 Correct 20 ms 4760 KB Output is correct
147 Correct 31 ms 3672 KB Output is correct
148 Correct 32 ms 5724 KB Output is correct
149 Correct 38 ms 6012 KB Output is correct
150 Correct 45 ms 3676 KB Output is correct
151 Correct 27 ms 4076 KB Output is correct
152 Correct 27 ms 3676 KB Output is correct
153 Correct 32 ms 3160 KB Output is correct
154 Correct 93 ms 10472 KB Output is correct
155 Correct 20 ms 4760 KB Output is correct
156 Correct 85 ms 11476 KB Output is correct
157 Correct 82 ms 11796 KB Output is correct
158 Correct 22 ms 12500 KB Output is correct
159 Correct 79 ms 11604 KB Output is correct
160 Correct 98 ms 10332 KB Output is correct
161 Correct 33 ms 12500 KB Output is correct
162 Correct 88 ms 12332 KB Output is correct
163 Correct 111 ms 11452 KB Output is correct
164 Correct 20 ms 19980 KB Output is correct
165 Correct 49 ms 18704 KB Output is correct
166 Correct 53 ms 16048 KB Output is correct
167 Correct 86 ms 11540 KB Output is correct
168 Correct 93 ms 19864 KB Output is correct
169 Correct 95 ms 11668 KB Output is correct
170 Correct 91 ms 11416 KB Output is correct
171 Correct 69 ms 11416 KB Output is correct
172 Correct 76 ms 11600 KB Output is correct
173 Correct 94 ms 10332 KB Output is correct
174 Correct 96 ms 12696 KB Output is correct
175 Correct 274 ms 23212 KB Output is correct
176 Correct 357 ms 56424 KB Output is correct
177 Correct 878 ms 87612 KB Output is correct
178 Correct 1225 ms 158508 KB Output is correct
179 Correct 1356 ms 163916 KB Output is correct
180 Correct 1314 ms 161780 KB Output is correct
181 Correct 1204 ms 95612 KB Output is correct
182 Correct 1348 ms 161572 KB Output is correct
183 Correct 881 ms 158760 KB Output is correct
184 Execution timed out 2058 ms 166756 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 444 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 31 ms 3264 KB Output is correct
20 Correct 15 ms 5028 KB Output is correct
21 Correct 8 ms 3908 KB Output is correct
22 Correct 27 ms 3728 KB Output is correct
23 Correct 34 ms 3164 KB Output is correct
24 Correct 9 ms 5816 KB Output is correct
25 Correct 21 ms 5232 KB Output is correct
26 Correct 28 ms 3544 KB Output is correct
27 Correct 26 ms 3672 KB Output is correct
28 Correct 31 ms 3212 KB Output is correct
29 Correct 95 ms 10728 KB Output is correct
30 Correct 20 ms 4760 KB Output is correct
31 Correct 24 ms 12496 KB Output is correct
32 Correct 76 ms 11616 KB Output is correct
33 Correct 98 ms 10332 KB Output is correct
34 Correct 26 ms 19984 KB Output is correct
35 Correct 49 ms 18704 KB Output is correct
36 Correct 69 ms 11480 KB Output is correct
37 Correct 77 ms 11572 KB Output is correct
38 Correct 102 ms 10356 KB Output is correct
39 Correct 1424 ms 150128 KB Output is correct
40 Correct 79 ms 12536 KB Output is correct
41 Correct 34 ms 21232 KB Output is correct
42 Correct 152 ms 20496 KB Output is correct
43 Correct 91 ms 17532 KB Output is correct
44 Correct 267 ms 51460 KB Output is correct
45 Correct 467 ms 87452 KB Output is correct
46 Correct 387 ms 171832 KB Output is correct
47 Correct 1118 ms 161608 KB Output is correct
48 Correct 1532 ms 148496 KB Output is correct
49 Correct 207 ms 164188 KB Output is correct
50 Correct 510 ms 150656 KB Output is correct
51 Correct 1091 ms 160860 KB Output is correct
52 Correct 1178 ms 162804 KB Output is correct
53 Correct 1445 ms 148724 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 344 KB Output is correct
77 Correct 1 ms 344 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 424 KB Output is correct
95 Correct 1 ms 436 KB Output is correct
96 Correct 1 ms 344 KB Output is correct
97 Correct 1 ms 344 KB Output is correct
98 Correct 1 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 416 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 1 ms 348 KB Output is correct
106 Correct 1 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 1 ms 344 KB Output is correct
109 Correct 2 ms 600 KB Output is correct
110 Correct 21 ms 3164 KB Output is correct
111 Correct 20 ms 5852 KB Output is correct
112 Correct 8 ms 4060 KB Output is correct
113 Correct 13 ms 4152 KB Output is correct
114 Correct 33 ms 3996 KB Output is correct
115 Correct 41 ms 3668 KB Output is correct
116 Correct 35 ms 3676 KB Output is correct
117 Correct 24 ms 3672 KB Output is correct
118 Correct 26 ms 3672 KB Output is correct
119 Correct 87 ms 11476 KB Output is correct
120 Correct 22 ms 12464 KB Output is correct
121 Correct 33 ms 12500 KB Output is correct
122 Correct 88 ms 12172 KB Output is correct
123 Correct 109 ms 11344 KB Output is correct
124 Correct 335 ms 42944 KB Output is correct
125 Correct 946 ms 95152 KB Output is correct
126 Correct 366 ms 171380 KB Output is correct
127 Correct 429 ms 171756 KB Output is correct
128 Correct 1188 ms 168424 KB Output is correct
129 Correct 1564 ms 160708 KB Output is correct
130 Correct 982 ms 163716 KB Output is correct
131 Correct 930 ms 98732 KB Output is correct
132 Correct 31 ms 3164 KB Output is correct
133 Correct 1 ms 600 KB Output is correct
134 Correct 2 ms 860 KB Output is correct
135 Correct 23 ms 3164 KB Output is correct
136 Correct 15 ms 5028 KB Output is correct
137 Correct 20 ms 5852 KB Output is correct
138 Correct 8 ms 4056 KB Output is correct
139 Correct 27 ms 3676 KB Output is correct
140 Correct 33 ms 3160 KB Output is correct
141 Correct 13 ms 4060 KB Output is correct
142 Correct 33 ms 3932 KB Output is correct
143 Correct 41 ms 3668 KB Output is correct
144 Correct 8 ms 5744 KB Output is correct
145 Correct 18 ms 5232 KB Output is correct
146 Correct 20 ms 4760 KB Output is correct
147 Correct 31 ms 3672 KB Output is correct
148 Correct 32 ms 5724 KB Output is correct
149 Correct 38 ms 6012 KB Output is correct
150 Correct 45 ms 3676 KB Output is correct
151 Correct 27 ms 4076 KB Output is correct
152 Correct 27 ms 3676 KB Output is correct
153 Correct 32 ms 3160 KB Output is correct
154 Correct 93 ms 10472 KB Output is correct
155 Correct 20 ms 4760 KB Output is correct
156 Correct 85 ms 11476 KB Output is correct
157 Correct 82 ms 11796 KB Output is correct
158 Correct 22 ms 12500 KB Output is correct
159 Correct 79 ms 11604 KB Output is correct
160 Correct 98 ms 10332 KB Output is correct
161 Correct 33 ms 12500 KB Output is correct
162 Correct 88 ms 12332 KB Output is correct
163 Correct 111 ms 11452 KB Output is correct
164 Correct 20 ms 19980 KB Output is correct
165 Correct 49 ms 18704 KB Output is correct
166 Correct 53 ms 16048 KB Output is correct
167 Correct 86 ms 11540 KB Output is correct
168 Correct 93 ms 19864 KB Output is correct
169 Correct 95 ms 11668 KB Output is correct
170 Correct 91 ms 11416 KB Output is correct
171 Correct 69 ms 11416 KB Output is correct
172 Correct 76 ms 11600 KB Output is correct
173 Correct 94 ms 10332 KB Output is correct
174 Correct 96 ms 12696 KB Output is correct
175 Correct 274 ms 23212 KB Output is correct
176 Correct 357 ms 56424 KB Output is correct
177 Correct 878 ms 87612 KB Output is correct
178 Correct 1225 ms 158508 KB Output is correct
179 Correct 1356 ms 163916 KB Output is correct
180 Correct 1314 ms 161780 KB Output is correct
181 Correct 1204 ms 95612 KB Output is correct
182 Correct 1348 ms 161572 KB Output is correct
183 Correct 881 ms 158760 KB Output is correct
184 Execution timed out 2058 ms 166756 KB Time limit exceeded
185 Halted 0 ms 0 KB -