#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
const int UNTIL = 4206900;
vector<int> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
int LG2[UNTIL];
int csqrt[UNTIL], fsqrt[UNTIL];
void init() {
LG2[1] = 0;
for (int i = 2; i < UNTIL; ++i) LG2[i] = LG2[i >> 1] + 1;
csqrt[1] = fsqrt[1] = 1;
for (int i = 2; i < UNTIL; ++i) {
fsqrt[i] = fsqrt[i - 1];
while ((fsqrt[i] + 1) * (fsqrt[i] + 1) <= i) ++fsqrt[i];
csqrt[i] = fsqrt[i];
if (fsqrt[i] * fsqrt[i] < i) ++csqrt[i];
}
}
struct VEB {
int u, mn, mx, sz;
VEB *summary;
vector<VEB*> galaxy;
inline int high(int k) { return k / sz; }
inline int low(int k) { return k % sz; }
inline int index(int k, int kk) { return k * sz + kk; }
VEB(int u) : u(u) {
mn = INT_MAX, mx = INT_MIN;
if (u <= 2) summary = nullptr, galaxy.resize(0, nullptr);
else {
int ngalaxy = csqrt[u];
sz = (u + ngalaxy - 1) / ngalaxy;
summary = new VEB(ngalaxy);
galaxy.resize(ngalaxy, nullptr);
for (int i = 0; i < ngalaxy - 1; ++i) galaxy[i] = new VEB(sz);
galaxy[ngalaxy - 1] = new VEB(u - (ngalaxy - 1) * sz);
}
}
void insert(int x) {
if (mn == INT_MAX) mn = mx = x;
else {
if (x < mn) swap(x, mn);
if (x > mx) mx = x;
if (u <= 2) return;
int i = high(x), j = low(x);
if (galaxy[i]->mn == INT_MAX) summary->insert(i);
galaxy[i]->insert(j);
}
}
void erase(int x) {
if (mn == INT_MAX) return;
if (mn == mx) {
mn = INT_MAX, mx = INT_MIN;
return;
}
if (u <= 2) {
if (x != mx) mn = mx;
else if (x == mn) mn = INT_MAX, mx = INT_MIN;
else if (x == 0) mn = 1;
else mx = 0;
return;
}
if (x == mn) {
int i = summary->mn;
if (i == INT_MAX) {
mn = INT_MAX, mx = INT_MIN;
return;
}
x = mn = index(i, galaxy[i]->mn);
}
int i = high(x), j = low(x);
galaxy[i]->erase(j);
if (galaxy[i]->mn == INT_MAX) summary->erase(i);
if (x == mx) {
if (summary->mx == INT_MIN) mx = mn;
else {
i = summary->mx;
mx = index(i, galaxy[i]->mx);
}
}
}
int lower_bound(int x) {
if (x <= mn) return mn;
if (u <= 2) {
if (x <= mx) return mx;
return INT_MAX;
}
int i = high(x), j = low(x);
if (j <= galaxy[i]->mx) j = galaxy[i]->lower_bound(j);
else {
i = summary->lower_bound(i + 1);
j = galaxy[i]->mn;
}
return index(i, j);
}
};
VEB* build_veb(int u) {
VEB* root = new VEB(u);
for (int i = 0; i < u; ++i) root->insert(i);
return root;
}
struct Sustree {
int n, m;
vector<VEB*> has;
Sustree() {}
Sustree(int n, int m) : n(n), m(m), has(4 * n, nullptr) {}
void build(int t, int tl, int tr) {
has[t] = build_veb(m + 1);
if (tl == tr) return;
build(2 * t, tl, (tl + tr) / 2);
build(2 * t + 1, (tl + tr) / 2 + 1, tr);
}
void build() {
build(1, 0, n - 1);
}
void upd(int t, int tl, int tr, int p, int py) {
if (tl == tr) {
has[t]->erase(py);
return;
}
if (p <= (tl + tr) / 2) upd(2 * t, tl, (tl + tr) / 2, p, py);
else upd(2 * t + 1, (tl + tr) / 2 + 1, tr, p, py);
int a = has[2 * t]->lower_bound(py);
int b = has[2 * t + 1]->lower_bound(py);
if (a != py && b != py) {
has[t]->erase(py);
}
}
void upd(int x, int y) {
upd(1, 0, n - 1, x, y);
}
pii qry(int t, int tl, int tr, int l, int r, int lo, int hi) {
l = max(l, tl), r = min(r, tr);
if (l > r) return {-1, -1};
if (tl == l && tr == r) {
int gr = has[t]->lower_bound(lo);
if (gr > hi) return {-1, -1};
if (tl == tr) {
return {tl, gr};
}
int mm = (tl + tr) / 2;
if (has[2 * t]->lower_bound(lo) <= hi) return qry(2 * t, tl, mm, l, r, lo, hi);
return qry(2 * t + 1, mm + 1, tr, l, r, lo, hi);
}
int mm = (tl + tr) / 2;
pii f = qry(2 * t, tl, mm, l, r, lo, hi);
if (f.first >= 0) return f;
return qry(2 * t + 1, mm + 1, tr, l, r, lo, hi);
}
pii qry(int x1, int y1, int x2, int y2) {
return qry(1, 0, n - 1, max(x1, 0), min(x2, n - 1), max(y1, 0), min(y2, m - 1));
}
};
int main() {
init();
ios_base::sync_with_stdio(false); cin.tie(NULL);
int r, c, n; cin >> r >> c >> n;
int sx, sy; cin >> sx >> sy; --sx, --sy;
int gx, gy; cin >> gx >> gy; --gx, --gy;
vector<string> arr(r);
for (int i = 0; i < r; ++i) cin >> arr[i];
if (r > c) {
vector<string> arr2(c);
for (int i = 0; i < r; ++i) {
for (int j = 0; j < c; ++j) {
arr2[j] += arr[i][j];
}
}
swap(arr, arr2);
swap(r, c);
swap(sx, sy);
swap(gx, gy);
}
// . = empty
// # = wall
Sustree sus(r, c); sus.build();
vector<vector<int>> dists(r, vector<int>(c, INT_MAX));
dists[sx][sy] = 0;
sus.upd(sx, sy);
vector<pii> q; q.push_back({sx, sy});
queue<pii> rq; for (pii _p : q) rq.push(_p);
while (rq.size()) {
pii front = rq.front(); rq.pop();
int xx = front.first, yy = front.second;
for (int d = 0; d < 4; ++d) {
int nx = xx + dx[d], ny = yy + dy[d];
if (nx < 0 || ny < 0 || nx >= r || ny >= c) continue;
if (dists[nx][ny] < INT_MAX || arr[nx][ny] == '#') continue;
rq.push({nx, ny});
q.push_back({nx, ny});
dists[nx][ny] = dists[xx][yy];
sus.upd(nx, ny);
}
}
while (q.size()) {
vector<pii> nq;
for (pii p : q) {
int x = p.first, y = p.second;
if (x > 0 && dists[x - 1][y] <= dists[x][y]) {
// query down:
int cur;
while ((cur = sus.qry(x + n, y - n + 1, x + n, y + n - 1).second) != -1) {
nq.push_back({x + n, cur});
dists[x + n][cur] = dists[x][y] + 1;
sus.upd(x + n, cur);
}
if (x + n - 1 < r && y - n >= 0 && dists[x + n - 1][y - n] == INT_MAX) {
nq.push_back({x + n - 1, y - n});
dists[x + n - 1][y - n] = dists[x][y] + 1;
sus.upd(x + n - 1, y - n);
}
if (x + n - 1 < r && y + n < c && dists[x + n - 1][y + n] == INT_MAX) {
nq.push_back({x + n - 1, y + n});
dists[x + n - 1][y + n] = dists[x][y] + 1;
sus.upd(x + n - 1, y + n);
}
} else if (y < r - 1 && dists[x][y + 1] <= dists[x][y]) {
// query left:
int cur;
while ((cur = sus.qry(x - n + 1, y - n, x + n - 1, y - n).first) != -1) {
nq.push_back({cur, y - n});
dists[cur][y - n] = dists[x][y] + 1;
sus.upd(cur, y - n);
}
if (y - n + 1 >= 0 && x - n >= 0 && dists[x - n][y - n + 1] == INT_MAX) {
nq.push_back({x - n, y - n + 1});
dists[x - n][y - n + 1] = dists[x][y] + 1;
sus.upd(x - n, y - n + 1);
}
if (y - n + 1 >= 0 && x + n < r && dists[x + n][y - n + 1] == INT_MAX) {
nq.push_back({x + n, y - n + 1});
dists[x + n][y - n + 1] = dists[x][y] + 1;
sus.upd(x + n, y - n + 1);
}
} else {
// query all:
for (int i = -n; i <= n; i += 2 * n) {
int cx = x + i, cyl = y - n + 1, cyr = y + n - 1, cur;
while ((cur = sus.qry(cx, cyl, cx, cyr).second) != -1) {
nq.push_back({cx, cur});
dists[cx][cur] = dists[x][y] + 1;
sus.upd(cx, cur);
}
}
pii cur;
while ((cur = sus.qry(x - n + 1, y - n, x + n - 1, y + n)).first != -1) {
int nx = cur.first, ny = cur.second;
nq.push_back({nx, ny});
dists[nx][ny] = dists[x][y] + 1;
sus.upd(nx, ny);
}
}
}
queue<pii> rq; for (pii _p : nq) rq.push(_p);
while (rq.size()) {
pii front = rq.front(); rq.pop();
int xx = front.first, yy = front.second;
for (int d = 0; d < 4; ++d) {
int nx = xx + dx[d], ny = yy + dy[d];
if (nx < 0 || ny < 0 || nx >= r || ny >= c) continue;
if (dists[nx][ny] < INT_MAX || arr[nx][ny] == '#') continue;
rq.push({nx, ny});
nq.push_back({nx, ny});
dists[nx][ny] = dists[xx][yy];
sus.upd(nx, ny);
}
}
q = nq;
}
cout << dists[gx][gy] << '\n';
return 0;
}
Compilation message
Main.cpp:15:5: warning: built-in function 'csqrt' declared as non-function [-Wbuiltin-declaration-mismatch]
15 | int csqrt[UNTIL], fsqrt[UNTIL];
| ^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
49620 KB |
Output is correct |
2 |
Correct |
31 ms |
49604 KB |
Output is correct |
3 |
Correct |
28 ms |
49860 KB |
Output is correct |
4 |
Correct |
29 ms |
49852 KB |
Output is correct |
5 |
Correct |
29 ms |
49876 KB |
Output is correct |
6 |
Correct |
30 ms |
49864 KB |
Output is correct |
7 |
Correct |
32 ms |
49708 KB |
Output is correct |
8 |
Correct |
28 ms |
49748 KB |
Output is correct |
9 |
Correct |
28 ms |
49604 KB |
Output is correct |
10 |
Correct |
28 ms |
49612 KB |
Output is correct |
11 |
Correct |
28 ms |
49612 KB |
Output is correct |
12 |
Correct |
29 ms |
49612 KB |
Output is correct |
13 |
Correct |
31 ms |
49608 KB |
Output is correct |
14 |
Correct |
29 ms |
49732 KB |
Output is correct |
15 |
Correct |
30 ms |
49620 KB |
Output is correct |
16 |
Correct |
29 ms |
49872 KB |
Output is correct |
17 |
Correct |
29 ms |
49892 KB |
Output is correct |
18 |
Correct |
28 ms |
49948 KB |
Output is correct |
19 |
Correct |
97 ms |
62252 KB |
Output is correct |
20 |
Correct |
41 ms |
55084 KB |
Output is correct |
21 |
Correct |
76 ms |
63176 KB |
Output is correct |
22 |
Correct |
79 ms |
62288 KB |
Output is correct |
23 |
Correct |
77 ms |
62284 KB |
Output is correct |
24 |
Correct |
40 ms |
56324 KB |
Output is correct |
25 |
Correct |
45 ms |
56400 KB |
Output is correct |
26 |
Correct |
82 ms |
62516 KB |
Output is correct |
27 |
Correct |
100 ms |
62368 KB |
Output is correct |
28 |
Correct |
67 ms |
62144 KB |
Output is correct |
29 |
Correct |
160 ms |
83672 KB |
Output is correct |
30 |
Correct |
53 ms |
60172 KB |
Output is correct |
31 |
Correct |
162 ms |
85800 KB |
Output is correct |
32 |
Correct |
217 ms |
83788 KB |
Output is correct |
33 |
Correct |
169 ms |
83576 KB |
Output is correct |
34 |
Correct |
60 ms |
67612 KB |
Output is correct |
35 |
Correct |
66 ms |
67660 KB |
Output is correct |
36 |
Correct |
221 ms |
84044 KB |
Output is correct |
37 |
Correct |
192 ms |
83880 KB |
Output is correct |
38 |
Correct |
152 ms |
83660 KB |
Output is correct |
39 |
Execution timed out |
2093 ms |
416960 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
49652 KB |
Output is correct |
2 |
Correct |
30 ms |
49656 KB |
Output is correct |
3 |
Correct |
32 ms |
49588 KB |
Output is correct |
4 |
Correct |
29 ms |
49652 KB |
Output is correct |
5 |
Correct |
29 ms |
49892 KB |
Output is correct |
6 |
Correct |
28 ms |
49620 KB |
Output is correct |
7 |
Correct |
29 ms |
49684 KB |
Output is correct |
8 |
Correct |
28 ms |
49724 KB |
Output is correct |
9 |
Correct |
28 ms |
49968 KB |
Output is correct |
10 |
Correct |
29 ms |
49876 KB |
Output is correct |
11 |
Correct |
30 ms |
49852 KB |
Output is correct |
12 |
Correct |
30 ms |
49908 KB |
Output is correct |
13 |
Correct |
28 ms |
49944 KB |
Output is correct |
14 |
Correct |
30 ms |
49960 KB |
Output is correct |
15 |
Correct |
28 ms |
49792 KB |
Output is correct |
16 |
Correct |
33 ms |
49804 KB |
Output is correct |
17 |
Correct |
29 ms |
49908 KB |
Output is correct |
18 |
Correct |
29 ms |
49692 KB |
Output is correct |
19 |
Correct |
32 ms |
49876 KB |
Output is correct |
20 |
Correct |
28 ms |
49688 KB |
Output is correct |
21 |
Correct |
31 ms |
49656 KB |
Output is correct |
22 |
Correct |
31 ms |
49836 KB |
Output is correct |
23 |
Correct |
28 ms |
49748 KB |
Output is correct |
24 |
Correct |
29 ms |
49660 KB |
Output is correct |
25 |
Correct |
28 ms |
49712 KB |
Output is correct |
26 |
Correct |
31 ms |
49744 KB |
Output is correct |
27 |
Correct |
28 ms |
49720 KB |
Output is correct |
28 |
Correct |
30 ms |
49948 KB |
Output is correct |
29 |
Correct |
29 ms |
49644 KB |
Output is correct |
30 |
Correct |
30 ms |
49936 KB |
Output is correct |
31 |
Correct |
29 ms |
49876 KB |
Output is correct |
32 |
Correct |
29 ms |
49940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
49628 KB |
Output is correct |
2 |
Correct |
27 ms |
49620 KB |
Output is correct |
3 |
Correct |
28 ms |
49672 KB |
Output is correct |
4 |
Correct |
28 ms |
49620 KB |
Output is correct |
5 |
Correct |
27 ms |
49620 KB |
Output is correct |
6 |
Correct |
29 ms |
49664 KB |
Output is correct |
7 |
Correct |
28 ms |
49948 KB |
Output is correct |
8 |
Correct |
29 ms |
49916 KB |
Output is correct |
9 |
Correct |
29 ms |
49872 KB |
Output is correct |
10 |
Correct |
28 ms |
49948 KB |
Output is correct |
11 |
Correct |
29 ms |
49952 KB |
Output is correct |
12 |
Correct |
28 ms |
49748 KB |
Output is correct |
13 |
Correct |
28 ms |
49620 KB |
Output is correct |
14 |
Correct |
29 ms |
49836 KB |
Output is correct |
15 |
Correct |
28 ms |
49616 KB |
Output is correct |
16 |
Correct |
29 ms |
49844 KB |
Output is correct |
17 |
Correct |
29 ms |
49724 KB |
Output is correct |
18 |
Correct |
29 ms |
49612 KB |
Output is correct |
19 |
Correct |
29 ms |
49612 KB |
Output is correct |
20 |
Correct |
28 ms |
49616 KB |
Output is correct |
21 |
Correct |
29 ms |
49912 KB |
Output is correct |
22 |
Correct |
28 ms |
49824 KB |
Output is correct |
23 |
Correct |
28 ms |
49872 KB |
Output is correct |
24 |
Correct |
33 ms |
50312 KB |
Output is correct |
25 |
Correct |
57 ms |
60928 KB |
Output is correct |
26 |
Correct |
77 ms |
63432 KB |
Output is correct |
27 |
Correct |
71 ms |
62800 KB |
Output is correct |
28 |
Correct |
70 ms |
62880 KB |
Output is correct |
29 |
Correct |
55 ms |
63568 KB |
Output is correct |
30 |
Correct |
55 ms |
63676 KB |
Output is correct |
31 |
Correct |
56 ms |
64400 KB |
Output is correct |
32 |
Correct |
81 ms |
62552 KB |
Output is correct |
33 |
Correct |
89 ms |
62508 KB |
Output is correct |
34 |
Correct |
163 ms |
84896 KB |
Output is correct |
35 |
Correct |
162 ms |
85720 KB |
Output is correct |
36 |
Correct |
171 ms |
85712 KB |
Output is correct |
37 |
Correct |
123 ms |
87144 KB |
Output is correct |
38 |
Correct |
106 ms |
87172 KB |
Output is correct |
39 |
Correct |
548 ms |
175988 KB |
Output is correct |
40 |
Correct |
1456 ms |
403912 KB |
Output is correct |
41 |
Correct |
1956 ms |
433468 KB |
Output is correct |
42 |
Correct |
1478 ms |
433416 KB |
Output is correct |
43 |
Correct |
1014 ms |
452688 KB |
Output is correct |
44 |
Correct |
966 ms |
452748 KB |
Output is correct |
45 |
Correct |
1208 ms |
491792 KB |
Output is correct |
46 |
Correct |
1256 ms |
470792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
49652 KB |
Output is correct |
2 |
Correct |
30 ms |
49656 KB |
Output is correct |
3 |
Correct |
32 ms |
49588 KB |
Output is correct |
4 |
Correct |
29 ms |
49652 KB |
Output is correct |
5 |
Correct |
29 ms |
49892 KB |
Output is correct |
6 |
Correct |
28 ms |
49620 KB |
Output is correct |
7 |
Correct |
29 ms |
49684 KB |
Output is correct |
8 |
Correct |
28 ms |
49724 KB |
Output is correct |
9 |
Correct |
28 ms |
49968 KB |
Output is correct |
10 |
Correct |
29 ms |
49876 KB |
Output is correct |
11 |
Correct |
30 ms |
49852 KB |
Output is correct |
12 |
Correct |
30 ms |
49908 KB |
Output is correct |
13 |
Correct |
28 ms |
49944 KB |
Output is correct |
14 |
Correct |
30 ms |
49960 KB |
Output is correct |
15 |
Correct |
28 ms |
49792 KB |
Output is correct |
16 |
Correct |
33 ms |
49804 KB |
Output is correct |
17 |
Correct |
29 ms |
49908 KB |
Output is correct |
18 |
Correct |
29 ms |
49692 KB |
Output is correct |
19 |
Correct |
32 ms |
49876 KB |
Output is correct |
20 |
Correct |
28 ms |
49688 KB |
Output is correct |
21 |
Correct |
31 ms |
49656 KB |
Output is correct |
22 |
Correct |
31 ms |
49836 KB |
Output is correct |
23 |
Correct |
28 ms |
49748 KB |
Output is correct |
24 |
Correct |
29 ms |
49660 KB |
Output is correct |
25 |
Correct |
28 ms |
49712 KB |
Output is correct |
26 |
Correct |
31 ms |
49744 KB |
Output is correct |
27 |
Correct |
28 ms |
49720 KB |
Output is correct |
28 |
Correct |
30 ms |
49948 KB |
Output is correct |
29 |
Correct |
29 ms |
49644 KB |
Output is correct |
30 |
Correct |
30 ms |
49936 KB |
Output is correct |
31 |
Correct |
29 ms |
49876 KB |
Output is correct |
32 |
Correct |
29 ms |
49940 KB |
Output is correct |
33 |
Correct |
81 ms |
62164 KB |
Output is correct |
34 |
Correct |
30 ms |
50304 KB |
Output is correct |
35 |
Correct |
31 ms |
50796 KB |
Output is correct |
36 |
Correct |
58 ms |
60920 KB |
Output is correct |
37 |
Correct |
44 ms |
55292 KB |
Output is correct |
38 |
Correct |
68 ms |
63276 KB |
Output is correct |
39 |
Correct |
71 ms |
62860 KB |
Output is correct |
40 |
Correct |
79 ms |
62308 KB |
Output is correct |
41 |
Correct |
77 ms |
62196 KB |
Output is correct |
42 |
Correct |
69 ms |
62884 KB |
Output is correct |
43 |
Correct |
56 ms |
63652 KB |
Output is correct |
44 |
Correct |
57 ms |
63636 KB |
Output is correct |
45 |
Correct |
41 ms |
56396 KB |
Output is correct |
46 |
Correct |
44 ms |
56396 KB |
Output is correct |
47 |
Correct |
52 ms |
59824 KB |
Output is correct |
48 |
Correct |
69 ms |
67128 KB |
Output is correct |
49 |
Correct |
90 ms |
69796 KB |
Output is correct |
50 |
Correct |
57 ms |
64992 KB |
Output is correct |
51 |
Correct |
58 ms |
64392 KB |
Output is correct |
52 |
Correct |
79 ms |
62512 KB |
Output is correct |
53 |
Correct |
84 ms |
62376 KB |
Output is correct |
54 |
Correct |
70 ms |
62268 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
49652 KB |
Output is correct |
2 |
Correct |
30 ms |
49656 KB |
Output is correct |
3 |
Correct |
32 ms |
49588 KB |
Output is correct |
4 |
Correct |
29 ms |
49652 KB |
Output is correct |
5 |
Correct |
29 ms |
49892 KB |
Output is correct |
6 |
Correct |
28 ms |
49620 KB |
Output is correct |
7 |
Correct |
29 ms |
49684 KB |
Output is correct |
8 |
Correct |
28 ms |
49724 KB |
Output is correct |
9 |
Correct |
28 ms |
49968 KB |
Output is correct |
10 |
Correct |
29 ms |
49876 KB |
Output is correct |
11 |
Correct |
30 ms |
49852 KB |
Output is correct |
12 |
Correct |
30 ms |
49908 KB |
Output is correct |
13 |
Correct |
28 ms |
49944 KB |
Output is correct |
14 |
Correct |
30 ms |
49960 KB |
Output is correct |
15 |
Correct |
28 ms |
49792 KB |
Output is correct |
16 |
Correct |
33 ms |
49804 KB |
Output is correct |
17 |
Correct |
29 ms |
49908 KB |
Output is correct |
18 |
Correct |
29 ms |
49692 KB |
Output is correct |
19 |
Correct |
32 ms |
49876 KB |
Output is correct |
20 |
Correct |
28 ms |
49688 KB |
Output is correct |
21 |
Correct |
31 ms |
49656 KB |
Output is correct |
22 |
Correct |
31 ms |
49836 KB |
Output is correct |
23 |
Correct |
28 ms |
49748 KB |
Output is correct |
24 |
Correct |
29 ms |
49660 KB |
Output is correct |
25 |
Correct |
28 ms |
49712 KB |
Output is correct |
26 |
Correct |
31 ms |
49744 KB |
Output is correct |
27 |
Correct |
28 ms |
49720 KB |
Output is correct |
28 |
Correct |
30 ms |
49948 KB |
Output is correct |
29 |
Correct |
29 ms |
49644 KB |
Output is correct |
30 |
Correct |
30 ms |
49936 KB |
Output is correct |
31 |
Correct |
29 ms |
49876 KB |
Output is correct |
32 |
Correct |
29 ms |
49940 KB |
Output is correct |
33 |
Correct |
81 ms |
62164 KB |
Output is correct |
34 |
Correct |
30 ms |
50304 KB |
Output is correct |
35 |
Correct |
31 ms |
50796 KB |
Output is correct |
36 |
Correct |
58 ms |
60920 KB |
Output is correct |
37 |
Correct |
44 ms |
55292 KB |
Output is correct |
38 |
Correct |
68 ms |
63276 KB |
Output is correct |
39 |
Correct |
71 ms |
62860 KB |
Output is correct |
40 |
Correct |
79 ms |
62308 KB |
Output is correct |
41 |
Correct |
77 ms |
62196 KB |
Output is correct |
42 |
Correct |
69 ms |
62884 KB |
Output is correct |
43 |
Correct |
56 ms |
63652 KB |
Output is correct |
44 |
Correct |
57 ms |
63636 KB |
Output is correct |
45 |
Correct |
41 ms |
56396 KB |
Output is correct |
46 |
Correct |
44 ms |
56396 KB |
Output is correct |
47 |
Correct |
52 ms |
59824 KB |
Output is correct |
48 |
Correct |
69 ms |
67128 KB |
Output is correct |
49 |
Correct |
90 ms |
69796 KB |
Output is correct |
50 |
Correct |
57 ms |
64992 KB |
Output is correct |
51 |
Correct |
58 ms |
64392 KB |
Output is correct |
52 |
Correct |
79 ms |
62512 KB |
Output is correct |
53 |
Correct |
84 ms |
62376 KB |
Output is correct |
54 |
Correct |
70 ms |
62268 KB |
Output is correct |
55 |
Correct |
160 ms |
83676 KB |
Output is correct |
56 |
Correct |
54 ms |
60172 KB |
Output is correct |
57 |
Correct |
166 ms |
84892 KB |
Output is correct |
58 |
Correct |
122 ms |
88304 KB |
Output is correct |
59 |
Correct |
162 ms |
85800 KB |
Output is correct |
60 |
Correct |
201 ms |
83764 KB |
Output is correct |
61 |
Correct |
172 ms |
83640 KB |
Output is correct |
62 |
Correct |
150 ms |
85736 KB |
Output is correct |
63 |
Correct |
110 ms |
87124 KB |
Output is correct |
64 |
Correct |
125 ms |
87196 KB |
Output is correct |
65 |
Correct |
61 ms |
67636 KB |
Output is correct |
66 |
Correct |
65 ms |
67672 KB |
Output is correct |
67 |
Correct |
90 ms |
76988 KB |
Output is correct |
68 |
Correct |
126 ms |
94916 KB |
Output is correct |
69 |
Correct |
129 ms |
93900 KB |
Output is correct |
70 |
Correct |
165 ms |
98928 KB |
Output is correct |
71 |
Correct |
127 ms |
88276 KB |
Output is correct |
72 |
Correct |
185 ms |
84148 KB |
Output is correct |
73 |
Correct |
191 ms |
83876 KB |
Output is correct |
74 |
Correct |
155 ms |
83684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
49620 KB |
Output is correct |
2 |
Correct |
31 ms |
49604 KB |
Output is correct |
3 |
Correct |
28 ms |
49860 KB |
Output is correct |
4 |
Correct |
29 ms |
49852 KB |
Output is correct |
5 |
Correct |
29 ms |
49876 KB |
Output is correct |
6 |
Correct |
30 ms |
49864 KB |
Output is correct |
7 |
Correct |
32 ms |
49708 KB |
Output is correct |
8 |
Correct |
28 ms |
49748 KB |
Output is correct |
9 |
Correct |
28 ms |
49604 KB |
Output is correct |
10 |
Correct |
28 ms |
49612 KB |
Output is correct |
11 |
Correct |
28 ms |
49612 KB |
Output is correct |
12 |
Correct |
29 ms |
49612 KB |
Output is correct |
13 |
Correct |
31 ms |
49608 KB |
Output is correct |
14 |
Correct |
29 ms |
49732 KB |
Output is correct |
15 |
Correct |
30 ms |
49620 KB |
Output is correct |
16 |
Correct |
29 ms |
49872 KB |
Output is correct |
17 |
Correct |
29 ms |
49892 KB |
Output is correct |
18 |
Correct |
28 ms |
49948 KB |
Output is correct |
19 |
Correct |
97 ms |
62252 KB |
Output is correct |
20 |
Correct |
41 ms |
55084 KB |
Output is correct |
21 |
Correct |
76 ms |
63176 KB |
Output is correct |
22 |
Correct |
79 ms |
62288 KB |
Output is correct |
23 |
Correct |
77 ms |
62284 KB |
Output is correct |
24 |
Correct |
40 ms |
56324 KB |
Output is correct |
25 |
Correct |
45 ms |
56400 KB |
Output is correct |
26 |
Correct |
82 ms |
62516 KB |
Output is correct |
27 |
Correct |
100 ms |
62368 KB |
Output is correct |
28 |
Correct |
67 ms |
62144 KB |
Output is correct |
29 |
Correct |
160 ms |
83672 KB |
Output is correct |
30 |
Correct |
53 ms |
60172 KB |
Output is correct |
31 |
Correct |
162 ms |
85800 KB |
Output is correct |
32 |
Correct |
217 ms |
83788 KB |
Output is correct |
33 |
Correct |
169 ms |
83576 KB |
Output is correct |
34 |
Correct |
60 ms |
67612 KB |
Output is correct |
35 |
Correct |
66 ms |
67660 KB |
Output is correct |
36 |
Correct |
221 ms |
84044 KB |
Output is correct |
37 |
Correct |
192 ms |
83880 KB |
Output is correct |
38 |
Correct |
152 ms |
83660 KB |
Output is correct |
39 |
Execution timed out |
2093 ms |
416960 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
49620 KB |
Output is correct |
2 |
Correct |
31 ms |
49604 KB |
Output is correct |
3 |
Correct |
28 ms |
49860 KB |
Output is correct |
4 |
Correct |
29 ms |
49852 KB |
Output is correct |
5 |
Correct |
29 ms |
49876 KB |
Output is correct |
6 |
Correct |
30 ms |
49864 KB |
Output is correct |
7 |
Correct |
32 ms |
49708 KB |
Output is correct |
8 |
Correct |
28 ms |
49748 KB |
Output is correct |
9 |
Correct |
28 ms |
49604 KB |
Output is correct |
10 |
Correct |
28 ms |
49612 KB |
Output is correct |
11 |
Correct |
28 ms |
49612 KB |
Output is correct |
12 |
Correct |
29 ms |
49612 KB |
Output is correct |
13 |
Correct |
31 ms |
49608 KB |
Output is correct |
14 |
Correct |
29 ms |
49732 KB |
Output is correct |
15 |
Correct |
30 ms |
49620 KB |
Output is correct |
16 |
Correct |
29 ms |
49872 KB |
Output is correct |
17 |
Correct |
29 ms |
49892 KB |
Output is correct |
18 |
Correct |
28 ms |
49948 KB |
Output is correct |
19 |
Correct |
97 ms |
62252 KB |
Output is correct |
20 |
Correct |
41 ms |
55084 KB |
Output is correct |
21 |
Correct |
76 ms |
63176 KB |
Output is correct |
22 |
Correct |
79 ms |
62288 KB |
Output is correct |
23 |
Correct |
77 ms |
62284 KB |
Output is correct |
24 |
Correct |
40 ms |
56324 KB |
Output is correct |
25 |
Correct |
45 ms |
56400 KB |
Output is correct |
26 |
Correct |
82 ms |
62516 KB |
Output is correct |
27 |
Correct |
100 ms |
62368 KB |
Output is correct |
28 |
Correct |
67 ms |
62144 KB |
Output is correct |
29 |
Correct |
160 ms |
83672 KB |
Output is correct |
30 |
Correct |
53 ms |
60172 KB |
Output is correct |
31 |
Correct |
162 ms |
85800 KB |
Output is correct |
32 |
Correct |
217 ms |
83788 KB |
Output is correct |
33 |
Correct |
169 ms |
83576 KB |
Output is correct |
34 |
Correct |
60 ms |
67612 KB |
Output is correct |
35 |
Correct |
66 ms |
67660 KB |
Output is correct |
36 |
Correct |
221 ms |
84044 KB |
Output is correct |
37 |
Correct |
192 ms |
83880 KB |
Output is correct |
38 |
Correct |
152 ms |
83660 KB |
Output is correct |
39 |
Execution timed out |
2093 ms |
416960 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
49620 KB |
Output is correct |
2 |
Correct |
31 ms |
49604 KB |
Output is correct |
3 |
Correct |
28 ms |
49860 KB |
Output is correct |
4 |
Correct |
29 ms |
49852 KB |
Output is correct |
5 |
Correct |
29 ms |
49876 KB |
Output is correct |
6 |
Correct |
30 ms |
49864 KB |
Output is correct |
7 |
Correct |
32 ms |
49708 KB |
Output is correct |
8 |
Correct |
28 ms |
49748 KB |
Output is correct |
9 |
Correct |
28 ms |
49604 KB |
Output is correct |
10 |
Correct |
28 ms |
49612 KB |
Output is correct |
11 |
Correct |
28 ms |
49612 KB |
Output is correct |
12 |
Correct |
29 ms |
49612 KB |
Output is correct |
13 |
Correct |
31 ms |
49608 KB |
Output is correct |
14 |
Correct |
29 ms |
49732 KB |
Output is correct |
15 |
Correct |
30 ms |
49620 KB |
Output is correct |
16 |
Correct |
29 ms |
49872 KB |
Output is correct |
17 |
Correct |
29 ms |
49892 KB |
Output is correct |
18 |
Correct |
28 ms |
49948 KB |
Output is correct |
19 |
Correct |
97 ms |
62252 KB |
Output is correct |
20 |
Correct |
41 ms |
55084 KB |
Output is correct |
21 |
Correct |
76 ms |
63176 KB |
Output is correct |
22 |
Correct |
79 ms |
62288 KB |
Output is correct |
23 |
Correct |
77 ms |
62284 KB |
Output is correct |
24 |
Correct |
40 ms |
56324 KB |
Output is correct |
25 |
Correct |
45 ms |
56400 KB |
Output is correct |
26 |
Correct |
82 ms |
62516 KB |
Output is correct |
27 |
Correct |
100 ms |
62368 KB |
Output is correct |
28 |
Correct |
67 ms |
62144 KB |
Output is correct |
29 |
Correct |
160 ms |
83672 KB |
Output is correct |
30 |
Correct |
53 ms |
60172 KB |
Output is correct |
31 |
Correct |
162 ms |
85800 KB |
Output is correct |
32 |
Correct |
217 ms |
83788 KB |
Output is correct |
33 |
Correct |
169 ms |
83576 KB |
Output is correct |
34 |
Correct |
60 ms |
67612 KB |
Output is correct |
35 |
Correct |
66 ms |
67660 KB |
Output is correct |
36 |
Correct |
221 ms |
84044 KB |
Output is correct |
37 |
Correct |
192 ms |
83880 KB |
Output is correct |
38 |
Correct |
152 ms |
83660 KB |
Output is correct |
39 |
Execution timed out |
2093 ms |
416960 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |