Submission #1118406

# Submission time Handle Problem Language Result Execution time Memory
1118406 2024-11-25T12:51:08 Z Tenis0206 Toy (CEOI24_toy) C++11
100 / 100
76 ms 42728 KB
#include <bits/stdc++.h>

using namespace std;

const int nmax = 1500;

int n,m;
int lv,lh,xv,yv,xh,yh;
char a[nmax + 5][nmax + 5];

bool sel[nmax + 5][nmax + 5];

int st[nmax + 5][nmax + 5], dr[nmax + 5][nmax + 5], sus[nmax + 5][nmax + 5], jos[nmax + 5][nmax + 5];

void precalc()
{
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            if(a[i][j] == 'X')
            {
                sus[i][j] = i + 1;
            }
            else
            {
                if(i == 0)
                {
                    sus[i][j] = 0;
                }
                else
                {
                    sus[i][j] = sus[i - 1][j];
                }
            }

            if(a[i][j] == 'X')
            {
                st[i][j] = j + 1;
            }
            else
            {
                if(j == 0)
                {
                    st[i][j] = 0;
                }
                else
                {
                    st[i][j] = st[i][j - 1];
                }
            }
        }
    }

    for(int i=n-1;i>=0;i--)
    {
        for(int j=m-1;j>=0;j--)
        {
            if(a[i][j] == 'X')
            {
                jos[i][j] = i - 1;
            }
            else
            {
                if(i == n - 1)
                {
                    jos[i][j] = n - 1;
                }
                else
                {
                    jos[i][j] = jos[i + 1][j];
                }
            }

            if(a[i][j] == 'X')
            {
                dr[i][j] = j - 1;
            }
            else
            {
                if(j == m - 1)
                {
                    dr[i][j] = m - 1;
                }
                else
                {
                    dr[i][j] = dr[i][j + 1];
                }
            }
        }
    }
}

int intersect(int a, int b, int c, int d)
{
    if(a > c)
    {
        swap(a, c);
        swap(b, d);
    }
    if(c > b)
    {
        return 0;
    }
    if(d <= b)
    {
        return (d - c + 1);
    }
    return (b - c + 1);
}

