Submission #919734

# Submission time Handle Problem Language Result Execution time Memory
919734 2024-02-01T14:56:50 Z andrei_iorgulescu Maze (JOI23_ho_t3) C++14
86 / 100
2000 ms 319908 KB
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")

using namespace std;

int inf = 1e9;
int dl[] = {-1,0,1,0};
int dc[] = {0,1,0,-1};

int r,c,n;
int xs,ys,xf,yf;
vector<vector<char>>a;
vector<vector<int>>d;
vector<pair<int,int>>new_cells;
vector<pair<int,int>>cells;
vector<set<int>>s,ss;

void dfs(int x,int y)
{
    //cout << "sus" << x << ' ' << y << endl;
    for (int i = 0; i < 4; i++)
    {
        int nx = x + dl[i],ny = y + dc[i];
        if (nx >= 1 and nx <= r and ny >= 1 and ny <= c and d[nx][ny] == inf and a[nx][ny] == '.')
        {
            d[nx][ny] = d[x][y];
            s[nx].erase(ny);
            ss[ny].erase(nx);
            cells.push_back({nx,ny});
            dfs(nx,ny);
        }
    }
}

int dgl;

void orizontala(int x,int y1,int y2)
{
    //cout << "h" << x << ' ' << y1 << ' ' << y2 << endl;
    while (true)
    {
        auto it = s[x].lower_bound(y1);
        if (it == s[x].end() or *it > y2)
            return;
        d[x][*it] = dgl;
        new_cells.push_back({x,*it});
        s[x].erase(*it);
        ss[*it].erase(x);
    }
}

void verticala(int y,int x1,int x2)
{
    //cout << "v" << y << ' ' << x1 << ' ' << x2 << endl;
    while (true)
    {
        auto it = ss[y].lower_bound(x1);
        if (it == ss[y].end() or *it > x2)
            return;
        d[*it][y] = dgl;
        new_cells.push_back({*it,y});
        ss[y].erase(*it);
        s[*it].erase(y);
    }
}

void baga(int x,int y)
{
    //cout << "bagat" << ' ' << x << ' ' << y << endl;
    dgl = d[x][y] + 1;
    if (abs(x - xf) <= n and abs(y - yf) <= n and abs(x - xf) + abs(y - yf) < 2 * n)
    {
        d[xf][yf] = min(d[xf][yf],1 + d[x][y]);
        return;
    }
    int x1 = x - n,x2 = x + n,y1 = y - n,y2 = y + n;
    ///teoretic pot tot patratul (x1,y1,x2,y2) fara colturi, daca ies din matrice ayaye
    ///pot sa iau intersectia dreptunghiurilor (x1,y1,x2,y2) cu matricea si daca e tai colturile
    x1 = max(x1,1);
    x2 = min(x2,r);
    y1 = max(y1,1);
    y2 = min(y2,c);
    //cout << x1 << ' ' << x2 << ' ' << y1 << ' ' << y2 << endl;
    if (x1 != x - n)
        orizontala(x1,y1,y2);
    else
    {
        int y1r = y1,y2r = y2;
        if (y1 == y - n)
            y1r++;
        if (y2 == y + n)
            y2r--;
        orizontala(x1,y1r,y2r);
    }
    if (x2 != x + n)
        orizontala(x2,y1,y2);
    else
    {
        int y1r = y1,y2r = y2;
        if (y1 == y - n)
            y1r++;
        if (y2 == y + n)
            y2r--;
        orizontala(x2,y1r,y2r);
    }
    if (y1 != y - n)
        verticala(y1,x1,x2);
    else
    {
        int x1r = x1,x2r = x2;
        if (x1 == x - n)
            x1r++;
        if (x2 == x + n)
            x2r--;
        verticala(y1,x1r,x2r);
    }
    if (y2 != y + n)
        verticala(y2,x1,x2);
    else
    {
        int x1r = x1,x2r = x2;
        if (x1 == x - n)
            x1r++;
        if (x2 == x + n)
            x2r--;
        verticala(y2,x1r,x2r);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> r >> c >> n >> xs >> ys >> xf >> yf;
    a.resize(r + 1);
    s.resize(r + 1);
    ss.resize(c + 1);
    for (int i = 1; i <= r; i++)
    {
        for (int j = 1; j <= c; j++)
        {
            s[i].insert(j);
            ss[j].insert(i);
        }
    }
    for (int i = 1; i <= r; i++)
    {
        a[i].resize(c + 1);
        for (int j = 1; j <= c; j++)
            cin >> a[i][j];
    }
    d.resize(r + 1);
    for (int i = 1; i <= r; i++)
        d[i].resize(c + 1);
    for (int i = 1; i <= r; i++)
        for (int j = 1; j <= c; j++)
            d[i][j] = 1e9;
    new_cells.push_back({xs,ys});
    d[xs][ys] = 0;
    s[xs].erase(ys);
    ss[ys].erase(xs);
    while (true)
    {
        //cout << endl;
        //for (auto it : new_cells)
          //  cout << "nc" << ' ' << it.first << ' ' << it.second << ' ' << d[it.first][it.second] << endl;
        cells = new_cells;
        for (auto it : new_cells)
            dfs(it.first,it.second);
        new_cells.clear();
        for (auto it : cells)
            baga(it.first,it.second);
        if (d[xf][yf] != inf)
            break;
    }
    cout << d[xf][yf];
    return 0;
}

/**
din (i,j) pot merge ori intr-un vecin care e si el alb
as mai putea merge in patratul de latura 2n + 1 centrat in (i,j) fara colturile lui
acum, faza funny e ca nu prea ma intereseaza de mersul inauntrul formei ci doar pe marini, unless este celula de finish in interior
asa ca, ori e celula de finish in interior si zic direct gen "boss, dute in aia", ori pun cu cost + 1 celulele de pe margini
acum, ca sa gasesc celulele de pe margini nevizitate inca, trebuie doar sa vad pe niste bucati de linii / coloane care mai sunt alive
asta pot cu un set, dar cu constanta aia :skull: mai bine nu, deci bag aib si cb pe aib

Acum, cum imi fac dfs-ul ca sa nu iasa nimic dubios
In etape, cat timp n-am ajuns la finish, mai intai imi iau celulele cu care n-am trecut prin faza 1 si le dau fill cat au in jur 0
Iar in faza 2 iau celulele care n-au trecut prin faza asta si le fac kinda patratul, iau alea de pe margini etc
**/
# 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 1 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 26 ms 6232 KB Output is correct
20 Correct 20 ms 7156 KB Output is correct
21 Correct 28 ms 13008 KB Output is correct
22 Correct 28 ms 6232 KB Output is correct
23 Correct 25 ms 6488 KB Output is correct
24 Correct 24 ms 9080 KB Output is correct
25 Correct 24 ms 9052 KB Output is correct
26 Correct 15 ms 6488 KB Output is correct
27 Correct 18 ms 6488 KB Output is correct
28 Correct 18 ms 6744 KB Output is correct
29 Correct 76 ms 15184 KB Output is correct
30 Correct 21 ms 7768 KB Output is correct
31 Correct 81 ms 32092 KB Output is correct
32 Correct 87 ms 15448 KB Output is correct
33 Correct 86 ms 15304 KB Output is correct
34 Correct 70 ms 22352 KB Output is correct
35 Correct 71 ms 22076 KB Output is correct
36 Correct 64 ms 15700 KB Output is correct
37 Correct 80 ms 15440 KB Output is correct
38 Correct 41 ms 15440 KB Output is correct
39 Correct 1180 ms 148828 KB Output is correct
40 Correct 51 ms 17744 KB Output is correct
41 Correct 65 ms 27216 KB Output is correct
42 Correct 126 ms 21684 KB Output is correct
43 Correct 109 ms 30180 KB Output is correct
44 Correct 285 ms 79444 KB Output is correct
45 Correct 308 ms 87132 KB Output is correct
46 Correct 1020 ms 318780 KB Output is correct
47 Correct 1106 ms 149328 KB Output is correct
48 Correct 1121 ms 148828 KB Output is correct
49 Correct 674 ms 219468 KB Output is correct
50 Correct 739 ms 219276 KB Output is correct
51 Correct 1155 ms 150936 KB Output is correct
52 Correct 971 ms 149832 KB Output is correct
53 Correct 1224 ms 149368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 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 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 9 ms 4184 KB Output is correct
26 Correct 24 ms 9424 KB Output is correct
27 Correct 28 ms 13008 KB Output is correct
28 Correct 26 ms 13008 KB Output is correct
29 Correct 12 ms 6232 KB Output is correct
30 Correct 12 ms 6232 KB Output is correct
31 Correct 15 ms 6488 KB Output is correct
32 Correct 15 ms 6492 KB Output is correct
33 Correct 14 ms 6488 KB Output is correct
34 Correct 58 ms 19404 KB Output is correct
35 Correct 80 ms 32188 KB Output is correct
36 Correct 73 ms 32188 KB Output is correct
37 Correct 39 ms 15188 KB Output is correct
38 Correct 45 ms 15440 KB Output is correct
39 Correct 255 ms 65212 KB Output is correct
40 Correct 846 ms 197052 KB Output is correct
41 Correct 1018 ms 319108 KB Output is correct
42 Correct 938 ms 319908 KB Output is correct
43 Correct 581 ms 149072 KB Output is correct
44 Correct 570 ms 148632 KB Output is correct
45 Correct 1008 ms 187368 KB Output is correct
46 Correct 965 ms 200192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 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 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 26 ms 6232 KB Output is correct
34 Correct 1 ms 600 KB Output is correct
35 Correct 1 ms 860 KB Output is correct
36 Correct 9 ms 4188 KB Output is correct
37 Correct 19 ms 7000 KB Output is correct
38 Correct 25 ms 9424 KB Output is correct
39 Correct 28 ms 13008 KB Output is correct
40 Correct 28 ms 6232 KB Output is correct
41 Correct 25 ms 6232 KB Output is correct
42 Correct 26 ms 13008 KB Output is correct
43 Correct 12 ms 6236 KB Output is correct
44 Correct 13 ms 6232 KB Output is correct
45 Correct 24 ms 9304 KB Output is correct
46 Correct 24 ms 9048 KB Output is correct
47 Correct 22 ms 7768 KB Output is correct
48 Correct 19 ms 6488 KB Output is correct
49 Correct 18 ms 6492 KB Output is correct
50 Correct 19 ms 6488 KB Output is correct
51 Correct 15 ms 6488 KB Output is correct
52 Correct 15 ms 6488 KB Output is correct
53 Correct 14 ms 6488 KB Output is correct
54 Correct 18 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 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 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 26 ms 6232 KB Output is correct
34 Correct 1 ms 600 KB Output is correct
35 Correct 1 ms 860 KB Output is correct
36 Correct 9 ms 4188 KB Output is correct
37 Correct 19 ms 7000 KB Output is correct
38 Correct 25 ms 9424 KB Output is correct
39 Correct 28 ms 13008 KB Output is correct
40 Correct 28 ms 6232 KB Output is correct
41 Correct 25 ms 6232 KB Output is correct
42 Correct 26 ms 13008 KB Output is correct
43 Correct 12 ms 6236 KB Output is correct
44 Correct 13 ms 6232 KB Output is correct
45 Correct 24 ms 9304 KB Output is correct
46 Correct 24 ms 9048 KB Output is correct
47 Correct 22 ms 7768 KB Output is correct
48 Correct 19 ms 6488 KB Output is correct
49 Correct 18 ms 6492 KB Output is correct
50 Correct 19 ms 6488 KB Output is correct
51 Correct 15 ms 6488 KB Output is correct
52 Correct 15 ms 6488 KB Output is correct
53 Correct 14 ms 6488 KB Output is correct
54 Correct 18 ms 6488 KB Output is correct
55 Correct 76 ms 15184 KB Output is correct
56 Correct 22 ms 7772 KB Output is correct
57 Correct 59 ms 19772 KB Output is correct
58 Correct 57 ms 14416 KB Output is correct
59 Correct 81 ms 32192 KB Output is correct
60 Correct 84 ms 15192 KB Output is correct
61 Correct 76 ms 15192 KB Output is correct
62 Correct 73 ms 32196 KB Output is correct
63 Correct 39 ms 15300 KB Output is correct
64 Correct 41 ms 15288 KB Output is correct
65 Correct 72 ms 22356 KB Output is correct
66 Correct 71 ms 22112 KB Output is correct
67 Correct 74 ms 18768 KB Output is correct
68 Correct 57 ms 15440 KB Output is correct
69 Correct 57 ms 15432 KB Output is correct
70 Correct 58 ms 15700 KB Output is correct
71 Correct 53 ms 16076 KB Output is correct
72 Correct 67 ms 15696 KB Output is correct
73 Correct 81 ms 15440 KB Output is correct
74 Correct 41 ms 15440 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 1 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 26 ms 6232 KB Output is correct
20 Correct 20 ms 7156 KB Output is correct
21 Correct 28 ms 13008 KB Output is correct
22 Correct 28 ms 6232 KB Output is correct
23 Correct 25 ms 6488 KB Output is correct
24 Correct 24 ms 9080 KB Output is correct
25 Correct 24 ms 9052 KB Output is correct
26 Correct 15 ms 6488 KB Output is correct
27 Correct 18 ms 6488 KB Output is correct
28 Correct 18 ms 6744 KB Output is correct
29 Correct 76 ms 15184 KB Output is correct
30 Correct 21 ms 7768 KB Output is correct
31 Correct 81 ms 32092 KB Output is correct
32 Correct 87 ms 15448 KB Output is correct
33 Correct 86 ms 15304 KB Output is correct
34 Correct 70 ms 22352 KB Output is correct
35 Correct 71 ms 22076 KB Output is correct
36 Correct 64 ms 15700 KB Output is correct
37 Correct 80 ms 15440 KB Output is correct
38 Correct 41 ms 15440 KB Output is correct
39 Correct 1180 ms 148828 KB Output is correct
40 Correct 51 ms 17744 KB Output is correct
41 Correct 65 ms 27216 KB Output is correct
42 Correct 126 ms 21684 KB Output is correct
43 Correct 109 ms 30180 KB Output is correct
44 Correct 285 ms 79444 KB Output is correct
45 Correct 308 ms 87132 KB Output is correct
46 Correct 1020 ms 318780 KB Output is correct
47 Correct 1106 ms 149328 KB Output is correct
48 Correct 1121 ms 148828 KB Output is correct
49 Correct 674 ms 219468 KB Output is correct
50 Correct 739 ms 219276 KB Output is correct
51 Correct 1155 ms 150936 KB Output is correct
52 Correct 971 ms 149832 KB Output is correct
53 Correct 1224 ms 149368 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 344 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 0 ms 344 KB Output is correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 0 ms 344 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 1 ms 344 KB Output is correct
76 Correct 0 ms 344 KB Output is correct
77 Correct 0 ms 344 KB Output is correct
78 Correct 0 ms 344 KB Output is correct
79 Correct 0 ms 344 KB Output is correct
80 Correct 0 ms 344 KB Output is correct
81 Correct 0 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 344 KB Output is correct
85 Correct 1 ms 344 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 344 KB Output is correct
88 Correct 0 ms 344 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 0 ms 344 KB Output is correct
92 Correct 1 ms 600 KB Output is correct
93 Correct 1 ms 504 KB Output is correct
94 Correct 1 ms 600 KB Output is correct
95 Correct 1 ms 344 KB Output is correct
96 Correct 0 ms 344 KB Output is correct
97 Correct 1 ms 600 KB Output is correct
98 Correct 0 ms 344 KB Output is correct
99 Correct 1 ms 344 KB Output is correct
100 Correct 0 ms 344 KB Output is correct
101 Correct 0 ms 344 KB Output is correct
102 Correct 0 ms 344 KB Output is correct
103 Correct 0 ms 344 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 0 ms 344 KB Output is correct
106 Correct 1 ms 344 KB Output is correct
107 Correct 1 ms 344 KB Output is correct
108 Correct 1 ms 344 KB Output is correct
109 Correct 1 ms 604 KB Output is correct
110 Correct 9 ms 4184 KB Output is correct
111 Correct 24 ms 9424 KB Output is correct
112 Correct 28 ms 13008 KB Output is correct
113 Correct 26 ms 13008 KB Output is correct
114 Correct 12 ms 6232 KB Output is correct
115 Correct 12 ms 6232 KB Output is correct
116 Correct 15 ms 6488 KB Output is correct
117 Correct 15 ms 6492 KB Output is correct
118 Correct 14 ms 6488 KB Output is correct
119 Correct 58 ms 19404 KB Output is correct
120 Correct 80 ms 32188 KB Output is correct
121 Correct 73 ms 32188 KB Output is correct
122 Correct 39 ms 15188 KB Output is correct
123 Correct 45 ms 15440 KB Output is correct
124 Correct 255 ms 65212 KB Output is correct
125 Correct 846 ms 197052 KB Output is correct
126 Correct 1018 ms 319108 KB Output is correct
127 Correct 938 ms 319908 KB Output is correct
128 Correct 581 ms 149072 KB Output is correct
129 Correct 570 ms 148632 KB Output is correct
130 Correct 1008 ms 187368 KB Output is correct
131 Correct 965 ms 200192 KB Output is correct
132 Correct 26 ms 6232 KB Output is correct
133 Correct 1 ms 600 KB Output is correct
134 Correct 1 ms 860 KB Output is correct
135 Correct 9 ms 4188 KB Output is correct
136 Correct 19 ms 7000 KB Output is correct
137 Correct 25 ms 9424 KB Output is correct
138 Correct 28 ms 13008 KB Output is correct
139 Correct 28 ms 6232 KB Output is correct
140 Correct 25 ms 6232 KB Output is correct
141 Correct 26 ms 13008 KB Output is correct
142 Correct 12 ms 6236 KB Output is correct
143 Correct 13 ms 6232 KB Output is correct
144 Correct 24 ms 9304 KB Output is correct
145 Correct 24 ms 9048 KB Output is correct
146 Correct 22 ms 7768 KB Output is correct
147 Correct 19 ms 6488 KB Output is correct
148 Correct 18 ms 6492 KB Output is correct
149 Correct 19 ms 6488 KB Output is correct
150 Correct 15 ms 6488 KB Output is correct
151 Correct 15 ms 6488 KB Output is correct
152 Correct 14 ms 6488 KB Output is correct
153 Correct 18 ms 6488 KB Output is correct
154 Correct 76 ms 15184 KB Output is correct
155 Correct 22 ms 7772 KB Output is correct
156 Correct 59 ms 19772 KB Output is correct
157 Correct 57 ms 14416 KB Output is correct
158 Correct 81 ms 32192 KB Output is correct
159 Correct 84 ms 15192 KB Output is correct
160 Correct 76 ms 15192 KB Output is correct
161 Correct 73 ms 32196 KB Output is correct
162 Correct 39 ms 15300 KB Output is correct
163 Correct 41 ms 15288 KB Output is correct
164 Correct 72 ms 22356 KB Output is correct
165 Correct 71 ms 22112 KB Output is correct
166 Correct 74 ms 18768 KB Output is correct
167 Correct 57 ms 15440 KB Output is correct
168 Correct 57 ms 15432 KB Output is correct
169 Correct 58 ms 15700 KB Output is correct
170 Correct 53 ms 16076 KB Output is correct
171 Correct 67 ms 15696 KB Output is correct
172 Correct 81 ms 15440 KB Output is correct
173 Correct 41 ms 15440 KB Output is correct
174 Correct 60 ms 20304 KB Output is correct
175 Correct 169 ms 33932 KB Output is correct
176 Correct 281 ms 87632 KB Output is correct
177 Correct 521 ms 101968 KB Output is correct
178 Correct 544 ms 131664 KB Output is correct
179 Correct 777 ms 150608 KB Output is correct
180 Correct 929 ms 150220 KB Output is correct
181 Correct 919 ms 150832 KB Output is correct
182 Correct 908 ms 152068 KB Output is correct
183 Correct 912 ms 155228 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 1 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 26 ms 6232 KB Output is correct
20 Correct 20 ms 7156 KB Output is correct
21 Correct 28 ms 13008 KB Output is correct
22 Correct 28 ms 6232 KB Output is correct
23 Correct 25 ms 6488 KB Output is correct
24 Correct 24 ms 9080 KB Output is correct
25 Correct 24 ms 9052 KB Output is correct
26 Correct 15 ms 6488 KB Output is correct
27 Correct 18 ms 6488 KB Output is correct
28 Correct 18 ms 6744 KB Output is correct
29 Correct 76 ms 15184 KB Output is correct
30 Correct 21 ms 7768 KB Output is correct
31 Correct 81 ms 32092 KB Output is correct
32 Correct 87 ms 15448 KB Output is correct
33 Correct 86 ms 15304 KB Output is correct
34 Correct 70 ms 22352 KB Output is correct
35 Correct 71 ms 22076 KB Output is correct
36 Correct 64 ms 15700 KB Output is correct
37 Correct 80 ms 15440 KB Output is correct
38 Correct 41 ms 15440 KB Output is correct
39 Correct 1180 ms 148828 KB Output is correct
40 Correct 51 ms 17744 KB Output is correct
41 Correct 65 ms 27216 KB Output is correct
42 Correct 126 ms 21684 KB Output is correct
43 Correct 109 ms 30180 KB Output is correct
44 Correct 285 ms 79444 KB Output is correct
45 Correct 308 ms 87132 KB Output is correct
46 Correct 1020 ms 318780 KB Output is correct
47 Correct 1106 ms 149328 KB Output is correct
48 Correct 1121 ms 148828 KB Output is correct
49 Correct 674 ms 219468 KB Output is correct
50 Correct 739 ms 219276 KB Output is correct
51 Correct 1155 ms 150936 KB Output is correct
52 Correct 971 ms 149832 KB Output is correct
53 Correct 1224 ms 149368 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 344 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 0 ms 344 KB Output is correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 0 ms 344 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 1 ms 344 KB Output is correct
76 Correct 0 ms 344 KB Output is correct
77 Correct 0 ms 344 KB Output is correct
78 Correct 0 ms 344 KB Output is correct
79 Correct 0 ms 344 KB Output is correct
80 Correct 0 ms 344 KB Output is correct
81 Correct 0 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 344 KB Output is correct
85 Correct 1 ms 344 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 344 KB Output is correct
88 Correct 0 ms 344 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 0 ms 344 KB Output is correct
92 Correct 1 ms 600 KB Output is correct
93 Correct 1 ms 504 KB Output is correct
94 Correct 1 ms 600 KB Output is correct
95 Correct 1 ms 344 KB Output is correct
96 Correct 0 ms 344 KB Output is correct
97 Correct 1 ms 600 KB Output is correct
98 Correct 0 ms 344 KB Output is correct
99 Correct 1 ms 344 KB Output is correct
100 Correct 0 ms 344 KB Output is correct
101 Correct 0 ms 344 KB Output is correct
102 Correct 0 ms 344 KB Output is correct
103 Correct 0 ms 344 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 0 ms 344 KB Output is correct
106 Correct 1 ms 344 KB Output is correct
107 Correct 1 ms 344 KB Output is correct
108 Correct 1 ms 344 KB Output is correct
109 Correct 1 ms 604 KB Output is correct
110 Correct 9 ms 4184 KB Output is correct
111 Correct 24 ms 9424 KB Output is correct
112 Correct 28 ms 13008 KB Output is correct
113 Correct 26 ms 13008 KB Output is correct
114 Correct 12 ms 6232 KB Output is correct
115 Correct 12 ms 6232 KB Output is correct
116 Correct 15 ms 6488 KB Output is correct
117 Correct 15 ms 6492 KB Output is correct
118 Correct 14 ms 6488 KB Output is correct
119 Correct 58 ms 19404 KB Output is correct
120 Correct 80 ms 32188 KB Output is correct
121 Correct 73 ms 32188 KB Output is correct
122 Correct 39 ms 15188 KB Output is correct
123 Correct 45 ms 15440 KB Output is correct
124 Correct 255 ms 65212 KB Output is correct
125 Correct 846 ms 197052 KB Output is correct
126 Correct 1018 ms 319108 KB Output is correct
127 Correct 938 ms 319908 KB Output is correct
128 Correct 581 ms 149072 KB Output is correct
129 Correct 570 ms 148632 KB Output is correct
130 Correct 1008 ms 187368 KB Output is correct
131 Correct 965 ms 200192 KB Output is correct
132 Correct 26 ms 6232 KB Output is correct
133 Correct 1 ms 600 KB Output is correct
134 Correct 1 ms 860 KB Output is correct
135 Correct 9 ms 4188 KB Output is correct
136 Correct 19 ms 7000 KB Output is correct
137 Correct 25 ms 9424 KB Output is correct
138 Correct 28 ms 13008 KB Output is correct
139 Correct 28 ms 6232 KB Output is correct
140 Correct 25 ms 6232 KB Output is correct
141 Correct 26 ms 13008 KB Output is correct
142 Correct 12 ms 6236 KB Output is correct
143 Correct 13 ms 6232 KB Output is correct
144 Correct 24 ms 9304 KB Output is correct
145 Correct 24 ms 9048 KB Output is correct
146 Correct 22 ms 7768 KB Output is correct
147 Correct 19 ms 6488 KB Output is correct
148 Correct 18 ms 6492 KB Output is correct
149 Correct 19 ms 6488 KB Output is correct
150 Correct 15 ms 6488 KB Output is correct
151 Correct 15 ms 6488 KB Output is correct
152 Correct 14 ms 6488 KB Output is correct
153 Correct 18 ms 6488 KB Output is correct
154 Correct 76 ms 15184 KB Output is correct
155 Correct 22 ms 7772 KB Output is correct
156 Correct 59 ms 19772 KB Output is correct
157 Correct 57 ms 14416 KB Output is correct
158 Correct 81 ms 32192 KB Output is correct
159 Correct 84 ms 15192 KB Output is correct
160 Correct 76 ms 15192 KB Output is correct
161 Correct 73 ms 32196 KB Output is correct
162 Correct 39 ms 15300 KB Output is correct
163 Correct 41 ms 15288 KB Output is correct
164 Correct 72 ms 22356 KB Output is correct
165 Correct 71 ms 22112 KB Output is correct
166 Correct 74 ms 18768 KB Output is correct
167 Correct 57 ms 15440 KB Output is correct
168 Correct 57 ms 15432 KB Output is correct
169 Correct 58 ms 15700 KB Output is correct
170 Correct 53 ms 16076 KB Output is correct
171 Correct 67 ms 15696 KB Output is correct
172 Correct 81 ms 15440 KB Output is correct
173 Correct 41 ms 15440 KB Output is correct
174 Correct 60 ms 20304 KB Output is correct
175 Correct 169 ms 33932 KB Output is correct
176 Correct 281 ms 87632 KB Output is correct
177 Correct 521 ms 101968 KB Output is correct
178 Correct 544 ms 131664 KB Output is correct
179 Correct 777 ms 150608 KB Output is correct
180 Correct 929 ms 150220 KB Output is correct
181 Correct 919 ms 150832 KB Output is correct
182 Correct 908 ms 152068 KB Output is correct
183 Correct 912 ms 155228 KB Output is correct
184 Execution timed out 2059 ms 297300 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# 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 1 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 26 ms 6232 KB Output is correct
20 Correct 20 ms 7156 KB Output is correct
21 Correct 28 ms 13008 KB Output is correct
22 Correct 28 ms 6232 KB Output is correct
23 Correct 25 ms 6488 KB Output is correct
24 Correct 24 ms 9080 KB Output is correct
25 Correct 24 ms 9052 KB Output is correct
26 Correct 15 ms 6488 KB Output is correct
27 Correct 18 ms 6488 KB Output is correct
28 Correct 18 ms 6744 KB Output is correct
29 Correct 76 ms 15184 KB Output is correct
30 Correct 21 ms 7768 KB Output is correct
31 Correct 81 ms 32092 KB Output is correct
32 Correct 87 ms 15448 KB Output is correct
33 Correct 86 ms 15304 KB Output is correct
34 Correct 70 ms 22352 KB Output is correct
35 Correct 71 ms 22076 KB Output is correct
36 Correct 64 ms 15700 KB Output is correct
37 Correct 80 ms 15440 KB Output is correct
38 Correct 41 ms 15440 KB Output is correct
39 Correct 1180 ms 148828 KB Output is correct
40 Correct 51 ms 17744 KB Output is correct
41 Correct 65 ms 27216 KB Output is correct
42 Correct 126 ms 21684 KB Output is correct
43 Correct 109 ms 30180 KB Output is correct
44 Correct 285 ms 79444 KB Output is correct
45 Correct 308 ms 87132 KB Output is correct
46 Correct 1020 ms 318780 KB Output is correct
47 Correct 1106 ms 149328 KB Output is correct
48 Correct 1121 ms 148828 KB Output is correct
49 Correct 674 ms 219468 KB Output is correct
50 Correct 739 ms 219276 KB Output is correct
51 Correct 1155 ms 150936 KB Output is correct
52 Correct 971 ms 149832 KB Output is correct
53 Correct 1224 ms 149368 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 344 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 0 ms 344 KB Output is correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 0 ms 344 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 1 ms 344 KB Output is correct
76 Correct 0 ms 344 KB Output is correct
77 Correct 0 ms 344 KB Output is correct
78 Correct 0 ms 344 KB Output is correct
79 Correct 0 ms 344 KB Output is correct
80 Correct 0 ms 344 KB Output is correct
81 Correct 0 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 344 KB Output is correct
85 Correct 1 ms 344 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 344 KB Output is correct
88 Correct 0 ms 344 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 0 ms 344 KB Output is correct
92 Correct 1 ms 600 KB Output is correct
93 Correct 1 ms 504 KB Output is correct
94 Correct 1 ms 600 KB Output is correct
95 Correct 1 ms 344 KB Output is correct
96 Correct 0 ms 344 KB Output is correct
97 Correct 1 ms 600 KB Output is correct
98 Correct 0 ms 344 KB Output is correct
99 Correct 1 ms 344 KB Output is correct
100 Correct 0 ms 344 KB Output is correct
101 Correct 0 ms 344 KB Output is correct
102 Correct 0 ms 344 KB Output is correct
103 Correct 0 ms 344 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 0 ms 344 KB Output is correct
106 Correct 1 ms 344 KB Output is correct
107 Correct 1 ms 344 KB Output is correct
108 Correct 1 ms 344 KB Output is correct
109 Correct 1 ms 604 KB Output is correct
110 Correct 9 ms 4184 KB Output is correct
111 Correct 24 ms 9424 KB Output is correct
112 Correct 28 ms 13008 KB Output is correct
113 Correct 26 ms 13008 KB Output is correct
114 Correct 12 ms 6232 KB Output is correct
115 Correct 12 ms 6232 KB Output is correct
116 Correct 15 ms 6488 KB Output is correct
117 Correct 15 ms 6492 KB Output is correct
118 Correct 14 ms 6488 KB Output is correct
119 Correct 58 ms 19404 KB Output is correct
120 Correct 80 ms 32188 KB Output is correct
121 Correct 73 ms 32188 KB Output is correct
122 Correct 39 ms 15188 KB Output is correct
123 Correct 45 ms 15440 KB Output is correct
124 Correct 255 ms 65212 KB Output is correct
125 Correct 846 ms 197052 KB Output is correct
126 Correct 1018 ms 319108 KB Output is correct
127 Correct 938 ms 319908 KB Output is correct
128 Correct 581 ms 149072 KB Output is correct
129 Correct 570 ms 148632 KB Output is correct
130 Correct 1008 ms 187368 KB Output is correct
131 Correct 965 ms 200192 KB Output is correct
132 Correct 26 ms 6232 KB Output is correct
133 Correct 1 ms 600 KB Output is correct
134 Correct 1 ms 860 KB Output is correct
135 Correct 9 ms 4188 KB Output is correct
136 Correct 19 ms 7000 KB Output is correct
137 Correct 25 ms 9424 KB Output is correct
138 Correct 28 ms 13008 KB Output is correct
139 Correct 28 ms 6232 KB Output is correct
140 Correct 25 ms 6232 KB Output is correct
141 Correct 26 ms 13008 KB Output is correct
142 Correct 12 ms 6236 KB Output is correct
143 Correct 13 ms 6232 KB Output is correct
144 Correct 24 ms 9304 KB Output is correct
145 Correct 24 ms 9048 KB Output is correct
146 Correct 22 ms 7768 KB Output is correct
147 Correct 19 ms 6488 KB Output is correct
148 Correct 18 ms 6492 KB Output is correct
149 Correct 19 ms 6488 KB Output is correct
150 Correct 15 ms 6488 KB Output is correct
151 Correct 15 ms 6488 KB Output is correct
152 Correct 14 ms 6488 KB Output is correct
153 Correct 18 ms 6488 KB Output is correct
154 Correct 76 ms 15184 KB Output is correct
155 Correct 22 ms 7772 KB Output is correct
156 Correct 59 ms 19772 KB Output is correct
157 Correct 57 ms 14416 KB Output is correct
158 Correct 81 ms 32192 KB Output is correct
159 Correct 84 ms 15192 KB Output is correct
160 Correct 76 ms 15192 KB Output is correct
161 Correct 73 ms 32196 KB Output is correct
162 Correct 39 ms 15300 KB Output is correct
163 Correct 41 ms 15288 KB Output is correct
164 Correct 72 ms 22356 KB Output is correct
165 Correct 71 ms 22112 KB Output is correct
166 Correct 74 ms 18768 KB Output is correct
167 Correct 57 ms 15440 KB Output is correct
168 Correct 57 ms 15432 KB Output is correct
169 Correct 58 ms 15700 KB Output is correct
170 Correct 53 ms 16076 KB Output is correct
171 Correct 67 ms 15696 KB Output is correct
172 Correct 81 ms 15440 KB Output is correct
173 Correct 41 ms 15440 KB Output is correct
174 Correct 60 ms 20304 KB Output is correct
175 Correct 169 ms 33932 KB Output is correct
176 Correct 281 ms 87632 KB Output is correct
177 Correct 521 ms 101968 KB Output is correct
178 Correct 544 ms 131664 KB Output is correct
179 Correct 777 ms 150608 KB Output is correct
180 Correct 929 ms 150220 KB Output is correct
181 Correct 919 ms 150832 KB Output is correct
182 Correct 908 ms 152068 KB Output is correct
183 Correct 912 ms 155228 KB Output is correct
184 Execution timed out 2059 ms 297300 KB Time limit exceeded
185 Halted 0 ms 0 KB -