#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
struct BIT2D
{
int n, m;
vector<vector<int>> bit;
BIT2D(int n_, int m_) : n(n_), m(m_), bit(n + 1, vector<int>(m + 1)) {}
void add(int i_, int j_, int u)
{
for (int i = i_ + 1; i <= n; i += i & -i)
{
for (int j = j_ + 1; j <= m; j += j & -j)
{
bit[i][j] += u;
}
}
}
int query(int i_, int j_)
{
int ret = 0;
for (int i = i_; i > 0; i -= i & -i)
{
for (int j = j_; j > 0; j -= j & -j)
{
ret += bit[i][j];
}
}
return ret;
}
int query(int l1, int r1, int l2, int r2)
{
return query(l1, l2) + query(r1, r2) - query(l1, r2) - query(r1, l2);
}
};
const int C = 100, INF = 1e9 + 10;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int n, m, K;
cin >> n >> m >> K;
pair<int, int> A, B;
cin >> A.first >> A.second >> B.first >> B.second;
A.first--, A.second--, B.first--, B.second--;
vector<string> g(n);
for (int i = 0; i < n; i++)
{
cin >> g[i];
}
vector<vector<int>> rgt(n, vector<int>(m, -1));
vector<vector<bool>> vis(n, vector<bool>(m));
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m - 1; j++)
{
rgt[i][j] = j + 1;
}
}
auto able = [&](int i, int j)
{
return 0 <= i && i < n && 0 <= j && j < m;
};
function<int(int, int)> rr = [&](int i, int j) -> int
{
if (j == -1 || !vis[i][j])
{
return j;
}
return rgt[i][j] = rr(i, rgt[i][j]);
};
vector<vector<int>> dis(n, vector<int>(m, INF));
if (K < C)
{
vector<pair<int, int>> res;
res.push_back(A);
vis[A.first][A.second] = 1;
dis[A.first][A.second] = 0;
while (res.size())
{
vector<pair<int, int>> res2;
while (res.size())
{
auto [i, j] = res.back();
res2.emplace_back(i, j);
res.pop_back();
for (auto &[dx, dy] : vector<pair<int, int>>{{1, 0}, {0, 1}, {-1, 0}, {0, -1}})
{
if (able(i + dx, j + dy) && !vis[i + dx][j + dy] && g[i + dx][j + dy] == '.')
{
res.emplace_back(i + dx, j + dy);
dis[i + dx][j + dy] = dis[i][j];
vis[i + dx][j + dy] = 1;
if (vis[B.first][B.second])
{
goto found;
}
}
}
}
while (res2.size())
{
auto [i, j] = res2.back();
res2.pop_back();
for (int ii : {max(0, i - K), min(n - 1, i + K)})
{
int jj = rr(ii, max(0, j - (K - 1)));
while (jj != -1 && jj <= j + (K - 1))
{
res.emplace_back(ii, jj);
dis[ii][jj] = dis[i][j] + 1;
vis[ii][jj] = 1;
jj = rr(ii, max(0, j - (K - 1)));
if (vis[B.first][B.second])
{
goto found;
}
}
}
for (int ii = max(0, i - (K - 1)); ii <= min(n - 1, i + (K - 1)); ii++)
{
int jj = rr(ii, max(0, j - K));
while (jj != -1 && jj <= j + K)
{
res.emplace_back(ii, jj);
dis[ii][jj] = dis[i][j] + 1;
vis[ii][jj] = 1;
jj = rr(ii, max(0, j - K));
if (vis[B.first][B.second])
{
goto found;
}
}
}
}
}
}
else
{
BIT2D bit(n, m);
vector<pair<int, int>> res;
res.push_back(A);
vis[A.first][A.second] = 1;
dis[A.first][A.second] = 0;
bit.add(A.first, A.second, 1);
while (res.size())
{
int d = dis[res[0].first][res[0].second];
while (res.size())
{
auto [i, j] = res.back();
res.pop_back();
for (auto &[dx, dy] : vector<pair<int, int>>{{1, 0}, {0, 1}, {-1, 0}, {0, -1}})
{
if (able(i + dx, j + dy) && !vis[i + dx][j + dy] && g[i + dx][j + dy] == '.')
{
res.emplace_back(i + dx, j + dy);
dis[i + dx][j + dy] = dis[i][j];
vis[i + dx][j + dy] = 1;
bit.add(i + dx, j + dy, 1);
if (vis[B.first][B.second])
{
goto found;
}
}
}
}
for (int i = 0; i < n; i++)
{
int j = rr(i, 0);
while (j != -1 && j < m)
{
if (bit.query(max(0, i - K), min(n, i + (K + 1)), max(0, j - K), min(m, j + (K + 1))) \
- int(able(i - K, j - K) && vis[i - K][j - K]) \
- int(able(i - K, j + K) && vis[i - K][j + K]) \
- int(able(i + K, j - K) && vis[i + K][j - K]) \
- int(able(i + K, j + K) && vis[i + K][j + K]) > 0)
{
res.emplace_back(i, j);
}
j = rr(i, j + 1);
}
}
for (auto &[i, j] : res)
{
dis[i][j] = d + 1;
vis[i][j] = 1;
bit.add(i, j, 1);
if (vis[B.first][B.second])
{
goto found;
}
}
}
}
found:
int ans = dis[B.first][B.second];
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
6 ms |
860 KB |
Output is correct |
20 |
Correct |
4 ms |
932 KB |
Output is correct |
21 |
Correct |
1 ms |
1116 KB |
Output is correct |
22 |
Correct |
8 ms |
860 KB |
Output is correct |
23 |
Correct |
6 ms |
856 KB |
Output is correct |
24 |
Correct |
4 ms |
1136 KB |
Output is correct |
25 |
Correct |
4 ms |
1136 KB |
Output is correct |
26 |
Correct |
1 ms |
856 KB |
Output is correct |
27 |
Correct |
1 ms |
860 KB |
Output is correct |
28 |
Correct |
3 ms |
860 KB |
Output is correct |
29 |
Correct |
18 ms |
1892 KB |
Output is correct |
30 |
Correct |
5 ms |
1112 KB |
Output is correct |
31 |
Correct |
4 ms |
2676 KB |
Output is correct |
32 |
Correct |
20 ms |
2096 KB |
Output is correct |
33 |
Correct |
18 ms |
1884 KB |
Output is correct |
34 |
Correct |
12 ms |
2444 KB |
Output is correct |
35 |
Correct |
16 ms |
2460 KB |
Output is correct |
36 |
Correct |
10 ms |
2164 KB |
Output is correct |
37 |
Correct |
15 ms |
2104 KB |
Output is correct |
38 |
Correct |
2 ms |
1884 KB |
Output is correct |
39 |
Correct |
188 ms |
14188 KB |
Output is correct |
40 |
Correct |
6 ms |
1884 KB |
Output is correct |
41 |
Correct |
8 ms |
2836 KB |
Output is correct |
42 |
Correct |
28 ms |
2436 KB |
Output is correct |
43 |
Correct |
19 ms |
3196 KB |
Output is correct |
44 |
Correct |
32 ms |
7544 KB |
Output is correct |
45 |
Correct |
39 ms |
8068 KB |
Output is correct |
46 |
Correct |
20 ms |
17856 KB |
Output is correct |
47 |
Correct |
179 ms |
14364 KB |
Output is correct |
48 |
Correct |
137 ms |
14184 KB |
Output is correct |
49 |
Correct |
80 ms |
19736 KB |
Output is correct |
50 |
Correct |
84 ms |
19740 KB |
Output is correct |
51 |
Correct |
130 ms |
15392 KB |
Output is correct |
52 |
Correct |
99 ms |
14712 KB |
Output is correct |
53 |
Correct |
158 ms |
14308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 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 |
0 ms |
600 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 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 |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
604 KB |
Output is correct |
26 |
Correct |
1 ms |
860 KB |
Output is correct |
27 |
Correct |
1 ms |
1116 KB |
Output is correct |
28 |
Correct |
3 ms |
1624 KB |
Output is correct |
29 |
Correct |
4 ms |
1756 KB |
Output is correct |
30 |
Correct |
4 ms |
1812 KB |
Output is correct |
31 |
Correct |
17 ms |
1116 KB |
Output is correct |
32 |
Correct |
1 ms |
860 KB |
Output is correct |
33 |
Correct |
1 ms |
860 KB |
Output is correct |
34 |
Correct |
4 ms |
2264 KB |
Output is correct |
35 |
Correct |
4 ms |
2776 KB |
Output is correct |
36 |
Correct |
9 ms |
3548 KB |
Output is correct |
37 |
Execution timed out |
2108 ms |
1054452 KB |
Time limit exceeded |
38 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
6 ms |
860 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
1 ms |
604 KB |
Output is correct |
37 |
Correct |
4 ms |
932 KB |
Output is correct |
38 |
Correct |
1 ms |
1032 KB |
Output is correct |
39 |
Correct |
1 ms |
1116 KB |
Output is correct |
40 |
Correct |
7 ms |
856 KB |
Output is correct |
41 |
Correct |
8 ms |
860 KB |
Output is correct |
42 |
Correct |
3 ms |
1632 KB |
Output is correct |
43 |
Correct |
4 ms |
1756 KB |
Output is correct |
44 |
Correct |
3 ms |
1756 KB |
Output is correct |
45 |
Correct |
4 ms |
1136 KB |
Output is correct |
46 |
Correct |
5 ms |
1288 KB |
Output is correct |
47 |
Correct |
7 ms |
1116 KB |
Output is correct |
48 |
Correct |
12 ms |
1024 KB |
Output is correct |
49 |
Correct |
13 ms |
860 KB |
Output is correct |
50 |
Correct |
30 ms |
860 KB |
Output is correct |
51 |
Correct |
17 ms |
1116 KB |
Output is correct |
52 |
Correct |
1 ms |
860 KB |
Output is correct |
53 |
Correct |
1 ms |
860 KB |
Output is correct |
54 |
Correct |
3 ms |
860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
6 ms |
860 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
344 KB |
Output is correct |
36 |
Correct |
1 ms |
604 KB |
Output is correct |
37 |
Correct |
4 ms |
932 KB |
Output is correct |
38 |
Correct |
1 ms |
1032 KB |
Output is correct |
39 |
Correct |
1 ms |
1116 KB |
Output is correct |
40 |
Correct |
7 ms |
856 KB |
Output is correct |
41 |
Correct |
8 ms |
860 KB |
Output is correct |
42 |
Correct |
3 ms |
1632 KB |
Output is correct |
43 |
Correct |
4 ms |
1756 KB |
Output is correct |
44 |
Correct |
3 ms |
1756 KB |
Output is correct |
45 |
Correct |
4 ms |
1136 KB |
Output is correct |
46 |
Correct |
5 ms |
1288 KB |
Output is correct |
47 |
Correct |
7 ms |
1116 KB |
Output is correct |
48 |
Correct |
12 ms |
1024 KB |
Output is correct |
49 |
Correct |
13 ms |
860 KB |
Output is correct |
50 |
Correct |
30 ms |
860 KB |
Output is correct |
51 |
Correct |
17 ms |
1116 KB |
Output is correct |
52 |
Correct |
1 ms |
860 KB |
Output is correct |
53 |
Correct |
1 ms |
860 KB |
Output is correct |
54 |
Correct |
3 ms |
860 KB |
Output is correct |
55 |
Correct |
18 ms |
1884 KB |
Output is correct |
56 |
Correct |
5 ms |
1116 KB |
Output is correct |
57 |
Correct |
4 ms |
2264 KB |
Output is correct |
58 |
Correct |
18 ms |
1760 KB |
Output is correct |
59 |
Correct |
5 ms |
3028 KB |
Output is correct |
60 |
Correct |
19 ms |
1880 KB |
Output is correct |
61 |
Correct |
15 ms |
1896 KB |
Output is correct |
62 |
Correct |
8 ms |
3548 KB |
Output is correct |
63 |
Execution timed out |
2115 ms |
1054456 KB |
Time limit exceeded |
64 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
6 ms |
860 KB |
Output is correct |
20 |
Correct |
4 ms |
932 KB |
Output is correct |
21 |
Correct |
1 ms |
1116 KB |
Output is correct |
22 |
Correct |
8 ms |
860 KB |
Output is correct |
23 |
Correct |
6 ms |
856 KB |
Output is correct |
24 |
Correct |
4 ms |
1136 KB |
Output is correct |
25 |
Correct |
4 ms |
1136 KB |
Output is correct |
26 |
Correct |
1 ms |
856 KB |
Output is correct |
27 |
Correct |
1 ms |
860 KB |
Output is correct |
28 |
Correct |
3 ms |
860 KB |
Output is correct |
29 |
Correct |
18 ms |
1892 KB |
Output is correct |
30 |
Correct |
5 ms |
1112 KB |
Output is correct |
31 |
Correct |
4 ms |
2676 KB |
Output is correct |
32 |
Correct |
20 ms |
2096 KB |
Output is correct |
33 |
Correct |
18 ms |
1884 KB |
Output is correct |
34 |
Correct |
12 ms |
2444 KB |
Output is correct |
35 |
Correct |
16 ms |
2460 KB |
Output is correct |
36 |
Correct |
10 ms |
2164 KB |
Output is correct |
37 |
Correct |
15 ms |
2104 KB |
Output is correct |
38 |
Correct |
2 ms |
1884 KB |
Output is correct |
39 |
Correct |
188 ms |
14188 KB |
Output is correct |
40 |
Correct |
6 ms |
1884 KB |
Output is correct |
41 |
Correct |
8 ms |
2836 KB |
Output is correct |
42 |
Correct |
28 ms |
2436 KB |
Output is correct |
43 |
Correct |
19 ms |
3196 KB |
Output is correct |
44 |
Correct |
32 ms |
7544 KB |
Output is correct |
45 |
Correct |
39 ms |
8068 KB |
Output is correct |
46 |
Correct |
20 ms |
17856 KB |
Output is correct |
47 |
Correct |
179 ms |
14364 KB |
Output is correct |
48 |
Correct |
137 ms |
14184 KB |
Output is correct |
49 |
Correct |
80 ms |
19736 KB |
Output is correct |
50 |
Correct |
84 ms |
19740 KB |
Output is correct |
51 |
Correct |
130 ms |
15392 KB |
Output is correct |
52 |
Correct |
99 ms |
14712 KB |
Output is correct |
53 |
Correct |
158 ms |
14308 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
0 ms |
348 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
0 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 |
0 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 |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
0 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
0 ms |
348 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
0 ms |
348 KB |
Output is correct |
73 |
Correct |
0 ms |
348 KB |
Output is correct |
74 |
Correct |
0 ms |
348 KB |
Output is correct |
75 |
Correct |
0 ms |
348 KB |
Output is correct |
76 |
Correct |
0 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
82 |
Correct |
0 ms |
344 KB |
Output is correct |
83 |
Correct |
1 ms |
344 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
0 ms |
348 KB |
Output is correct |
86 |
Correct |
1 ms |
348 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 |
0 ms |
600 KB |
Output is correct |
93 |
Correct |
0 ms |
348 KB |
Output is correct |
94 |
Correct |
0 ms |
348 KB |
Output is correct |
95 |
Correct |
0 ms |
348 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
0 ms |
348 KB |
Output is correct |
98 |
Correct |
0 ms |
344 KB |
Output is correct |
99 |
Correct |
0 ms |
348 KB |
Output is correct |
100 |
Correct |
1 ms |
600 KB |
Output is correct |
101 |
Correct |
1 ms |
348 KB |
Output is correct |
102 |
Correct |
0 ms |
348 KB |
Output is correct |
103 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
108 |
Correct |
0 ms |
348 KB |
Output is correct |
109 |
Correct |
0 ms |
348 KB |
Output is correct |
110 |
Correct |
1 ms |
604 KB |
Output is correct |
111 |
Correct |
1 ms |
860 KB |
Output is correct |
112 |
Correct |
1 ms |
1116 KB |
Output is correct |
113 |
Correct |
3 ms |
1624 KB |
Output is correct |
114 |
Correct |
4 ms |
1756 KB |
Output is correct |
115 |
Correct |
4 ms |
1812 KB |
Output is correct |
116 |
Correct |
17 ms |
1116 KB |
Output is correct |
117 |
Correct |
1 ms |
860 KB |
Output is correct |
118 |
Correct |
1 ms |
860 KB |
Output is correct |
119 |
Correct |
4 ms |
2264 KB |
Output is correct |
120 |
Correct |
4 ms |
2776 KB |
Output is correct |
121 |
Correct |
9 ms |
3548 KB |
Output is correct |
122 |
Execution timed out |
2108 ms |
1054452 KB |
Time limit exceeded |
123 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
6 ms |
860 KB |
Output is correct |
20 |
Correct |
4 ms |
932 KB |
Output is correct |
21 |
Correct |
1 ms |
1116 KB |
Output is correct |
22 |
Correct |
8 ms |
860 KB |
Output is correct |
23 |
Correct |
6 ms |
856 KB |
Output is correct |
24 |
Correct |
4 ms |
1136 KB |
Output is correct |
25 |
Correct |
4 ms |
1136 KB |
Output is correct |
26 |
Correct |
1 ms |
856 KB |
Output is correct |
27 |
Correct |
1 ms |
860 KB |
Output is correct |
28 |
Correct |
3 ms |
860 KB |
Output is correct |
29 |
Correct |
18 ms |
1892 KB |
Output is correct |
30 |
Correct |
5 ms |
1112 KB |
Output is correct |
31 |
Correct |
4 ms |
2676 KB |
Output is correct |
32 |
Correct |
20 ms |
2096 KB |
Output is correct |
33 |
Correct |
18 ms |
1884 KB |
Output is correct |
34 |
Correct |
12 ms |
2444 KB |
Output is correct |
35 |
Correct |
16 ms |
2460 KB |
Output is correct |
36 |
Correct |
10 ms |
2164 KB |
Output is correct |
37 |
Correct |
15 ms |
2104 KB |
Output is correct |
38 |
Correct |
2 ms |
1884 KB |
Output is correct |
39 |
Correct |
188 ms |
14188 KB |
Output is correct |
40 |
Correct |
6 ms |
1884 KB |
Output is correct |
41 |
Correct |
8 ms |
2836 KB |
Output is correct |
42 |
Correct |
28 ms |
2436 KB |
Output is correct |
43 |
Correct |
19 ms |
3196 KB |
Output is correct |
44 |
Correct |
32 ms |
7544 KB |
Output is correct |
45 |
Correct |
39 ms |
8068 KB |
Output is correct |
46 |
Correct |
20 ms |
17856 KB |
Output is correct |
47 |
Correct |
179 ms |
14364 KB |
Output is correct |
48 |
Correct |
137 ms |
14184 KB |
Output is correct |
49 |
Correct |
80 ms |
19736 KB |
Output is correct |
50 |
Correct |
84 ms |
19740 KB |
Output is correct |
51 |
Correct |
130 ms |
15392 KB |
Output is correct |
52 |
Correct |
99 ms |
14712 KB |
Output is correct |
53 |
Correct |
158 ms |
14308 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
0 ms |
348 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
0 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 |
0 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 |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
0 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
0 ms |
348 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
0 ms |
348 KB |
Output is correct |
73 |
Correct |
0 ms |
348 KB |
Output is correct |
74 |
Correct |
0 ms |
348 KB |
Output is correct |
75 |
Correct |
0 ms |
348 KB |
Output is correct |
76 |
Correct |
0 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
82 |
Correct |
0 ms |
344 KB |
Output is correct |
83 |
Correct |
1 ms |
344 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
0 ms |
348 KB |
Output is correct |
86 |
Correct |
1 ms |
348 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 |
0 ms |
600 KB |
Output is correct |
93 |
Correct |
0 ms |
348 KB |
Output is correct |
94 |
Correct |
0 ms |
348 KB |
Output is correct |
95 |
Correct |
0 ms |
348 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
0 ms |
348 KB |
Output is correct |
98 |
Correct |
0 ms |
344 KB |
Output is correct |
99 |
Correct |
0 ms |
348 KB |
Output is correct |
100 |
Correct |
1 ms |
600 KB |
Output is correct |
101 |
Correct |
1 ms |
348 KB |
Output is correct |
102 |
Correct |
0 ms |
348 KB |
Output is correct |
103 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
108 |
Correct |
0 ms |
348 KB |
Output is correct |
109 |
Correct |
0 ms |
348 KB |
Output is correct |
110 |
Correct |
1 ms |
604 KB |
Output is correct |
111 |
Correct |
1 ms |
860 KB |
Output is correct |
112 |
Correct |
1 ms |
1116 KB |
Output is correct |
113 |
Correct |
3 ms |
1624 KB |
Output is correct |
114 |
Correct |
4 ms |
1756 KB |
Output is correct |
115 |
Correct |
4 ms |
1812 KB |
Output is correct |
116 |
Correct |
17 ms |
1116 KB |
Output is correct |
117 |
Correct |
1 ms |
860 KB |
Output is correct |
118 |
Correct |
1 ms |
860 KB |
Output is correct |
119 |
Correct |
4 ms |
2264 KB |
Output is correct |
120 |
Correct |
4 ms |
2776 KB |
Output is correct |
121 |
Correct |
9 ms |
3548 KB |
Output is correct |
122 |
Execution timed out |
2108 ms |
1054452 KB |
Time limit exceeded |
123 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
6 ms |
860 KB |
Output is correct |
20 |
Correct |
4 ms |
932 KB |
Output is correct |
21 |
Correct |
1 ms |
1116 KB |
Output is correct |
22 |
Correct |
8 ms |
860 KB |
Output is correct |
23 |
Correct |
6 ms |
856 KB |
Output is correct |
24 |
Correct |
4 ms |
1136 KB |
Output is correct |
25 |
Correct |
4 ms |
1136 KB |
Output is correct |
26 |
Correct |
1 ms |
856 KB |
Output is correct |
27 |
Correct |
1 ms |
860 KB |
Output is correct |
28 |
Correct |
3 ms |
860 KB |
Output is correct |
29 |
Correct |
18 ms |
1892 KB |
Output is correct |
30 |
Correct |
5 ms |
1112 KB |
Output is correct |
31 |
Correct |
4 ms |
2676 KB |
Output is correct |
32 |
Correct |
20 ms |
2096 KB |
Output is correct |
33 |
Correct |
18 ms |
1884 KB |
Output is correct |
34 |
Correct |
12 ms |
2444 KB |
Output is correct |
35 |
Correct |
16 ms |
2460 KB |
Output is correct |
36 |
Correct |
10 ms |
2164 KB |
Output is correct |
37 |
Correct |
15 ms |
2104 KB |
Output is correct |
38 |
Correct |
2 ms |
1884 KB |
Output is correct |
39 |
Correct |
188 ms |
14188 KB |
Output is correct |
40 |
Correct |
6 ms |
1884 KB |
Output is correct |
41 |
Correct |
8 ms |
2836 KB |
Output is correct |
42 |
Correct |
28 ms |
2436 KB |
Output is correct |
43 |
Correct |
19 ms |
3196 KB |
Output is correct |
44 |
Correct |
32 ms |
7544 KB |
Output is correct |
45 |
Correct |
39 ms |
8068 KB |
Output is correct |
46 |
Correct |
20 ms |
17856 KB |
Output is correct |
47 |
Correct |
179 ms |
14364 KB |
Output is correct |
48 |
Correct |
137 ms |
14184 KB |
Output is correct |
49 |
Correct |
80 ms |
19736 KB |
Output is correct |
50 |
Correct |
84 ms |
19740 KB |
Output is correct |
51 |
Correct |
130 ms |
15392 KB |
Output is correct |
52 |
Correct |
99 ms |
14712 KB |
Output is correct |
53 |
Correct |
158 ms |
14308 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
0 ms |
348 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
0 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 |
0 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 |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
0 ms |
348 KB |
Output is correct |
68 |
Correct |
1 ms |
348 KB |
Output is correct |
69 |
Correct |
0 ms |
348 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
0 ms |
348 KB |
Output is correct |
73 |
Correct |
0 ms |
348 KB |
Output is correct |
74 |
Correct |
0 ms |
348 KB |
Output is correct |
75 |
Correct |
0 ms |
348 KB |
Output is correct |
76 |
Correct |
0 ms |
348 KB |
Output is correct |
77 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
82 |
Correct |
0 ms |
344 KB |
Output is correct |
83 |
Correct |
1 ms |
344 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
0 ms |
348 KB |
Output is correct |
86 |
Correct |
1 ms |
348 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 |
0 ms |
600 KB |
Output is correct |
93 |
Correct |
0 ms |
348 KB |
Output is correct |
94 |
Correct |
0 ms |
348 KB |
Output is correct |
95 |
Correct |
0 ms |
348 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
0 ms |
348 KB |
Output is correct |
98 |
Correct |
0 ms |
344 KB |
Output is correct |
99 |
Correct |
0 ms |
348 KB |
Output is correct |
100 |
Correct |
1 ms |
600 KB |
Output is correct |
101 |
Correct |
1 ms |
348 KB |
Output is correct |
102 |
Correct |
0 ms |
348 KB |
Output is correct |
103 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
108 |
Correct |
0 ms |
348 KB |
Output is correct |
109 |
Correct |
0 ms |
348 KB |
Output is correct |
110 |
Correct |
1 ms |
604 KB |
Output is correct |
111 |
Correct |
1 ms |
860 KB |
Output is correct |
112 |
Correct |
1 ms |
1116 KB |
Output is correct |
113 |
Correct |
3 ms |
1624 KB |
Output is correct |
114 |
Correct |
4 ms |
1756 KB |
Output is correct |
115 |
Correct |
4 ms |
1812 KB |
Output is correct |
116 |
Correct |
17 ms |
1116 KB |
Output is correct |
117 |
Correct |
1 ms |
860 KB |
Output is correct |
118 |
Correct |
1 ms |
860 KB |
Output is correct |
119 |
Correct |
4 ms |
2264 KB |
Output is correct |
120 |
Correct |
4 ms |
2776 KB |
Output is correct |
121 |
Correct |
9 ms |
3548 KB |
Output is correct |
122 |
Execution timed out |
2108 ms |
1054452 KB |
Time limit exceeded |
123 |
Halted |
0 ms |
0 KB |
- |