#include <bits/stdc++.h>
//#include "grader.cpp"
#include "parks.h"
#define F first
#define S second
#define pb push_back
#define sz(x) (int)x.size()
#define el "\n"
#define all(x) (x).begin(), (x).end()
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const int N = 5e5 + 500;
mt19937 rnd(time(0));
const int steps[4][2] = {{0, 2}, {2, 0}, {0, -2}, {-2, 0}};
const int dsteps[4][2] = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
map <pair <int, int>, pair <int, int> > road;
pair <int, int> block[N * 2];
int pr[N];
int cmp[2 * N], to[2 * N];
vector <int> g[2 * N], gr[2 * N], ord;
bool mk[2 * N];
int f(int v) {return (pr[v] == v ? v : pr[v] = f(pr[v]));}
void link(int v, int u) {
v = f(v); u = f(u);
if (v == u) {
return;
}
pr[u] = v;
}
int nt(int x) {return (x < N ? x + N : x - N);}
void add_impl(int a, int b) {
int na = nt(a), nb = nt(b);
g[na].pb(b); gr[b].pb(na);
g[nb].pb(a); gr[a].pb(nb);
}
void dfs(int v) {
mk[v] = 1;
for (auto u : g[v]) {
if (mk[u]) {
continue;
}
dfs(u);
}
ord.pb(v);
}
vector <pair <int, int> > pts;
void dfsd(int v) {
mk[v] = 1;
for (auto u : g[v]) {
if (mk[u]) {
continue;
}
int dx = pts[v].F - pts[u].F;
int dy = pts[v].S - pts[u].S;
block[u] = road[{dx, dy}];
dfsd(u);
}
}
void get_erased_2x2(vector <int> &x, vector <int> &y, map<pair <int, int>, int> &del) {
map <pair <int, int>, int> cnt, who;
for (int i = 0; i < sz(x); i++) {
who[{x[i], y[i]}] = i;
for (int j = 0; j < 4; j++) {
int cx = x[i] + dsteps[j][0];
int cy = y[i] + dsteps[j][1];
cnt[{cx, cy}]++;
if (cnt[{cx, cy}] == 4) {
pts.pb({cx, cy});
}
}
}
sort(all(pts));
cnt.clear();
int ptr = 0;
for (auto &[x, y] : pts) {
cnt[{x, y}] = ptr++;
}
ptr = 0;
for (auto &[x, y] : pts) {
int par = (x / 2 + y / 2) % 2;
for (int i = 0; i < 2; i++) {
int cx = x + steps[i * 2 + par][0];
int cy = y + steps[i * 2 + par][1];
if (!cnt.count({cx, cy})) {
continue;
}
g[cnt[{cx, cy}]].pb(ptr);
}
ptr++;
}
for (int i = 0; i < sz(pts); i++) {
if (mk[i]) {
continue;
}
int par = (pts[i].F / 2 + pts[i].S / 2) & 1;
if (par & 1) {
block[i] = road[{-2, 0}];
} else {
block[i] = road[{0, -2}];
}
queue <int> q;
q.push(i); mk[i] = 1;
while (sz(q)) {
int v = q.front(); q.pop();
for (auto u : g[v]) {
if (mk[u]) {
continue;
}
int dx = pts[v].F - pts[u].F;
int dy = pts[v].S - pts[u].S;
block[u] = road[{dx, dy}];
q.push(u);
mk[u] = 1;
}
}
}
for (int i = 0; i < sz(pts); i++) {
auto [x, y] = pts[i];
auto [a, b] = block[i];
int v = who[{x + dsteps[a][0], y + dsteps[a][1]}];
int u = who[{x + dsteps[b][0], y + dsteps[b][1]}];
del[{v, u}] = del[{u, v}] = 1;
}
}
int construct_roads(vector <int> x, vector <int> y) {
int n = sz(x);
road[{0, 2}] = {2, 0}; road[{2, 0}] = {0, 1};
road[{0, -2}] = {1, 3}; road[{-2, 0}] = {3, 2};
map <pair <int, int>, int> mp;
vector <pair <int, int> > r;
map <pair <int, int>, int> del;
vector <int> pm(n);
iota(all(pm), 0);
shuffle(all(pm), rnd);
bool sd = 1;
for (int i = 0; i < n; i++) {
mp[{x[i], y[i]}] = i;
pr[i] = i;
sd &= (x[i] >= 2 && x[i] <= 4);
}
get_erased_2x2(x, y, del);
for (auto i : pm) {
for (int j = 0; j < 4; j++) {
int cx = x[i] + steps[j][0];
int cy = y[i] + steps[j][1];
if (mp.count({cx, cy}) && f(i) != f(mp[{cx, cy}])) {
int to = mp[{cx, cy}];
if (del[{i, to}]) {
continue;
}
link(i, to);
r.pb({i, to});
}
}
}
sort(all(r));
r.resize(unique(all(r)) - r.begin());
for (int i = 0; i < n; i++) {
if (f(i) != f(0)) {
return 0;
}
}
vector <int> u, v, A, B;
map <pair <int, int>, vector <int> > e;
for (int i = 0; i < sz(r); i++) {
int a = r[i].F, b = r[i].S;
u.pb(a); v.pb(b);
if (abs(x[a] - x[b]) == 0) {
int lx = x[a];
int ly = min(y[a], y[b]);
e[{lx - 1, ly + 1}].pb(i);
e[{lx + 1, ly + 1}].pb(nt(i));
} else {
int lx = min(x[a], x[b]);
int ly = y[a];
e[{lx + 1, ly + 1}].pb(i);
e[{lx + 1, ly - 1}].pb(nt(i));
}
}
for (int i = 0; i < 2 * N; i++) {
mk[i] = 0;
g[i].clear();
}
for (auto [p, v] : e) {
int x = p.F, y = p.S;
if (sz(v) == 1) {
continue;
}
for (auto a : v) {
for (auto b : v) {
if (a == b) {
continue;
}
add_impl(a, b);
}
}
}
for (int i = 0; i < 2 * N; i++) {
cmp[i] = -1;
if (mk[i]) {
continue;
}
dfs(i);
}
reverse(all(ord));
int C = 0;
for (auto v : ord) {
function <void(int)> dfsr = [&](int v) {
if (cmp[v] != -1) {
return;
}
cmp[v] = C;
for (auto u : gr[v]) {
dfsr(u);
}
};
dfsr(v);
C++;
}
for (int i = 0; i < N; i++) {
if (cmp[i] == cmp[nt(i)]) {
return 0;
}
to[i] = (cmp[i] > cmp[nt(i)]);
}
for (int i = 0; i < sz(r); i++) {
int a = r[i].F, b = r[i].S;
if (abs(x[a] - x[b]) == 0) {
int lx = x[a];
int ly = min(y[a], y[b]);
if (to[i]) {
A.pb(lx + 1);
} else {
A.pb(lx - 1);
}
B.pb(ly + 1);
} else {
int lx = min(x[a], x[b]);
int ly = y[a];
if (to[i]) {
B.pb(ly - 1);
} else {
B.pb(ly + 1);
}
A.pb(lx + 1);
}
}
build(u, v, A, B);
return 1;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:222:13: warning: unused variable 'x' [-Wunused-variable]
222 | int x = p.F, y = p.S;
| ^
parks.cpp:222:22: warning: unused variable 'y' [-Wunused-variable]
222 | int x = p.F, y = p.S;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
58168 KB |
Output is correct |
2 |
Correct |
43 ms |
58192 KB |
Output is correct |
3 |
Correct |
22 ms |
47336 KB |
Output is correct |
4 |
Correct |
42 ms |
58132 KB |
Output is correct |
5 |
Correct |
41 ms |
58176 KB |
Output is correct |
6 |
Correct |
23 ms |
47316 KB |
Output is correct |
7 |
Correct |
24 ms |
47332 KB |
Output is correct |
8 |
Correct |
24 ms |
47332 KB |
Output is correct |
9 |
Correct |
702 ms |
101964 KB |
Output is correct |
10 |
Correct |
76 ms |
62640 KB |
Output is correct |
11 |
Correct |
292 ms |
81500 KB |
Output is correct |
12 |
Correct |
96 ms |
64860 KB |
Output is correct |
13 |
Correct |
167 ms |
59792 KB |
Output is correct |
14 |
Correct |
26 ms |
47572 KB |
Output is correct |
15 |
Correct |
28 ms |
47856 KB |
Output is correct |
16 |
Correct |
724 ms |
101912 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
58168 KB |
Output is correct |
2 |
Correct |
43 ms |
58192 KB |
Output is correct |
3 |
Correct |
22 ms |
47336 KB |
Output is correct |
4 |
Correct |
42 ms |
58132 KB |
Output is correct |
5 |
Correct |
41 ms |
58176 KB |
Output is correct |
6 |
Correct |
23 ms |
47316 KB |
Output is correct |
7 |
Correct |
24 ms |
47332 KB |
Output is correct |
8 |
Correct |
24 ms |
47332 KB |
Output is correct |
9 |
Correct |
702 ms |
101964 KB |
Output is correct |
10 |
Correct |
76 ms |
62640 KB |
Output is correct |
11 |
Correct |
292 ms |
81500 KB |
Output is correct |
12 |
Correct |
96 ms |
64860 KB |
Output is correct |
13 |
Correct |
167 ms |
59792 KB |
Output is correct |
14 |
Correct |
26 ms |
47572 KB |
Output is correct |
15 |
Correct |
28 ms |
47856 KB |
Output is correct |
16 |
Correct |
724 ms |
101912 KB |
Output is correct |
17 |
Correct |
41 ms |
58172 KB |
Output is correct |
18 |
Correct |
47 ms |
58172 KB |
Output is correct |
19 |
Correct |
49 ms |
58244 KB |
Output is correct |
20 |
Correct |
50 ms |
58176 KB |
Output is correct |
21 |
Correct |
29 ms |
47316 KB |
Output is correct |
22 |
Correct |
41 ms |
58204 KB |
Output is correct |
23 |
Correct |
2413 ms |
159920 KB |
Output is correct |
24 |
Correct |
41 ms |
58168 KB |
Output is correct |
25 |
Correct |
47 ms |
58804 KB |
Output is correct |
26 |
Correct |
32 ms |
48140 KB |
Output is correct |
27 |
Correct |
37 ms |
48340 KB |
Output is correct |
28 |
Correct |
778 ms |
98612 KB |
Output is correct |
29 |
Correct |
1223 ms |
119044 KB |
Output is correct |
30 |
Correct |
1813 ms |
138972 KB |
Output is correct |
31 |
Correct |
2417 ms |
159104 KB |
Output is correct |
32 |
Correct |
41 ms |
58172 KB |
Output is correct |
33 |
Correct |
46 ms |
58220 KB |
Output is correct |
34 |
Correct |
41 ms |
58172 KB |
Output is correct |
35 |
Correct |
24 ms |
47316 KB |
Output is correct |
36 |
Correct |
23 ms |
47336 KB |
Output is correct |
37 |
Correct |
41 ms |
58124 KB |
Output is correct |
38 |
Correct |
41 ms |
58208 KB |
Output is correct |
39 |
Correct |
46 ms |
58132 KB |
Output is correct |
40 |
Correct |
47 ms |
58176 KB |
Output is correct |
41 |
Correct |
23 ms |
47284 KB |
Output is correct |
42 |
Correct |
42 ms |
58228 KB |
Output is correct |
43 |
Correct |
28 ms |
47864 KB |
Output is correct |
44 |
Correct |
33 ms |
48164 KB |
Output is correct |
45 |
Correct |
813 ms |
102708 KB |
Output is correct |
46 |
Correct |
1320 ms |
122688 KB |
Output is correct |
47 |
Correct |
1279 ms |
122196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
58168 KB |
Output is correct |
2 |
Correct |
43 ms |
58192 KB |
Output is correct |
3 |
Correct |
22 ms |
47336 KB |
Output is correct |
4 |
Correct |
42 ms |
58132 KB |
Output is correct |
5 |
Correct |
41 ms |
58176 KB |
Output is correct |
6 |
Correct |
23 ms |
47316 KB |
Output is correct |
7 |
Correct |
24 ms |
47332 KB |
Output is correct |
8 |
Correct |
24 ms |
47332 KB |
Output is correct |
9 |
Correct |
702 ms |
101964 KB |
Output is correct |
10 |
Correct |
76 ms |
62640 KB |
Output is correct |
11 |
Correct |
292 ms |
81500 KB |
Output is correct |
12 |
Correct |
96 ms |
64860 KB |
Output is correct |
13 |
Correct |
167 ms |
59792 KB |
Output is correct |
14 |
Correct |
26 ms |
47572 KB |
Output is correct |
15 |
Correct |
28 ms |
47856 KB |
Output is correct |
16 |
Correct |
724 ms |
101912 KB |
Output is correct |
17 |
Correct |
41 ms |
58172 KB |
Output is correct |
18 |
Correct |
47 ms |
58172 KB |
Output is correct |
19 |
Correct |
49 ms |
58244 KB |
Output is correct |
20 |
Correct |
50 ms |
58176 KB |
Output is correct |
21 |
Correct |
29 ms |
47316 KB |
Output is correct |
22 |
Correct |
41 ms |
58204 KB |
Output is correct |
23 |
Correct |
2413 ms |
159920 KB |
Output is correct |
24 |
Correct |
41 ms |
58168 KB |
Output is correct |
25 |
Correct |
47 ms |
58804 KB |
Output is correct |
26 |
Correct |
32 ms |
48140 KB |
Output is correct |
27 |
Correct |
37 ms |
48340 KB |
Output is correct |
28 |
Correct |
778 ms |
98612 KB |
Output is correct |
29 |
Correct |
1223 ms |
119044 KB |
Output is correct |
30 |
Correct |
1813 ms |
138972 KB |
Output is correct |
31 |
Correct |
2417 ms |
159104 KB |
Output is correct |
32 |
Correct |
41 ms |
58172 KB |
Output is correct |
33 |
Correct |
46 ms |
58220 KB |
Output is correct |
34 |
Correct |
41 ms |
58172 KB |
Output is correct |
35 |
Correct |
24 ms |
47316 KB |
Output is correct |
36 |
Correct |
23 ms |
47336 KB |
Output is correct |
37 |
Correct |
41 ms |
58124 KB |
Output is correct |
38 |
Correct |
41 ms |
58208 KB |
Output is correct |
39 |
Correct |
46 ms |
58132 KB |
Output is correct |
40 |
Correct |
47 ms |
58176 KB |
Output is correct |
41 |
Correct |
23 ms |
47284 KB |
Output is correct |
42 |
Correct |
42 ms |
58228 KB |
Output is correct |
43 |
Correct |
28 ms |
47864 KB |
Output is correct |
44 |
Correct |
33 ms |
48164 KB |
Output is correct |
45 |
Correct |
813 ms |
102708 KB |
Output is correct |
46 |
Correct |
1320 ms |
122688 KB |
Output is correct |
47 |
Correct |
1279 ms |
122196 KB |
Output is correct |
48 |
Correct |
40 ms |
58188 KB |
Output is correct |
49 |
Correct |
42 ms |
58220 KB |
Output is correct |
50 |
Correct |
41 ms |
58228 KB |
Output is correct |
51 |
Correct |
43 ms |
58212 KB |
Output is correct |
52 |
Correct |
46 ms |
58176 KB |
Output is correct |
53 |
Correct |
41 ms |
58168 KB |
Output is correct |
54 |
Correct |
42 ms |
58148 KB |
Output is correct |
55 |
Correct |
2811 ms |
167984 KB |
Output is correct |
56 |
Correct |
42 ms |
58168 KB |
Output is correct |
57 |
Correct |
49 ms |
59156 KB |
Output is correct |
58 |
Correct |
73 ms |
61412 KB |
Output is correct |
59 |
Correct |
64 ms |
50636 KB |
Output is correct |
60 |
Correct |
1132 ms |
112644 KB |
Output is correct |
61 |
Correct |
1692 ms |
131908 KB |
Output is correct |
62 |
Correct |
2065 ms |
148264 KB |
Output is correct |
63 |
Correct |
2968 ms |
167504 KB |
Output is correct |
64 |
Correct |
23 ms |
47316 KB |
Output is correct |
65 |
Correct |
43 ms |
58152 KB |
Output is correct |
66 |
Correct |
24 ms |
47240 KB |
Output is correct |
67 |
Correct |
1985 ms |
145656 KB |
Output is correct |
68 |
Correct |
1736 ms |
145720 KB |
Output is correct |
69 |
Correct |
1642 ms |
145300 KB |
Output is correct |
70 |
Correct |
34 ms |
48404 KB |
Output is correct |
71 |
Correct |
51 ms |
49504 KB |
Output is correct |
72 |
Correct |
877 ms |
102620 KB |
Output is correct |
73 |
Correct |
1370 ms |
125616 KB |
Output is correct |
74 |
Correct |
1991 ms |
147628 KB |
Output is correct |
75 |
Correct |
1863 ms |
147832 KB |
Output is correct |
76 |
Correct |
1658 ms |
145692 KB |
Output is correct |
77 |
Correct |
36 ms |
48588 KB |
Output is correct |
78 |
Correct |
48 ms |
49740 KB |
Output is correct |
79 |
Correct |
781 ms |
102816 KB |
Output is correct |
80 |
Correct |
1426 ms |
125988 KB |
Output is correct |
81 |
Correct |
1918 ms |
147516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
58168 KB |
Output is correct |
2 |
Correct |
43 ms |
58192 KB |
Output is correct |
3 |
Correct |
22 ms |
47336 KB |
Output is correct |
4 |
Correct |
42 ms |
58132 KB |
Output is correct |
5 |
Correct |
41 ms |
58176 KB |
Output is correct |
6 |
Correct |
23 ms |
47316 KB |
Output is correct |
7 |
Correct |
24 ms |
47332 KB |
Output is correct |
8 |
Correct |
24 ms |
47332 KB |
Output is correct |
9 |
Correct |
702 ms |
101964 KB |
Output is correct |
10 |
Correct |
76 ms |
62640 KB |
Output is correct |
11 |
Correct |
292 ms |
81500 KB |
Output is correct |
12 |
Correct |
96 ms |
64860 KB |
Output is correct |
13 |
Correct |
167 ms |
59792 KB |
Output is correct |
14 |
Correct |
26 ms |
47572 KB |
Output is correct |
15 |
Correct |
28 ms |
47856 KB |
Output is correct |
16 |
Correct |
724 ms |
101912 KB |
Output is correct |
17 |
Correct |
41 ms |
58168 KB |
Output is correct |
18 |
Correct |
41 ms |
58332 KB |
Output is correct |
19 |
Correct |
23 ms |
47316 KB |
Output is correct |
20 |
Correct |
1840 ms |
158728 KB |
Output is correct |
21 |
Correct |
1926 ms |
154676 KB |
Output is correct |
22 |
Correct |
1882 ms |
154544 KB |
Output is correct |
23 |
Correct |
1314 ms |
133304 KB |
Output is correct |
24 |
Correct |
1081 ms |
128816 KB |
Output is correct |
25 |
Correct |
1523 ms |
103964 KB |
Output is correct |
26 |
Correct |
1274 ms |
103796 KB |
Output is correct |
27 |
Correct |
1695 ms |
144984 KB |
Output is correct |
28 |
Correct |
1739 ms |
145548 KB |
Output is correct |
29 |
Correct |
1847 ms |
145632 KB |
Output is correct |
30 |
Correct |
1919 ms |
145708 KB |
Output is correct |
31 |
Correct |
42 ms |
58168 KB |
Output is correct |
32 |
Correct |
112 ms |
64820 KB |
Output is correct |
33 |
Correct |
397 ms |
82252 KB |
Output is correct |
34 |
Correct |
1760 ms |
157156 KB |
Output is correct |
35 |
Correct |
57 ms |
50072 KB |
Output is correct |
36 |
Correct |
246 ms |
61012 KB |
Output is correct |
37 |
Correct |
589 ms |
74188 KB |
Output is correct |
38 |
Correct |
647 ms |
94936 KB |
Output is correct |
39 |
Correct |
1052 ms |
108320 KB |
Output is correct |
40 |
Correct |
1271 ms |
121144 KB |
Output is correct |
41 |
Correct |
1646 ms |
135752 KB |
Output is correct |
42 |
Correct |
2004 ms |
148872 KB |
Output is correct |
43 |
Correct |
41 ms |
58240 KB |
Output is correct |
44 |
Correct |
42 ms |
58304 KB |
Output is correct |
45 |
Correct |
43 ms |
58128 KB |
Output is correct |
46 |
Correct |
23 ms |
47296 KB |
Output is correct |
47 |
Correct |
23 ms |
47336 KB |
Output is correct |
48 |
Correct |
40 ms |
58176 KB |
Output is correct |
49 |
Correct |
41 ms |
58228 KB |
Output is correct |
50 |
Correct |
41 ms |
58176 KB |
Output is correct |
51 |
Correct |
41 ms |
58180 KB |
Output is correct |
52 |
Correct |
24 ms |
47340 KB |
Output is correct |
53 |
Correct |
40 ms |
58192 KB |
Output is correct |
54 |
Correct |
27 ms |
47892 KB |
Output is correct |
55 |
Correct |
31 ms |
48116 KB |
Output is correct |
56 |
Correct |
771 ms |
102880 KB |
Output is correct |
57 |
Correct |
1270 ms |
122312 KB |
Output is correct |
58 |
Correct |
1284 ms |
122860 KB |
Output is correct |
59 |
Correct |
23 ms |
47316 KB |
Output is correct |
60 |
Correct |
44 ms |
58188 KB |
Output is correct |
61 |
Correct |
24 ms |
47292 KB |
Output is correct |
62 |
Correct |
1608 ms |
145680 KB |
Output is correct |
63 |
Correct |
1700 ms |
145756 KB |
Output is correct |
64 |
Correct |
1588 ms |
145392 KB |
Output is correct |
65 |
Correct |
34 ms |
48344 KB |
Output is correct |
66 |
Correct |
45 ms |
49520 KB |
Output is correct |
67 |
Correct |
850 ms |
102704 KB |
Output is correct |
68 |
Correct |
1367 ms |
126000 KB |
Output is correct |
69 |
Correct |
2005 ms |
148268 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
58168 KB |
Output is correct |
2 |
Correct |
43 ms |
58192 KB |
Output is correct |
3 |
Correct |
22 ms |
47336 KB |
Output is correct |
4 |
Correct |
42 ms |
58132 KB |
Output is correct |
5 |
Correct |
41 ms |
58176 KB |
Output is correct |
6 |
Correct |
23 ms |
47316 KB |
Output is correct |
7 |
Correct |
24 ms |
47332 KB |
Output is correct |
8 |
Correct |
24 ms |
47332 KB |
Output is correct |
9 |
Correct |
702 ms |
101964 KB |
Output is correct |
10 |
Correct |
76 ms |
62640 KB |
Output is correct |
11 |
Correct |
292 ms |
81500 KB |
Output is correct |
12 |
Correct |
96 ms |
64860 KB |
Output is correct |
13 |
Correct |
167 ms |
59792 KB |
Output is correct |
14 |
Correct |
26 ms |
47572 KB |
Output is correct |
15 |
Correct |
28 ms |
47856 KB |
Output is correct |
16 |
Correct |
724 ms |
101912 KB |
Output is correct |
17 |
Correct |
1639 ms |
145852 KB |
Output is correct |
18 |
Correct |
1901 ms |
146064 KB |
Output is correct |
19 |
Correct |
2335 ms |
159484 KB |
Output is correct |
20 |
Correct |
2241 ms |
145812 KB |
Output is correct |
21 |
Correct |
2028 ms |
135200 KB |
Output is correct |
22 |
Correct |
41 ms |
58204 KB |
Output is correct |
23 |
Correct |
264 ms |
72804 KB |
Output is correct |
24 |
Correct |
118 ms |
52488 KB |
Output is correct |
25 |
Correct |
417 ms |
65224 KB |
Output is correct |
26 |
Correct |
874 ms |
78084 KB |
Output is correct |
27 |
Correct |
1012 ms |
103700 KB |
Output is correct |
28 |
Correct |
1365 ms |
115296 KB |
Output is correct |
29 |
Correct |
1375 ms |
127208 KB |
Output is correct |
30 |
Correct |
1686 ms |
135872 KB |
Output is correct |
31 |
Correct |
1981 ms |
149600 KB |
Output is correct |
32 |
Correct |
1865 ms |
146944 KB |
Output is correct |
33 |
Correct |
1602 ms |
145684 KB |
Output is correct |
34 |
Correct |
36 ms |
48596 KB |
Output is correct |
35 |
Correct |
49 ms |
49732 KB |
Output is correct |
36 |
Correct |
767 ms |
102844 KB |
Output is correct |
37 |
Correct |
1352 ms |
125756 KB |
Output is correct |
38 |
Correct |
1954 ms |
147428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
58168 KB |
Output is correct |
2 |
Correct |
43 ms |
58192 KB |
Output is correct |
3 |
Correct |
22 ms |
47336 KB |
Output is correct |
4 |
Correct |
42 ms |
58132 KB |
Output is correct |
5 |
Correct |
41 ms |
58176 KB |
Output is correct |
6 |
Correct |
23 ms |
47316 KB |
Output is correct |
7 |
Correct |
24 ms |
47332 KB |
Output is correct |
8 |
Correct |
24 ms |
47332 KB |
Output is correct |
9 |
Correct |
702 ms |
101964 KB |
Output is correct |
10 |
Correct |
76 ms |
62640 KB |
Output is correct |
11 |
Correct |
292 ms |
81500 KB |
Output is correct |
12 |
Correct |
96 ms |
64860 KB |
Output is correct |
13 |
Correct |
167 ms |
59792 KB |
Output is correct |
14 |
Correct |
26 ms |
47572 KB |
Output is correct |
15 |
Correct |
28 ms |
47856 KB |
Output is correct |
16 |
Correct |
724 ms |
101912 KB |
Output is correct |
17 |
Correct |
41 ms |
58172 KB |
Output is correct |
18 |
Correct |
47 ms |
58172 KB |
Output is correct |
19 |
Correct |
49 ms |
58244 KB |
Output is correct |
20 |
Correct |
50 ms |
58176 KB |
Output is correct |
21 |
Correct |
29 ms |
47316 KB |
Output is correct |
22 |
Correct |
41 ms |
58204 KB |
Output is correct |
23 |
Correct |
2413 ms |
159920 KB |
Output is correct |
24 |
Correct |
41 ms |
58168 KB |
Output is correct |
25 |
Correct |
47 ms |
58804 KB |
Output is correct |
26 |
Correct |
32 ms |
48140 KB |
Output is correct |
27 |
Correct |
37 ms |
48340 KB |
Output is correct |
28 |
Correct |
778 ms |
98612 KB |
Output is correct |
29 |
Correct |
1223 ms |
119044 KB |
Output is correct |
30 |
Correct |
1813 ms |
138972 KB |
Output is correct |
31 |
Correct |
2417 ms |
159104 KB |
Output is correct |
32 |
Correct |
41 ms |
58172 KB |
Output is correct |
33 |
Correct |
46 ms |
58220 KB |
Output is correct |
34 |
Correct |
41 ms |
58172 KB |
Output is correct |
35 |
Correct |
24 ms |
47316 KB |
Output is correct |
36 |
Correct |
23 ms |
47336 KB |
Output is correct |
37 |
Correct |
41 ms |
58124 KB |
Output is correct |
38 |
Correct |
41 ms |
58208 KB |
Output is correct |
39 |
Correct |
46 ms |
58132 KB |
Output is correct |
40 |
Correct |
47 ms |
58176 KB |
Output is correct |
41 |
Correct |
23 ms |
47284 KB |
Output is correct |
42 |
Correct |
42 ms |
58228 KB |
Output is correct |
43 |
Correct |
28 ms |
47864 KB |
Output is correct |
44 |
Correct |
33 ms |
48164 KB |
Output is correct |
45 |
Correct |
813 ms |
102708 KB |
Output is correct |
46 |
Correct |
1320 ms |
122688 KB |
Output is correct |
47 |
Correct |
1279 ms |
122196 KB |
Output is correct |
48 |
Correct |
40 ms |
58188 KB |
Output is correct |
49 |
Correct |
42 ms |
58220 KB |
Output is correct |
50 |
Correct |
41 ms |
58228 KB |
Output is correct |
51 |
Correct |
43 ms |
58212 KB |
Output is correct |
52 |
Correct |
46 ms |
58176 KB |
Output is correct |
53 |
Correct |
41 ms |
58168 KB |
Output is correct |
54 |
Correct |
42 ms |
58148 KB |
Output is correct |
55 |
Correct |
2811 ms |
167984 KB |
Output is correct |
56 |
Correct |
42 ms |
58168 KB |
Output is correct |
57 |
Correct |
49 ms |
59156 KB |
Output is correct |
58 |
Correct |
73 ms |
61412 KB |
Output is correct |
59 |
Correct |
64 ms |
50636 KB |
Output is correct |
60 |
Correct |
1132 ms |
112644 KB |
Output is correct |
61 |
Correct |
1692 ms |
131908 KB |
Output is correct |
62 |
Correct |
2065 ms |
148264 KB |
Output is correct |
63 |
Correct |
2968 ms |
167504 KB |
Output is correct |
64 |
Correct |
23 ms |
47316 KB |
Output is correct |
65 |
Correct |
43 ms |
58152 KB |
Output is correct |
66 |
Correct |
24 ms |
47240 KB |
Output is correct |
67 |
Correct |
1985 ms |
145656 KB |
Output is correct |
68 |
Correct |
1736 ms |
145720 KB |
Output is correct |
69 |
Correct |
1642 ms |
145300 KB |
Output is correct |
70 |
Correct |
34 ms |
48404 KB |
Output is correct |
71 |
Correct |
51 ms |
49504 KB |
Output is correct |
72 |
Correct |
877 ms |
102620 KB |
Output is correct |
73 |
Correct |
1370 ms |
125616 KB |
Output is correct |
74 |
Correct |
1991 ms |
147628 KB |
Output is correct |
75 |
Correct |
1863 ms |
147832 KB |
Output is correct |
76 |
Correct |
1658 ms |
145692 KB |
Output is correct |
77 |
Correct |
36 ms |
48588 KB |
Output is correct |
78 |
Correct |
48 ms |
49740 KB |
Output is correct |
79 |
Correct |
781 ms |
102816 KB |
Output is correct |
80 |
Correct |
1426 ms |
125988 KB |
Output is correct |
81 |
Correct |
1918 ms |
147516 KB |
Output is correct |
82 |
Correct |
41 ms |
58168 KB |
Output is correct |
83 |
Correct |
41 ms |
58332 KB |
Output is correct |
84 |
Correct |
23 ms |
47316 KB |
Output is correct |
85 |
Correct |
1840 ms |
158728 KB |
Output is correct |
86 |
Correct |
1926 ms |
154676 KB |
Output is correct |
87 |
Correct |
1882 ms |
154544 KB |
Output is correct |
88 |
Correct |
1314 ms |
133304 KB |
Output is correct |
89 |
Correct |
1081 ms |
128816 KB |
Output is correct |
90 |
Correct |
1523 ms |
103964 KB |
Output is correct |
91 |
Correct |
1274 ms |
103796 KB |
Output is correct |
92 |
Correct |
1695 ms |
144984 KB |
Output is correct |
93 |
Correct |
1739 ms |
145548 KB |
Output is correct |
94 |
Correct |
1847 ms |
145632 KB |
Output is correct |
95 |
Correct |
1919 ms |
145708 KB |
Output is correct |
96 |
Correct |
42 ms |
58168 KB |
Output is correct |
97 |
Correct |
112 ms |
64820 KB |
Output is correct |
98 |
Correct |
397 ms |
82252 KB |
Output is correct |
99 |
Correct |
1760 ms |
157156 KB |
Output is correct |
100 |
Correct |
57 ms |
50072 KB |
Output is correct |
101 |
Correct |
246 ms |
61012 KB |
Output is correct |
102 |
Correct |
589 ms |
74188 KB |
Output is correct |
103 |
Correct |
647 ms |
94936 KB |
Output is correct |
104 |
Correct |
1052 ms |
108320 KB |
Output is correct |
105 |
Correct |
1271 ms |
121144 KB |
Output is correct |
106 |
Correct |
1646 ms |
135752 KB |
Output is correct |
107 |
Correct |
2004 ms |
148872 KB |
Output is correct |
108 |
Correct |
41 ms |
58240 KB |
Output is correct |
109 |
Correct |
42 ms |
58304 KB |
Output is correct |
110 |
Correct |
43 ms |
58128 KB |
Output is correct |
111 |
Correct |
23 ms |
47296 KB |
Output is correct |
112 |
Correct |
23 ms |
47336 KB |
Output is correct |
113 |
Correct |
40 ms |
58176 KB |
Output is correct |
114 |
Correct |
41 ms |
58228 KB |
Output is correct |
115 |
Correct |
41 ms |
58176 KB |
Output is correct |
116 |
Correct |
41 ms |
58180 KB |
Output is correct |
117 |
Correct |
24 ms |
47340 KB |
Output is correct |
118 |
Correct |
40 ms |
58192 KB |
Output is correct |
119 |
Correct |
27 ms |
47892 KB |
Output is correct |
120 |
Correct |
31 ms |
48116 KB |
Output is correct |
121 |
Correct |
771 ms |
102880 KB |
Output is correct |
122 |
Correct |
1270 ms |
122312 KB |
Output is correct |
123 |
Correct |
1284 ms |
122860 KB |
Output is correct |
124 |
Correct |
23 ms |
47316 KB |
Output is correct |
125 |
Correct |
44 ms |
58188 KB |
Output is correct |
126 |
Correct |
24 ms |
47292 KB |
Output is correct |
127 |
Correct |
1608 ms |
145680 KB |
Output is correct |
128 |
Correct |
1700 ms |
145756 KB |
Output is correct |
129 |
Correct |
1588 ms |
145392 KB |
Output is correct |
130 |
Correct |
34 ms |
48344 KB |
Output is correct |
131 |
Correct |
45 ms |
49520 KB |
Output is correct |
132 |
Correct |
850 ms |
102704 KB |
Output is correct |
133 |
Correct |
1367 ms |
126000 KB |
Output is correct |
134 |
Correct |
2005 ms |
148268 KB |
Output is correct |
135 |
Correct |
1639 ms |
145852 KB |
Output is correct |
136 |
Correct |
1901 ms |
146064 KB |
Output is correct |
137 |
Correct |
2335 ms |
159484 KB |
Output is correct |
138 |
Correct |
2241 ms |
145812 KB |
Output is correct |
139 |
Correct |
2028 ms |
135200 KB |
Output is correct |
140 |
Correct |
41 ms |
58204 KB |
Output is correct |
141 |
Correct |
264 ms |
72804 KB |
Output is correct |
142 |
Correct |
118 ms |
52488 KB |
Output is correct |
143 |
Correct |
417 ms |
65224 KB |
Output is correct |
144 |
Correct |
874 ms |
78084 KB |
Output is correct |
145 |
Correct |
1012 ms |
103700 KB |
Output is correct |
146 |
Correct |
1365 ms |
115296 KB |
Output is correct |
147 |
Correct |
1375 ms |
127208 KB |
Output is correct |
148 |
Correct |
1686 ms |
135872 KB |
Output is correct |
149 |
Correct |
1981 ms |
149600 KB |
Output is correct |
150 |
Correct |
1865 ms |
146944 KB |
Output is correct |
151 |
Correct |
1602 ms |
145684 KB |
Output is correct |
152 |
Correct |
36 ms |
48596 KB |
Output is correct |
153 |
Correct |
49 ms |
49732 KB |
Output is correct |
154 |
Correct |
767 ms |
102844 KB |
Output is correct |
155 |
Correct |
1352 ms |
125756 KB |
Output is correct |
156 |
Correct |
1954 ms |
147428 KB |
Output is correct |
157 |
Correct |
40 ms |
58168 KB |
Output is correct |
158 |
Correct |
27 ms |
47316 KB |
Output is correct |
159 |
Correct |
41 ms |
58168 KB |
Output is correct |
160 |
Correct |
44 ms |
58264 KB |
Output is correct |
161 |
Correct |
2843 ms |
177120 KB |
Output is correct |
162 |
Correct |
1716 ms |
158760 KB |
Output is correct |
163 |
Correct |
2066 ms |
160332 KB |
Output is correct |
164 |
Correct |
2065 ms |
158768 KB |
Output is correct |
165 |
Correct |
2529 ms |
172532 KB |
Output is correct |
166 |
Correct |
2725 ms |
176188 KB |
Output is correct |
167 |
Correct |
441 ms |
83988 KB |
Output is correct |
168 |
Correct |
198 ms |
59136 KB |
Output is correct |
169 |
Correct |
651 ms |
79168 KB |
Output is correct |
170 |
Correct |
1464 ms |
107636 KB |
Output is correct |
171 |
Correct |
2049 ms |
125252 KB |
Output is correct |
172 |
Correct |
1165 ms |
117740 KB |
Output is correct |
173 |
Correct |
1472 ms |
129684 KB |
Output is correct |
174 |
Correct |
1770 ms |
141688 KB |
Output is correct |
175 |
Correct |
2118 ms |
153088 KB |
Output is correct |
176 |
Correct |
2425 ms |
166032 KB |
Output is correct |
177 |
Correct |
2789 ms |
177756 KB |
Output is correct |