void bfs(int x, int y)
{
    queue<pair<int,int>> q;
    q.push({x, y});
    sel[x][y] = true;
    while(!q.empty())
    {
        int i = q.front().first;
        int j = q.front().second;
        q.pop();
        /// catre sus
        if(i != 0 && !sel[i - 1][j] && a[i - 1][j] != 'X' && intersect(st[i][j], dr[i][j], st[i - 1][j], dr[i - 1][j]) >= lh)
        {
            sel[i - 1][j] = true;
            q.push({i - 1, j});
        }

        /// catre jos
        if(i < n - 1 && !sel[i + 1][j] && a[i + 1][j] != 'X' && intersect(st[i][j], dr[i][j], st[i + 1][j], dr[i + 1][j]) >= lh)
        {
            sel[i + 1][j] = true;
            q.push({i + 1, j});
        }

        /// catre stanga
        if(j != 0 && !sel[i][j - 1] && a[i][j - 1] != 'X' && intersect(sus[i][j], jos[i][j], sus[i][j - 1], jos[i][j - 1]) >= lv)
        {
            sel[i][j - 1] = true;
            q.push({i, j - 1});
        }

        /// catre dreapta
        if(j < m - 1 && !sel[i][j + 1] && a[i][j + 1] != 'X' && intersect(sus[i][j], jos[i][j], sus[i][j + 1], jos[i][j + 1]) >= lv)
        {
            sel[i][j + 1] = true;
            q.push({i, j + 1});
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
#ifdef home
    freopen("nr.in","r",stdin);
    freopen("nr.out","w",stdout);
#endif // home
    cin>>m>>n>>lh>>lv;
    cin>>yh>>xh>>yv>>xv;
    int xs = xh;
    int ys = yv;
    int xf = 0, yf = 0;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            cin>>a[i][j];
            if(a[i][j] == '*')
            {
                xf = i;
                yf = j;
            }
        }
    }
    precalc();
    bfs(xs, ys);
    if(sel[xf][yf])
    {
        cout<<"YES\n";
    }
    else
    {
        cout<<"NO\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10588 KB Output is correct
4 Correct 2 ms 14940 KB Output is correct
5 Correct 2 ms 14816 KB Output is correct
6 Correct 2 ms 14812 KB Output is correct
7 Correct 2 ms 14940 KB Output is correct
8 Correct 3 ms 14940 KB Output is correct
9 Correct 2 ms 12892 KB Output is correct
10 Correct 2 ms 12892 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 2 ms 10588 KB Output is correct
13 Correct 2 ms 14940 KB Output is correct
14 Correct 2 ms 14828 KB Output is correct
15 Correct 2 ms 14940 KB Output is correct
16 Correct 2 ms 12880 KB Output is correct
17 Correct 3 ms 12884 KB Output is correct
18 Correct 2 ms 15096 KB Output is correct
19 Correct 3 ms 7004 KB Output is correct
20 Correct 2 ms 7140 KB Output is correct
21 Correct 2 ms 7004 KB Output is correct
22 Correct 2 ms 12892 KB Output is correct
23 Correct 2 ms 7004 KB Output is correct
24 Correct 3 ms 14832 KB Output is correct
25 Correct 2 ms 12892 KB Output is correct
26 Correct 2 ms 14940 KB Output is correct
27 Correct 2 ms 12892 KB Output is correct
28 Correct 2 ms 14940 KB Output is correct
29 Correct 2 ms 13048 KB Output is correct
30 Correct 2 ms 12892 KB Output is correct
31 Correct 2 ms 7004 KB Output is correct
32 Correct 2 ms 12804 KB Output is correct
33 Correct 2 ms 7004 KB Output is correct
34 Correct 2 ms 14940 KB Output is correct
35 Correct 2 ms 14940 KB Output is correct
36 Correct 3 ms 14940 KB Output is correct
37 Correct 2 ms 12892 KB Output is correct
38 Correct 2 ms 12908 KB Output is correct
39 Correct 2 ms 14940 KB Output is correct
40 Correct 2 ms 14940 KB Output is correct
41 Correct 2 ms 14940 KB Output is correct
42 Correct 2 ms 15096 KB Output is correct
43 Correct 2 ms 14940 KB Output is correct
44 Correct 2 ms 14940 KB Output is correct
45 Correct 3 ms 14940 KB Output is correct
46 Correct 2 ms 12880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10588 KB Output is correct
4 Correct 2 ms 14940 KB Output is correct
5 Correct 2 ms 14816 KB Output is correct
6 Correct 2 ms 14812 KB Output is correct
7 Correct 2 ms 14940 KB Output is correct
8 Correct 3 ms 14940 KB Output is correct
9 Correct 2 ms 12892 KB Output is correct
10 Correct 2 ms 12892 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 2 ms 10588 KB Output is correct
13 Correct 2 ms 14940 KB Output is correct
14 Correct 2 ms 14828 KB Output is correct
15 Correct 2 ms 14940 KB Output is correct
16 Correct 2 ms 12880 KB Output is correct
17 Correct 3 ms 12884 KB Output is correct
18 Correct 2 ms 15096 KB Output is correct
19 Correct 3 ms 7004 KB Output is correct
20 Correct 2 ms 7140 KB Output is correct
21 Correct 2 ms 7004 KB Output is correct
22 Correct 2 ms 12892 KB Output is correct
23 Correct 2 ms 7004 KB Output is correct
24 Correct 3 ms 14832 KB Output is correct
25 Correct 2 ms 12892 KB Output is correct
26 Correct 2 ms 14940 KB Output is correct
27 Correct 2 ms 12892 KB Output is correct
28 Correct 2 ms 14940 KB Output is correct
29 Correct 2 ms 13048 KB Output is correct
30 Correct 2 ms 12892 KB Output is correct
31 Correct 2 ms 7004 KB Output is correct
32 Correct 2 ms 12804 KB Output is correct
33 Correct 2 ms 7004 KB Output is correct
34 Correct 2 ms 14940 KB Output is correct
35 Correct 2 ms 14940 KB Output is correct
36 Correct 3 ms 14940 KB Output is correct
37 Correct 2 ms 12892 KB Output is correct
38 Correct 2 ms 12908 KB Output is correct
39 Correct 2 ms 14940 KB Output is correct
40 Correct 2 ms 14940 KB Output is correct
41 Correct 2 ms 14940 KB Output is correct
42 Correct 2 ms 15096 KB Output is correct
43 Correct 2 ms 14940 KB Output is correct
44 Correct 2 ms 14940 KB Output is correct
45 Correct 3 ms 14940 KB Output is correct
46 Correct 2 ms 12880 KB Output is correct
47 Correct 2 ms 6736 KB Output is correct
48 Correct 2 ms 7400 KB Output is correct
49 Correct 2 ms 7504 KB Output is correct
50 Correct 2 ms 7504 KB Output is correct
51 Correct 2 ms 14940 KB Output is correct
52 Correct 2 ms 14928 KB Output is correct
53 Correct 3 ms 14928 KB Output is correct
54 Correct 2 ms 11088 KB Output is correct
55 Correct 2 ms 12880 KB Output is correct
56 Correct 2 ms 5588 KB Output is correct
57 Correct 2 ms 5712 KB Output is correct
58 Correct 2 ms 5712 KB Output is correct
59 Correct 2 ms 14928 KB Output is correct
60 Correct 2 ms 14928 KB Output is correct
61 Correct 3 ms 14932 KB Output is correct
62 Correct 2 ms 14928 KB Output is correct
63 Correct 2 ms 14932 KB Output is correct
64 Correct 2 ms 15100 KB Output is correct
65 Correct 2 ms 14932 KB Output is correct
66 Correct 3 ms 14928 KB Output is correct
67 Correct 2 ms 14928 KB Output is correct
68 Correct 2 ms 14940 KB Output is correct
69 Correct 2 ms 11228 KB Output is correct
70 Correct 2 ms 14928 KB Output is correct
71 Correct 2 ms 14928 KB Output is correct
72 Correct 2 ms 14812 KB Output is correct
73 Correct 2 ms 14940 KB Output is correct
74 Correct 2 ms 14820 KB Output is correct
75 Correct 2 ms 14928 KB Output is correct
76 Correct 2 ms 14928 KB Output is correct
77 Correct 2 ms 14940 KB Output is correct
78 Correct 3 ms 11356 KB Output is correct
79 Correct 2 ms 11356 KB Output is correct
80 Correct 2 ms 11100 KB Output is correct
81 Correct 2 ms 7516 KB Output is correct
82 Correct 2 ms 14940 KB Output is correct
83 Correct 3 ms 14980 KB Output is correct
84 Correct 2 ms 11100 KB Output is correct
85 Correct 2 ms 11100 KB Output is correct
86 Correct 3 ms 14944 KB Output is correct
87 Correct 2 ms 11356 KB Output is correct
88 Correct 2 ms 12892 KB Output is correct
89 Correct 3 ms 11356 KB Output is correct
90 Correct 2 ms 11100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10844 KB Output is correct
4 Correct 7 ms 14172 KB Output is correct
5 Correct 6 ms 17472 KB Output is correct
6 Correct 2 ms 14940 KB Output is correct
7 Correct 5 ms 19040 KB Output is correct
8 Correct 6 ms 19204 KB Output is correct
9 Correct 3 ms 14940 KB Output is correct
10 Correct 4 ms 19172 KB Output is correct
11 Correct 5 ms 13916 KB Output is correct
12 Correct 3 ms 12024 KB Output is correct
13 Correct 6 ms 11868 KB Output is correct
14 Correct 5 ms 19180 KB Output is correct
15 Correct 6 ms 14328 KB Output is correct
16 Correct 5 ms 19260 KB Output is correct
17 Correct 6 ms 12368 KB Output is correct
18 Correct 7 ms 9928 KB Output is correct
19 Correct 7 ms 9808 KB Output is correct
20 Correct 7 ms 9884 KB Output is correct
21 Correct 6 ms 11616 KB Output is correct
22 Correct 7 ms 11600 KB Output is correct
23 Correct 6 ms 14928 KB Output is correct
24 Correct 5 ms 18996 KB Output is correct
25 Correct 8 ms 14160 KB Output is correct
26 Correct 6 ms 12348 KB Output is correct
27 Correct 6 ms 14160 KB Output is correct
28 Correct 6 ms 12344 KB Output is correct
29 Correct 5 ms 19024 KB Output is correct
30 Correct 6 ms 11344 KB Output is correct
31 Correct 7 ms 9552 KB Output is correct
32 Correct 6 ms 12368 KB Output is correct
33 Correct 6 ms 11344 KB Output is correct
34 Correct 5 ms 19172 KB Output is correct
35 Correct 4 ms 19172 KB Output is correct
36 Correct 5 ms 11600 KB Output is correct
37 Correct 6 ms 12112 KB Output is correct
38 Correct 6 ms 11352 KB Output is correct
39 Correct 6 ms 9296 KB Output is correct
40 Correct 6 ms 9536 KB Output is correct
41 Correct 6 ms 9508 KB Output is correct
42 Correct 6 ms 9820 KB Output is correct
43 Correct 7 ms 9808 KB Output is correct
44 Correct 6 ms 9808 KB Output is correct
45 Correct 7 ms 9808 KB Output is correct
46 Correct 4 ms 11744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10588 KB Output is correct
4 Correct 2 ms 14940 KB Output is correct
5 Correct 2 ms 14816 KB Output is correct
6 Correct 2 ms 14812 KB Output is correct
7 Correct 2 ms 14940 KB Output is correct
8 Correct 3 ms 14940 KB Output is correct
9 Correct 2 ms 12892 KB Output is correct
10 Correct 2 ms 12892 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 2 ms 10588 KB Output is correct
13 Correct 2 ms 14940 KB Output is correct
14 Correct 2 ms 14828 KB Output is correct
15 Correct 2 ms 14940 KB Output is correct
16 Correct 2 ms 12880 KB Output is correct
17 Correct 3 ms 12884 KB Output is correct
18 Correct 2 ms 15096 KB Output is correct
19 Correct 3 ms 7004 KB Output is correct
20 Correct 2 ms 7140 KB Output is correct
21 Correct 2 ms 7004 KB Output is correct
22 Correct 2 ms 12892 KB Output is correct
23 Correct 2 ms 7004 KB Output is correct
24 Correct 3 ms 14832 KB Output is correct
25 Correct 2 ms 12892 KB Output is correct
26 Correct 2 ms 14940 KB Output is correct
27 Correct 2 ms 12892 KB Output is correct
28 Correct 2 ms 14940 KB Output is correct
29 Correct 2 ms 13048 KB Output is correct
30 Correct 2 ms 12892 KB Output is correct
31 Correct 2 ms 7004 KB Output is correct
32 Correct 2 ms 12804 KB Output is correct
33 Correct 2 ms 7004 KB Output is correct
34 Correct 2 ms 14940 KB Output is correct
35 Correct 2 ms 14940 KB Output is correct
36 Correct 3 ms 14940 KB Output is correct
37 Correct 2 ms 12892 KB Output is correct
38 Correct 2 ms 12908 KB Output is correct
39 Correct 2 ms 14940 KB Output is correct
40 Correct 2 ms 14940 KB Output is correct
41 Correct 2 ms 14940 KB Output is correct
42 Correct 2 ms 15096 KB Output is correct
43 Correct 2 ms 14940 KB Output is correct
44 Correct 2 ms 14940 KB Output is correct
45 Correct 3 ms 14940 KB Output is correct
46 Correct 2 ms 12880 KB Output is correct
47 Correct 2 ms 6736 KB Output is correct
48 Correct 2 ms 7400 KB Output is correct
49 Correct 2 ms 7504 KB Output is correct
50 Correct 2 ms 7504 KB Output is correct
51 Correct 2 ms 14940 KB Output is correct
52 Correct 2 ms 14928 KB Output is correct
53 Correct 3 ms 14928 KB Output is correct
54 Correct 2 ms 11088 KB Output is correct
55 Correct 2 ms 12880 KB Output is correct
56 Correct 2 ms 5588 KB Output is correct
57 Correct 2 ms 5712 KB Output is correct
58 Correct 2 ms 5712 KB Output is correct
59 Correct 2 ms 14928 KB Output is correct
60 Correct 2 ms 14928 KB Output is correct
61 Correct 3 ms 14932 KB Output is correct
62 Correct 2 ms 14928 KB Output is correct
63 Correct 2 ms 14932 KB Output is correct
64 Correct 2 ms 15100 KB Output is correct
65 Correct 2 ms 14932 KB Output is correct
66 Correct 3 ms 14928 KB Output is correct
67 Correct 2 ms 14928 KB Output is correct
68 Correct 2 ms 14940 KB Output is correct
69 Correct 2 ms 11228 KB Output is correct
70 Correct 2 ms 14928 KB Output is correct
71 Correct 2 ms 14928 KB Output is correct
72 Correct 2 ms 14812 KB Output is correct
73 Correct 2 ms 14940 KB Output is correct
74 Correct 2 ms 14820 KB Output is correct
75 Correct 2 ms 14928 KB Output is correct
76 Correct 2 ms 14928 KB Output is correct
77 Correct 2 ms 14940 KB Output is correct
78 Correct 3 ms 11356 KB Output is correct
79 Correct 2 ms 11356 KB Output is correct
80 Correct 2 ms 11100 KB Output is correct
81 Correct 2 ms 7516 KB Output is correct
82 Correct 2 ms 14940 KB Output is correct
83 Correct 3 ms 14980 KB Output is correct
84 Correct 2 ms 11100 KB Output is correct
85 Correct 2 ms 11100 KB Output is correct
86 Correct 3 ms 14944 KB Output is correct
87 Correct 2 ms 11356 KB Output is correct
88 Correct 2 ms 12892 KB Output is correct
89 Correct 3 ms 11356 KB Output is correct
90 Correct 2 ms 11100 KB Output is correct
91 Correct 2 ms 10844 KB Output is correct
92 Correct 7 ms 14172 KB Output is correct
93 Correct 6 ms 17472 KB Output is correct
94 Correct 2 ms 14940 KB Output is correct
95 Correct 5 ms 19040 KB Output is correct
96 Correct 6 ms 19204 KB Output is correct
97 Correct 3 ms 14940 KB Output is correct
98 Correct 4 ms 19172 KB Output is correct
99 Correct 5 ms 13916 KB Output is correct
100 Correct 3 ms 12024 KB Output is correct
101 Correct 6 ms 11868 KB Output is correct
102 Correct 5 ms 19180 KB Output is correct
103 Correct 6 ms 14328 KB Output is correct
104 Correct 5 ms 19260 KB Output is correct
105 Correct 6 ms 12368 KB Output is correct
106 Correct 7 ms 9928 KB Output is correct
107 Correct 7 ms 9808 KB Output is correct
108 Correct 7 ms 9884 KB Output is correct
109 Correct 6 ms 11616 KB Output is correct
110 Correct 7 ms 11600 KB Output is correct
111 Correct 6 ms 14928 KB Output is correct
112 Correct 5 ms 18996 KB Output is correct
113 Correct 8 ms 14160 KB Output is correct
114 Correct 6 ms 12348 KB Output is correct
115 Correct 6 ms 14160 KB Output is correct
116 Correct 6 ms 12344 KB Output is correct
117 Correct 5 ms 19024 KB Output is correct
118 Correct 6 ms 11344 KB Output is correct
119 Correct 7 ms 9552 KB Output is correct
120 Correct 6 ms 12368 KB Output is correct
121 Correct 6 ms 11344 KB Output is correct
122 Correct 5 ms 19172 KB Output is correct
123 Correct 4 ms 19172 KB Output is correct
124 Correct 5 ms 11600 KB Output is correct
125 Correct 6 ms 12112 KB Output is correct
126 Correct 6 ms 11352 KB Output is correct
127 Correct 6 ms 9296 KB Output is correct
128 Correct 6 ms 9536 KB Output is correct
129 Correct 6 ms 9508 KB Output is correct
130 Correct 6 ms 9820 KB Output is correct
131 Correct 7 ms 9808 KB Output is correct
132 Correct 6 ms 9808 KB Output is correct
133 Correct 7 ms 9808 KB Output is correct
134 Correct 4 ms 11744 KB Output is correct
135 Correct 4 ms 9552 KB Output is correct
136 Correct 8 ms 12784 KB Output is correct
137 Correct 6 ms 14928 KB Output is correct
138 Correct 3 ms 14928 KB Output is correct
139 Correct 5 ms 19024 KB Output is correct
140 Correct 4 ms 19024 KB Output is correct
141 Correct 3 ms 19024 KB Output is correct
142 Correct 5 ms 17156 KB Output is correct
143 Correct 5 ms 17144 KB Output is correct
144 Correct 2 ms 10832 KB Output is correct
145 Correct 5 ms 15020 KB Output is correct
146 Correct 5 ms 19024 KB Output is correct
147 Correct 8 ms 13392 KB Output is correct
148 Correct 9 ms 12664 KB Output is correct
149 Correct 8 ms 12368 KB Output is correct
150 Correct 9 ms 13380 KB Output is correct
151 Correct 7 ms 17480 KB Output is correct
152 Correct 7 ms 15440 KB Output is correct
153 Correct 7 ms 15440 KB Output is correct
154 Correct 7 ms 16464 KB Output is correct
155 Correct 7 ms 16632 KB Output is correct
156 Correct 6 ms 19024 KB Output is correct
157 Correct 8 ms 13560 KB Output is correct
158 Correct 8 ms 13248 KB Output is correct
159 Correct 8 ms 13392 KB Output is correct
160 Correct 11 ms 13384 KB Output is correct
161 Correct 8 ms 13392 KB Output is correct
162 Correct 7 ms 12768 KB Output is correct
163 Correct 8 ms 12688 KB Output is correct
164 Correct 5 ms 19168 KB Output is correct
165 Correct 7 ms 12368 KB Output is correct
166 Correct 8 ms 12784 KB Output is correct
167 Correct 7 ms 12368 KB Output is correct
168 Correct 6 ms 12368 KB Output is correct
169 Correct 7 ms 12792 KB Output is correct
170 Correct 7 ms 12880 KB Output is correct
171 Correct 7 ms 12368 KB Output is correct
172 Correct 6 ms 12368 KB Output is correct
173 Correct 7 ms 12616 KB Output is correct
174 Correct 8 ms 13392 KB Output is correct
175 Correct 8 ms 13392 KB Output is correct
176 Correct 8 ms 13408 KB Output is correct
177 Correct 8 ms 13392 KB Output is correct
178 Correct 6 ms 12508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 10588 KB Output is correct
2 Correct 2 ms 10588 KB Output is correct
3 Correct 2 ms 10588 KB Output is correct
4 Correct 2 ms 14940 KB Output is correct
5 Correct 2 ms 14816 KB Output is correct
6 Correct 2 ms 14812 KB Output is correct
7 Correct 2 ms 14940 KB Output is correct
8 Correct 3 ms 14940 KB Output is correct
9 Correct 2 ms 12892 KB Output is correct
10 Correct 2 ms 12892 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 2 ms 10588 KB Output is correct
13 Correct 2 ms 14940 KB Output is correct
14 Correct 2 ms 14828 KB Output is correct
15 Correct 2 ms 14940 KB Output is correct
16 Correct 2 ms 12880 KB Output is correct
17 Correct 3 ms 12884 KB Output is correct
18 Correct 2 ms 15096 KB Output is correct
19 Correct 3 ms 7004 KB Output is correct
20 Correct 2 ms 7140 KB Output is correct
21 Correct 2 ms 7004 KB Output is correct
22 Correct 2 ms 12892 KB Output is correct
23 Correct 2 ms 7004 KB Output is correct
24 Correct 3 ms 14832 KB Output is correct
25 Correct 2 ms 12892 KB Output is correct
26 Correct 2 ms 14940 KB Output is correct
27 Correct 2 ms 12892 KB Output is correct
28 Correct 2 ms 14940 KB Output is correct
29 Correct 2 ms 13048 KB Output is correct
30 Correct 2 ms 12892 KB Output is correct
31 Correct 2 ms 7004 KB Output is correct
32 Correct 2 ms 12804 KB Output is correct
33 Correct 2 ms 7004 KB Output is correct
34 Correct 2 ms 14940 KB Output is correct
35 Correct 2 ms 14940 KB Output is correct
36 Correct 3 ms 14940 KB Output is correct
37 Correct 2 ms 12892 KB Output is correct
38 Correct 2 ms 12908 KB Output is correct
39 Correct 2 ms 14940 KB Output is correct
40 Correct 2 ms 14940 KB Output is correct
41 Correct 2 ms 14940 KB Output is correct
42 Correct 2 ms 15096 KB Output is correct
43 Correct 2 ms 14940 KB Output is correct
44 Correct 2 ms 14940 KB Output is correct
45 Correct 3 ms 14940 KB Output is correct
46 Correct 2 ms 12880 KB Output is correct
47 Correct 2 ms 6736 KB Output is correct
48 Correct 2 ms 7400 KB Output is correct
49 Correct 2 ms 7504 KB Output is correct
50 Correct 2 ms 7504 KB Output is correct
51 Correct 2 ms 14940 KB Output is correct
52 Correct 2 ms 14928 KB Output is correct
53 Correct 3 ms 14928 KB Output is correct
54 Correct 2 ms 11088 KB Output is correct
55 Correct 2 ms 12880 KB Output is correct
56 Correct 2 ms 5588 KB Output is correct
57 Correct 2 ms 5712 KB Output is correct
58 Correct 2 ms 5712 KB Output is correct
59 Correct 2 ms 14928 KB Output is correct
60 Correct 2 ms 14928 KB Output is correct
61 Correct 3 ms 14932 KB Output is correct
62 Correct 2 ms 14928 KB Output is correct
63 Correct 2 ms 14932 KB Output is correct
64 Correct 2 ms 15100 KB Output is correct
65 Correct 2 ms 14932 KB Output is correct
66 Correct 3 ms 14928 KB Output is correct
67 Correct 2 ms 14928 KB Output is correct
68 Correct 2 ms 14940 KB Output is correct
69 Correct 2 ms 11228 KB Output is correct
70 Correct 2 ms 14928 KB Output is correct
71 Correct 2 ms 14928 KB Output is correct
72 Correct 2 ms 14812 KB Output is correct
73 Correct 2 ms 14940 KB Output is correct
74 Correct 2 ms 14820 KB Output is correct
75 Correct 2 ms 14928 KB Output is correct
76 Correct 2 ms 14928 KB Output is correct
77 Correct 2 ms 14940 KB Output is correct
78 Correct 3 ms 11356 KB Output is correct
79 Correct 2 ms 11356 KB Output is correct
80 Correct 2 ms 11100 KB Output is correct
81 Correct 2 ms 7516 KB Output is correct
82 Correct 2 ms 14940 KB Output is correct
83 Correct 3 ms 14980 KB Output is correct
84 Correct 2 ms 11100 KB Output is correct
85 Correct 2 ms 11100 KB Output is correct
86 Correct 3 ms 14944 KB Output is correct
87 Correct 2 ms 11356 KB Output is correct
88 Correct 2 ms 12892 KB Output is correct
89 Correct 3 ms 11356 KB Output is correct
90 Correct 2 ms 11100 KB Output is correct
91 Correct 2 ms 10844 KB Output is correct
92 Correct 7 ms 14172 KB Output is correct
93 Correct 6 ms 17472 KB Output is correct
94 Correct 2 ms 14940 KB Output is correct
95 Correct 5 ms 19040 KB Output is correct
96 Correct 6 ms 19204 KB Output is correct
97 Correct 3 ms 14940 KB Output is correct
98 Correct 4 ms 19172 KB Output is correct
99 Correct 5 ms 13916 KB Output is correct
100 Correct 3 ms 12024 KB Output is correct
101 Correct 6 ms 11868 KB Output is correct
102 Correct 5 ms 19180 KB Output is correct
103 Correct 6 ms 14328 KB Output is correct
104 Correct 5 ms 19260 KB Output is correct
105 Correct 6 ms 12368 KB Output is correct
106 Correct 7 ms 9928 KB Output is correct
107 Correct 7 ms 9808 KB Output is correct
108 Correct 7 ms 9884 KB Output is correct
109 Correct 6 ms 11616 KB Output is correct
110 Correct 7 ms 11600 KB Output is correct
111 Correct 6 ms 14928 KB Output is correct
112 Correct 5 ms 18996 KB Output is correct
113 Correct 8 ms 14160 KB Output is correct
114 Correct 6 ms 12348 KB Output is correct
115 Correct 6 ms 14160 KB Output is correct
116 Correct 6 ms 12344 KB Output is correct
117 Correct 5 ms 19024 KB Output is correct
118 Correct 6 ms 11344 KB Output is correct
119 Correct 7 ms 9552 KB Output is correct
120 Correct 6 ms 12368 KB Output is correct
121 Correct 6 ms 11344 KB Output is correct
122 Correct 5 ms 19172 KB Output is correct
123 Correct 4 ms 19172 KB Output is correct
124 Correct 5 ms 11600 KB Output is correct
125 Correct 6 ms 12112 KB Output is correct
126 Correct 6 ms 11352 KB Output is correct
127 Correct 6 ms 9296 KB Output is correct
128 Correct 6 ms 9536 KB Output is correct
129 Correct 6 ms 9508 KB Output is correct
130 Correct 6 ms 9820 KB Output is correct
131 Correct 7 ms 9808 KB Output is correct
132 Correct 6 ms 9808 KB Output is correct
133 Correct 7 ms 9808 KB Output is correct
134 Correct 4 ms 11744 KB Output is correct
135 Correct 4 ms 9552 KB Output is correct
136 Correct 8 ms 12784 KB Output is correct
137 Correct 6 ms 14928 KB Output is correct
138 Correct 3 ms 14928 KB Output is correct
139 Correct 5 ms 19024 KB Output is correct
140 Correct 4 ms 19024 KB Output is correct
141 Correct 3 ms 19024 KB Output is correct
142 Correct 5 ms 17156 KB Output is correct
143 Correct 5 ms 17144 KB Output is correct
144 Correct 2 ms 10832 KB Output is correct
145 Correct 5 ms 15020 KB Output is correct
146 Correct 5 ms 19024 KB Output is correct
147 Correct 8 ms 13392 KB Output is correct
148 Correct 9 ms 12664 KB Output is correct
149 Correct 8 ms 12368 KB Output is correct
150 Correct 9 ms 13380 KB Output is correct
151 Correct 7 ms 17480 KB Output is correct
152 Correct 7 ms 15440 KB Output is correct
153 Correct 7 ms 15440 KB Output is correct
154 Correct 7 ms 16464 KB Output is correct
155 Correct 7 ms 16632 KB Output is correct
156 Correct 6 ms 19024 KB Output is correct
157 Correct 8 ms 13560 KB Output is correct
158 Correct 8 ms 13248 KB Output is correct
159 Correct 8 ms 13392 KB Output is correct
160 Correct 11 ms 13384 KB Output is correct
161 Correct 8 ms 13392 KB Output is correct
162 Correct 7 ms 12768 KB Output is correct
163 Correct 8 ms 12688 KB Output is correct
164 Correct 5 ms 19168 KB Output is correct
165 Correct 7 ms 12368 KB Output is correct
166 Correct 8 ms 12784 KB Output is correct
167 Correct 7 ms 12368 KB Output is correct
168 Correct 6 ms 12368 KB Output is correct
169 Correct 7 ms 12792 KB Output is correct
170 Correct 7 ms 12880 KB Output is correct
171 Correct 7 ms 12368 KB Output is correct
172 Correct 6 ms 12368 KB Output is correct
173 Correct 7 ms 12616 KB Output is correct
174 Correct 8 ms 13392 KB Output is correct
175 Correct 8 ms 13392 KB Output is correct
176 Correct 8 ms 13408 KB Output is correct
177 Correct 8 ms 13392 KB Output is correct
178 Correct 6 ms 12508 KB Output is correct
179 Correct 18 ms 25168 KB Output is correct
180 Correct 44 ms 40776 KB Output is correct
181 Correct 43 ms 40780 KB Output is correct
182 Correct 19 ms 30372 KB Output is correct
183 Correct 44 ms 40644 KB Output is correct
184 Correct 38 ms 40764 KB Output is correct
185 Correct 32 ms 37208 KB Output is correct
186 Correct 42 ms 40776 KB Output is correct
187 Correct 47 ms 40724 KB Output is correct
188 Correct 30 ms 34376 KB Output is correct
189 Correct 50 ms 42428 KB Output is correct
190 Correct 58 ms 42476 KB Output is correct
191 Correct 71 ms 41552 KB Output is correct
192 Correct 65 ms 41812 KB Output is correct
193 Correct 64 ms 41292 KB Output is correct
194 Correct 70 ms 42264 KB Output is correct
195 Correct 74 ms 42312 KB Output is correct
196 Correct 72 ms 42256 KB Output is correct
197 Correct 76 ms 42320 KB Output is correct
198 Correct 74 ms 42312 KB Output is correct
199 Correct 71 ms 42312 KB Output is correct
200 Correct 74 ms 42312 KB Output is correct
201 Correct 70 ms 42312 KB Output is correct
202 Correct 70 ms 42400 KB Output is correct
203 Correct 69 ms 42312 KB Output is correct
204 Correct 61 ms 42344 KB Output is correct
205 Correct 71 ms 42308 KB Output is correct
206 Correct 52 ms 42064 KB Output is correct
207 Correct 55 ms 41620 KB Output is correct
208 Correct 51 ms 41520 KB Output is correct
209 Correct 59 ms 42064 KB Output is correct
210 Correct 60 ms 41776 KB Output is correct
211 Correct 61 ms 42344 KB Output is correct
212 Correct 30 ms 39772 KB Output is correct
213 Correct 43 ms 41316 KB Output is correct
214 Correct 38 ms 41288 KB Output is correct
215 Correct 54 ms 41288 KB Output is correct
216 Correct 37 ms 41256 KB Output is correct
217 Correct 48 ms 41296 KB Output is correct
218 Correct 67 ms 42556 KB Output is correct
219 Correct 66 ms 42560 KB Output is correct
220 Correct 64 ms 42340 KB Output is correct
221 Correct 67 ms 42728 KB Output is correct
222 Correct 31 ms 39760 KB Output is correct