#include "parks.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
typedef long long ll;
typedef std::pair<int,int> pii;
using namespace std;
const int N = 200'010;
namespace dsu {
int par[N];
void init(int n) { memset(par, -1, sizeof(*par)*n); }
int rt(int v) { return par[v] == -1? v: (par[v] = rt(par[v])); }
bool unite(int v, int u) {
v = rt(v);
u = rt(u);
if (v == u)
return 0;
par[u] = v;
return 1;
}
}
map<pii,int> pts;
vector<pii> edge;
vector<int> X, Y;
int n;
int get_pnt(int x, int y)
{
auto it = pts.find(pii(x, y));
return it == pts.end()? -1: it->second;
}
tuple<int,int,int,int> get_chair(int p1, int p2)
{
int x1 = X[p1], y1 = Y[p1], x2 = X[p2], y2 = Y[p2];
if (x1 == x2)
return {x1-1, (y1+y2)/2, x1+1, (y1+y2)/2};
else
return {(x1+x2)/2, y1-1, (x1+x2)/2, y1+1};
}
namespace matching {
int match[3*N];
int par[3*N];
vector<int> A[3*N];
vector<pii> chairs;
bool bfs(int s)
{
vector<int> q = {s}, q2;
par[s] = -2;
int vv;
Loop (i,0,q.size()) {
int v = q[i];
//cerr << "bfs " << v << '\n';
for (int u : A[v]) {
if (par[u] != -1)
continue;
par[u] = v;
q2.push_back(u);
if (match[u] == -1) {
vv = u;
goto found;
}
int u2 = match[u];
par[u2] = u;
q.push_back(u2);
}
}
return 0;
found:
while (vv != -2) {
match[vv] = par[vv];
match[par[vv]] = vv;
vv = par[par[vv]];
}
for (int x : q2)
par[x] = -1;
return 1;
}
vector<pii> get_match(vector<pii> e) {
int m = e.size();
chairs.clear();
Loop (i,0,m) {
auto [p1, p2] = e[i];
auto [x1, y1, x2, y2] = get_chair(p1, p2);
chairs.emplace_back(x1, y1);
chairs.emplace_back(x2, y2);
}
sort(chairs.begin(), chairs.end());
chairs.resize(unique(chairs.begin(), chairs.end()) - chairs.begin());
//for (auto [x, y] : chairs)
// cerr << x << ' ' << y << '\n';
Loop (i,0,m+chairs.size()) {
A[i].clear();
match[i] = -1;
par[i] = -1;
}
Loop (i,0,m) {
auto [p1, p2] = e[i];
auto [x1, y1, x2, y2] = get_chair(p1, p2);
int c1 = lower_bound(chairs.begin(), chairs.end(), pii(x1, y1)) - chairs.begin();
int c2 = lower_bound(chairs.begin(), chairs.end(), pii(x2, y2)) - chairs.begin();
A[i].push_back(m+c1);
A[i].push_back(m+c2);
A[m+c1].push_back(i);
A[m+c2].push_back(i);
}
Loop (i,0,m) {
//cerr << "try " << i << '\n';
if (!bfs(i))
return {};
//Loop (i,0,m+chairs.size())
// cerr << match[i] << ' ';
//cerr << '\n';
}
//cerr << "all good!\n";
vector<pii> ans;
Loop (i,0,m) {
int c = match[i]-m;
ans.emplace_back(chairs[c].first, chairs[c].second);
}
return ans;
}
}
void make_edges()
{
Loop (i,0,n) {
int x = X[i];
int y = Y[i];
int p1 = get_pnt(x, y+2);
if (p1 != -1)
edge.push_back({i, p1});
}
Loop (i,0,n) {
int x = X[i];
int y = Y[i];
int p1 = get_pnt(x+2, y);
if (p1 != -1)
edge.push_back({i, p1});
}
}
namespace dfs {
vector<int> A[N];
bool vis[N];
vector<pii> ans;
void dfs(int v) {
vis[v] = 1;
for (int u : A[v]) {
if (vis[u])
continue;
ans.emplace_back(v, u);
dfs(u);
}
}
vector<pii> Do(int n, int s, vector<pii> e) {
Loop (i,0,n) {
A[i].clear();
vis[i] = 0;
}
ans.clear();
for (auto [x, y] : e) {
A[x].push_back(y);
A[y].push_back(x);
}
dfs(0);
return ans;
}
}
int construct_roads(std::vector<int> _X, std::vector<int> _Y) {
X = _X; Y = _Y;
n = X.size();
if (n == 1) {
build({}, {}, {}, {});
return 1;
}
Loop (i,0,n)
pts[pii(X[i], Y[i])] = i;
pair<pii,int> mn;
Loop (i,0,n)
mn = min(mn, pair<pii,int>(pii(X[i], Y[i]), i));
make_edges();
//for (auto [x, y] : edge)
// cerr << X[x] << ' ' << Y[x] << " - " << X[y] << ' ' << Y[y] << '\n';
mt19937_64 rd(time(0));
while (clock() < 3*CLOCKS_PER_SEC) {
dsu::init(n);
vector<pii> e = dfs::Do(n, mn.second, edge);
if (e.size() != n-1)
return 0;
auto chairs = matching::get_match(e);
//cerr << "found!\n";
//for (auto [x, y] : chairs)
// cerr << x << ' ' << y << '\n';
if (chairs.empty()) {
shuffle(edge.begin(), edge.end(), rd);
continue;
}
vector<int> ex, ey, cx, cy;
Loop (i,0,n-1) {
ex.push_back(e[i].first);
ey.push_back(e[i].second);
cx.push_back(chairs[i].first);
cy.push_back(chairs[i].second);
}
build(ex, ey, cx, cy);
return 1;
}
return 0;
}
Compilation message
parks.cpp: In function 'bool matching::bfs(int)':
parks.cpp:3:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
3 | #define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
| ^
parks.cpp:55:3: note: in expansion of macro 'Loop'
55 | Loop (i,0,q.size()) {
| ^~~~
parks.cpp: In function 'std::vector<std::pair<int, int> > matching::get_match(std::vector<std::pair<int, int> >)':
parks.cpp:3:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
3 | #define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
| ^
parks.cpp:97:3: note: in expansion of macro 'Loop'
97 | Loop (i,0,m+chairs.size()) {
| ^~~~
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:195:16: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
195 | if (e.size() != n-1)
| ~~~~~~~~~^~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
19028 KB |
Output is correct |
2 |
Correct |
11 ms |
19104 KB |
Output is correct |
3 |
Correct |
10 ms |
19028 KB |
Output is correct |
4 |
Correct |
10 ms |
19036 KB |
Output is correct |
5 |
Correct |
10 ms |
19100 KB |
Output is correct |
6 |
Correct |
10 ms |
19028 KB |
Output is correct |
7 |
Correct |
11 ms |
19028 KB |
Output is correct |
8 |
Correct |
13 ms |
19100 KB |
Output is correct |
9 |
Correct |
166 ms |
61164 KB |
Output is correct |
10 |
Correct |
22 ms |
23592 KB |
Output is correct |
11 |
Correct |
80 ms |
42068 KB |
Output is correct |
12 |
Correct |
30 ms |
25764 KB |
Output is correct |
13 |
Correct |
36 ms |
28308 KB |
Output is correct |
14 |
Correct |
10 ms |
19156 KB |
Output is correct |
15 |
Correct |
12 ms |
19368 KB |
Output is correct |
16 |
Correct |
178 ms |
57780 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
19028 KB |
Output is correct |
2 |
Correct |
11 ms |
19104 KB |
Output is correct |
3 |
Correct |
10 ms |
19028 KB |
Output is correct |
4 |
Correct |
10 ms |
19036 KB |
Output is correct |
5 |
Correct |
10 ms |
19100 KB |
Output is correct |
6 |
Correct |
10 ms |
19028 KB |
Output is correct |
7 |
Correct |
11 ms |
19028 KB |
Output is correct |
8 |
Correct |
13 ms |
19100 KB |
Output is correct |
9 |
Correct |
166 ms |
61164 KB |
Output is correct |
10 |
Correct |
22 ms |
23592 KB |
Output is correct |
11 |
Correct |
80 ms |
42068 KB |
Output is correct |
12 |
Correct |
30 ms |
25764 KB |
Output is correct |
13 |
Correct |
36 ms |
28308 KB |
Output is correct |
14 |
Correct |
10 ms |
19156 KB |
Output is correct |
15 |
Correct |
12 ms |
19368 KB |
Output is correct |
16 |
Correct |
178 ms |
57780 KB |
Output is correct |
17 |
Correct |
10 ms |
19044 KB |
Output is correct |
18 |
Correct |
11 ms |
19028 KB |
Output is correct |
19 |
Correct |
10 ms |
19104 KB |
Output is correct |
20 |
Correct |
12 ms |
19104 KB |
Output is correct |
21 |
Correct |
10 ms |
19104 KB |
Output is correct |
22 |
Correct |
10 ms |
18996 KB |
Output is correct |
23 |
Correct |
466 ms |
102828 KB |
Output is correct |
24 |
Correct |
10 ms |
19028 KB |
Output is correct |
25 |
Correct |
12 ms |
19620 KB |
Output is correct |
26 |
Correct |
13 ms |
19628 KB |
Output is correct |
27 |
Correct |
14 ms |
19752 KB |
Output is correct |
28 |
Correct |
141 ms |
52360 KB |
Output is correct |
29 |
Correct |
227 ms |
69072 KB |
Output is correct |
30 |
Correct |
345 ms |
85552 KB |
Output is correct |
31 |
Correct |
442 ms |
102932 KB |
Output is correct |
32 |
Correct |
11 ms |
19028 KB |
Output is correct |
33 |
Correct |
11 ms |
19100 KB |
Output is correct |
34 |
Correct |
10 ms |
19028 KB |
Output is correct |
35 |
Correct |
10 ms |
19100 KB |
Output is correct |
36 |
Correct |
10 ms |
19088 KB |
Output is correct |
37 |
Correct |
11 ms |
19080 KB |
Output is correct |
38 |
Correct |
13 ms |
19100 KB |
Output is correct |
39 |
Correct |
11 ms |
19152 KB |
Output is correct |
40 |
Correct |
12 ms |
19104 KB |
Output is correct |
41 |
Correct |
10 ms |
19028 KB |
Output is correct |
42 |
Correct |
11 ms |
19028 KB |
Output is correct |
43 |
Correct |
11 ms |
19368 KB |
Output is correct |
44 |
Correct |
12 ms |
19504 KB |
Output is correct |
45 |
Correct |
187 ms |
56236 KB |
Output is correct |
46 |
Correct |
297 ms |
74456 KB |
Output is correct |
47 |
Correct |
294 ms |
73916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
19028 KB |
Output is correct |
2 |
Correct |
11 ms |
19104 KB |
Output is correct |
3 |
Correct |
10 ms |
19028 KB |
Output is correct |
4 |
Correct |
10 ms |
19036 KB |
Output is correct |
5 |
Correct |
10 ms |
19100 KB |
Output is correct |
6 |
Correct |
10 ms |
19028 KB |
Output is correct |
7 |
Correct |
11 ms |
19028 KB |
Output is correct |
8 |
Correct |
13 ms |
19100 KB |
Output is correct |
9 |
Correct |
166 ms |
61164 KB |
Output is correct |
10 |
Correct |
22 ms |
23592 KB |
Output is correct |
11 |
Correct |
80 ms |
42068 KB |
Output is correct |
12 |
Correct |
30 ms |
25764 KB |
Output is correct |
13 |
Correct |
36 ms |
28308 KB |
Output is correct |
14 |
Correct |
10 ms |
19156 KB |
Output is correct |
15 |
Correct |
12 ms |
19368 KB |
Output is correct |
16 |
Correct |
178 ms |
57780 KB |
Output is correct |
17 |
Correct |
10 ms |
19044 KB |
Output is correct |
18 |
Correct |
11 ms |
19028 KB |
Output is correct |
19 |
Correct |
10 ms |
19104 KB |
Output is correct |
20 |
Correct |
12 ms |
19104 KB |
Output is correct |
21 |
Correct |
10 ms |
19104 KB |
Output is correct |
22 |
Correct |
10 ms |
18996 KB |
Output is correct |
23 |
Correct |
466 ms |
102828 KB |
Output is correct |
24 |
Correct |
10 ms |
19028 KB |
Output is correct |
25 |
Correct |
12 ms |
19620 KB |
Output is correct |
26 |
Correct |
13 ms |
19628 KB |
Output is correct |
27 |
Correct |
14 ms |
19752 KB |
Output is correct |
28 |
Correct |
141 ms |
52360 KB |
Output is correct |
29 |
Correct |
227 ms |
69072 KB |
Output is correct |
30 |
Correct |
345 ms |
85552 KB |
Output is correct |
31 |
Correct |
442 ms |
102932 KB |
Output is correct |
32 |
Correct |
11 ms |
19028 KB |
Output is correct |
33 |
Correct |
11 ms |
19100 KB |
Output is correct |
34 |
Correct |
10 ms |
19028 KB |
Output is correct |
35 |
Correct |
10 ms |
19100 KB |
Output is correct |
36 |
Correct |
10 ms |
19088 KB |
Output is correct |
37 |
Correct |
11 ms |
19080 KB |
Output is correct |
38 |
Correct |
13 ms |
19100 KB |
Output is correct |
39 |
Correct |
11 ms |
19152 KB |
Output is correct |
40 |
Correct |
12 ms |
19104 KB |
Output is correct |
41 |
Correct |
10 ms |
19028 KB |
Output is correct |
42 |
Correct |
11 ms |
19028 KB |
Output is correct |
43 |
Correct |
11 ms |
19368 KB |
Output is correct |
44 |
Correct |
12 ms |
19504 KB |
Output is correct |
45 |
Correct |
187 ms |
56236 KB |
Output is correct |
46 |
Correct |
297 ms |
74456 KB |
Output is correct |
47 |
Correct |
294 ms |
73916 KB |
Output is correct |
48 |
Correct |
10 ms |
19028 KB |
Output is correct |
49 |
Correct |
12 ms |
19100 KB |
Output is correct |
50 |
Correct |
10 ms |
19028 KB |
Output is correct |
51 |
Correct |
10 ms |
19028 KB |
Output is correct |
52 |
Correct |
10 ms |
19012 KB |
Output is correct |
53 |
Correct |
10 ms |
19104 KB |
Output is correct |
54 |
Correct |
10 ms |
19088 KB |
Output is correct |
55 |
Correct |
445 ms |
97756 KB |
Output is correct |
56 |
Correct |
10 ms |
19028 KB |
Output is correct |
57 |
Correct |
15 ms |
19796 KB |
Output is correct |
58 |
Correct |
18 ms |
21588 KB |
Output is correct |
59 |
Correct |
17 ms |
20776 KB |
Output is correct |
60 |
Correct |
181 ms |
60032 KB |
Output is correct |
61 |
Correct |
268 ms |
74356 KB |
Output is correct |
62 |
Correct |
338 ms |
84372 KB |
Output is correct |
63 |
Correct |
499 ms |
100048 KB |
Output is correct |
64 |
Correct |
10 ms |
19028 KB |
Output is correct |
65 |
Correct |
10 ms |
19104 KB |
Output is correct |
66 |
Correct |
10 ms |
19104 KB |
Output is correct |
67 |
Correct |
391 ms |
99744 KB |
Output is correct |
68 |
Correct |
428 ms |
99952 KB |
Output is correct |
69 |
Correct |
382 ms |
101360 KB |
Output is correct |
70 |
Correct |
14 ms |
19784 KB |
Output is correct |
71 |
Correct |
16 ms |
20400 KB |
Output is correct |
72 |
Correct |
193 ms |
53664 KB |
Output is correct |
73 |
Correct |
332 ms |
74060 KB |
Output is correct |
74 |
Correct |
469 ms |
88796 KB |
Output is correct |
75 |
Correct |
457 ms |
98308 KB |
Output is correct |
76 |
Correct |
426 ms |
104260 KB |
Output is correct |
77 |
Correct |
13 ms |
19924 KB |
Output is correct |
78 |
Correct |
16 ms |
20564 KB |
Output is correct |
79 |
Correct |
202 ms |
54804 KB |
Output is correct |
80 |
Correct |
324 ms |
74024 KB |
Output is correct |
81 |
Correct |
513 ms |
91248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
19028 KB |
Output is correct |
2 |
Correct |
11 ms |
19104 KB |
Output is correct |
3 |
Correct |
10 ms |
19028 KB |
Output is correct |
4 |
Correct |
10 ms |
19036 KB |
Output is correct |
5 |
Correct |
10 ms |
19100 KB |
Output is correct |
6 |
Correct |
10 ms |
19028 KB |
Output is correct |
7 |
Correct |
11 ms |
19028 KB |
Output is correct |
8 |
Correct |
13 ms |
19100 KB |
Output is correct |
9 |
Correct |
166 ms |
61164 KB |
Output is correct |
10 |
Correct |
22 ms |
23592 KB |
Output is correct |
11 |
Correct |
80 ms |
42068 KB |
Output is correct |
12 |
Correct |
30 ms |
25764 KB |
Output is correct |
13 |
Correct |
36 ms |
28308 KB |
Output is correct |
14 |
Correct |
10 ms |
19156 KB |
Output is correct |
15 |
Correct |
12 ms |
19368 KB |
Output is correct |
16 |
Correct |
178 ms |
57780 KB |
Output is correct |
17 |
Correct |
13 ms |
19036 KB |
Output is correct |
18 |
Correct |
10 ms |
19104 KB |
Output is correct |
19 |
Correct |
11 ms |
19084 KB |
Output is correct |
20 |
Correct |
463 ms |
97076 KB |
Output is correct |
21 |
Correct |
455 ms |
93880 KB |
Output is correct |
22 |
Correct |
491 ms |
92152 KB |
Output is correct |
23 |
Correct |
366 ms |
87572 KB |
Output is correct |
24 |
Correct |
234 ms |
37656 KB |
Output is correct |
25 |
Correct |
370 ms |
47056 KB |
Output is correct |
26 |
Correct |
240 ms |
46932 KB |
Output is correct |
27 |
Correct |
457 ms |
88572 KB |
Output is correct |
28 |
Correct |
467 ms |
88600 KB |
Output is correct |
29 |
Correct |
560 ms |
88584 KB |
Output is correct |
30 |
Correct |
489 ms |
88620 KB |
Output is correct |
31 |
Correct |
10 ms |
19028 KB |
Output is correct |
32 |
Correct |
35 ms |
24456 KB |
Output is correct |
33 |
Correct |
103 ms |
28328 KB |
Output is correct |
34 |
Correct |
544 ms |
94724 KB |
Output is correct |
35 |
Correct |
18 ms |
20712 KB |
Output is correct |
36 |
Correct |
55 ms |
26400 KB |
Output is correct |
37 |
Correct |
151 ms |
33276 KB |
Output is correct |
38 |
Correct |
162 ms |
45272 KB |
Output is correct |
39 |
Correct |
234 ms |
54208 KB |
Output is correct |
40 |
Correct |
330 ms |
65236 KB |
Output is correct |
41 |
Correct |
400 ms |
74136 KB |
Output is correct |
42 |
Correct |
505 ms |
83432 KB |
Output is correct |
43 |
Correct |
10 ms |
19028 KB |
Output is correct |
44 |
Correct |
11 ms |
19024 KB |
Output is correct |
45 |
Correct |
11 ms |
19104 KB |
Output is correct |
46 |
Correct |
10 ms |
19100 KB |
Output is correct |
47 |
Correct |
11 ms |
19100 KB |
Output is correct |
48 |
Correct |
10 ms |
19028 KB |
Output is correct |
49 |
Correct |
11 ms |
19104 KB |
Output is correct |
50 |
Correct |
10 ms |
19028 KB |
Output is correct |
51 |
Correct |
10 ms |
19088 KB |
Output is correct |
52 |
Correct |
11 ms |
19100 KB |
Output is correct |
53 |
Correct |
11 ms |
19028 KB |
Output is correct |
54 |
Correct |
12 ms |
19556 KB |
Output is correct |
55 |
Correct |
12 ms |
19500 KB |
Output is correct |
56 |
Correct |
207 ms |
56208 KB |
Output is correct |
57 |
Correct |
297 ms |
74424 KB |
Output is correct |
58 |
Correct |
317 ms |
73924 KB |
Output is correct |
59 |
Correct |
11 ms |
19104 KB |
Output is correct |
60 |
Correct |
10 ms |
19036 KB |
Output is correct |
61 |
Correct |
11 ms |
19088 KB |
Output is correct |
62 |
Correct |
409 ms |
99652 KB |
Output is correct |
63 |
Correct |
397 ms |
99984 KB |
Output is correct |
64 |
Correct |
416 ms |
101256 KB |
Output is correct |
65 |
Correct |
12 ms |
19796 KB |
Output is correct |
66 |
Correct |
18 ms |
20308 KB |
Output is correct |
67 |
Correct |
184 ms |
53712 KB |
Output is correct |
68 |
Correct |
327 ms |
74112 KB |
Output is correct |
69 |
Correct |
469 ms |
88824 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
19028 KB |
Output is correct |
2 |
Correct |
11 ms |
19104 KB |
Output is correct |
3 |
Correct |
10 ms |
19028 KB |
Output is correct |
4 |
Correct |
10 ms |
19036 KB |
Output is correct |
5 |
Correct |
10 ms |
19100 KB |
Output is correct |
6 |
Correct |
10 ms |
19028 KB |
Output is correct |
7 |
Correct |
11 ms |
19028 KB |
Output is correct |
8 |
Correct |
13 ms |
19100 KB |
Output is correct |
9 |
Correct |
166 ms |
61164 KB |
Output is correct |
10 |
Correct |
22 ms |
23592 KB |
Output is correct |
11 |
Correct |
80 ms |
42068 KB |
Output is correct |
12 |
Correct |
30 ms |
25764 KB |
Output is correct |
13 |
Correct |
36 ms |
28308 KB |
Output is correct |
14 |
Correct |
10 ms |
19156 KB |
Output is correct |
15 |
Correct |
12 ms |
19368 KB |
Output is correct |
16 |
Correct |
178 ms |
57780 KB |
Output is correct |
17 |
Correct |
436 ms |
104692 KB |
Output is correct |
18 |
Correct |
444 ms |
98492 KB |
Output is correct |
19 |
Correct |
526 ms |
97088 KB |
Output is correct |
20 |
Correct |
456 ms |
90084 KB |
Output is correct |
21 |
Correct |
418 ms |
84340 KB |
Output is correct |
22 |
Correct |
10 ms |
19028 KB |
Output is correct |
23 |
Correct |
66 ms |
30108 KB |
Output is correct |
24 |
Correct |
33 ms |
22444 KB |
Output is correct |
25 |
Correct |
96 ms |
29620 KB |
Output is correct |
26 |
Correct |
143 ms |
36684 KB |
Output is correct |
27 |
Correct |
225 ms |
53424 KB |
Output is correct |
28 |
Correct |
272 ms |
63064 KB |
Output is correct |
29 |
Correct |
354 ms |
71172 KB |
Output is correct |
30 |
Correct |
405 ms |
78368 KB |
Output is correct |
31 |
Correct |
546 ms |
86192 KB |
Output is correct |
32 |
Correct |
477 ms |
98140 KB |
Output is correct |
33 |
Correct |
408 ms |
104232 KB |
Output is correct |
34 |
Correct |
13 ms |
19936 KB |
Output is correct |
35 |
Correct |
19 ms |
20564 KB |
Output is correct |
36 |
Correct |
211 ms |
54656 KB |
Output is correct |
37 |
Correct |
381 ms |
73980 KB |
Output is correct |
38 |
Correct |
527 ms |
91052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
19028 KB |
Output is correct |
2 |
Correct |
11 ms |
19104 KB |
Output is correct |
3 |
Correct |
10 ms |
19028 KB |
Output is correct |
4 |
Correct |
10 ms |
19036 KB |
Output is correct |
5 |
Correct |
10 ms |
19100 KB |
Output is correct |
6 |
Correct |
10 ms |
19028 KB |
Output is correct |
7 |
Correct |
11 ms |
19028 KB |
Output is correct |
8 |
Correct |
13 ms |
19100 KB |
Output is correct |
9 |
Correct |
166 ms |
61164 KB |
Output is correct |
10 |
Correct |
22 ms |
23592 KB |
Output is correct |
11 |
Correct |
80 ms |
42068 KB |
Output is correct |
12 |
Correct |
30 ms |
25764 KB |
Output is correct |
13 |
Correct |
36 ms |
28308 KB |
Output is correct |
14 |
Correct |
10 ms |
19156 KB |
Output is correct |
15 |
Correct |
12 ms |
19368 KB |
Output is correct |
16 |
Correct |
178 ms |
57780 KB |
Output is correct |
17 |
Correct |
10 ms |
19044 KB |
Output is correct |
18 |
Correct |
11 ms |
19028 KB |
Output is correct |
19 |
Correct |
10 ms |
19104 KB |
Output is correct |
20 |
Correct |
12 ms |
19104 KB |
Output is correct |
21 |
Correct |
10 ms |
19104 KB |
Output is correct |
22 |
Correct |
10 ms |
18996 KB |
Output is correct |
23 |
Correct |
466 ms |
102828 KB |
Output is correct |
24 |
Correct |
10 ms |
19028 KB |
Output is correct |
25 |
Correct |
12 ms |
19620 KB |
Output is correct |
26 |
Correct |
13 ms |
19628 KB |
Output is correct |
27 |
Correct |
14 ms |
19752 KB |
Output is correct |
28 |
Correct |
141 ms |
52360 KB |
Output is correct |
29 |
Correct |
227 ms |
69072 KB |
Output is correct |
30 |
Correct |
345 ms |
85552 KB |
Output is correct |
31 |
Correct |
442 ms |
102932 KB |
Output is correct |
32 |
Correct |
11 ms |
19028 KB |
Output is correct |
33 |
Correct |
11 ms |
19100 KB |
Output is correct |
34 |
Correct |
10 ms |
19028 KB |
Output is correct |
35 |
Correct |
10 ms |
19100 KB |
Output is correct |
36 |
Correct |
10 ms |
19088 KB |
Output is correct |
37 |
Correct |
11 ms |
19080 KB |
Output is correct |
38 |
Correct |
13 ms |
19100 KB |
Output is correct |
39 |
Correct |
11 ms |
19152 KB |
Output is correct |
40 |
Correct |
12 ms |
19104 KB |
Output is correct |
41 |
Correct |
10 ms |
19028 KB |
Output is correct |
42 |
Correct |
11 ms |
19028 KB |
Output is correct |
43 |
Correct |
11 ms |
19368 KB |
Output is correct |
44 |
Correct |
12 ms |
19504 KB |
Output is correct |
45 |
Correct |
187 ms |
56236 KB |
Output is correct |
46 |
Correct |
297 ms |
74456 KB |
Output is correct |
47 |
Correct |
294 ms |
73916 KB |
Output is correct |
48 |
Correct |
10 ms |
19028 KB |
Output is correct |
49 |
Correct |
12 ms |
19100 KB |
Output is correct |
50 |
Correct |
10 ms |
19028 KB |
Output is correct |
51 |
Correct |
10 ms |
19028 KB |
Output is correct |
52 |
Correct |
10 ms |
19012 KB |
Output is correct |
53 |
Correct |
10 ms |
19104 KB |
Output is correct |
54 |
Correct |
10 ms |
19088 KB |
Output is correct |
55 |
Correct |
445 ms |
97756 KB |
Output is correct |
56 |
Correct |
10 ms |
19028 KB |
Output is correct |
57 |
Correct |
15 ms |
19796 KB |
Output is correct |
58 |
Correct |
18 ms |
21588 KB |
Output is correct |
59 |
Correct |
17 ms |
20776 KB |
Output is correct |
60 |
Correct |
181 ms |
60032 KB |
Output is correct |
61 |
Correct |
268 ms |
74356 KB |
Output is correct |
62 |
Correct |
338 ms |
84372 KB |
Output is correct |
63 |
Correct |
499 ms |
100048 KB |
Output is correct |
64 |
Correct |
10 ms |
19028 KB |
Output is correct |
65 |
Correct |
10 ms |
19104 KB |
Output is correct |
66 |
Correct |
10 ms |
19104 KB |
Output is correct |
67 |
Correct |
391 ms |
99744 KB |
Output is correct |
68 |
Correct |
428 ms |
99952 KB |
Output is correct |
69 |
Correct |
382 ms |
101360 KB |
Output is correct |
70 |
Correct |
14 ms |
19784 KB |
Output is correct |
71 |
Correct |
16 ms |
20400 KB |
Output is correct |
72 |
Correct |
193 ms |
53664 KB |
Output is correct |
73 |
Correct |
332 ms |
74060 KB |
Output is correct |
74 |
Correct |
469 ms |
88796 KB |
Output is correct |
75 |
Correct |
457 ms |
98308 KB |
Output is correct |
76 |
Correct |
426 ms |
104260 KB |
Output is correct |
77 |
Correct |
13 ms |
19924 KB |
Output is correct |
78 |
Correct |
16 ms |
20564 KB |
Output is correct |
79 |
Correct |
202 ms |
54804 KB |
Output is correct |
80 |
Correct |
324 ms |
74024 KB |
Output is correct |
81 |
Correct |
513 ms |
91248 KB |
Output is correct |
82 |
Correct |
13 ms |
19036 KB |
Output is correct |
83 |
Correct |
10 ms |
19104 KB |
Output is correct |
84 |
Correct |
11 ms |
19084 KB |
Output is correct |
85 |
Correct |
463 ms |
97076 KB |
Output is correct |
86 |
Correct |
455 ms |
93880 KB |
Output is correct |
87 |
Correct |
491 ms |
92152 KB |
Output is correct |
88 |
Correct |
366 ms |
87572 KB |
Output is correct |
89 |
Correct |
234 ms |
37656 KB |
Output is correct |
90 |
Correct |
370 ms |
47056 KB |
Output is correct |
91 |
Correct |
240 ms |
46932 KB |
Output is correct |
92 |
Correct |
457 ms |
88572 KB |
Output is correct |
93 |
Correct |
467 ms |
88600 KB |
Output is correct |
94 |
Correct |
560 ms |
88584 KB |
Output is correct |
95 |
Correct |
489 ms |
88620 KB |
Output is correct |
96 |
Correct |
10 ms |
19028 KB |
Output is correct |
97 |
Correct |
35 ms |
24456 KB |
Output is correct |
98 |
Correct |
103 ms |
28328 KB |
Output is correct |
99 |
Correct |
544 ms |
94724 KB |
Output is correct |
100 |
Correct |
18 ms |
20712 KB |
Output is correct |
101 |
Correct |
55 ms |
26400 KB |
Output is correct |
102 |
Correct |
151 ms |
33276 KB |
Output is correct |
103 |
Correct |
162 ms |
45272 KB |
Output is correct |
104 |
Correct |
234 ms |
54208 KB |
Output is correct |
105 |
Correct |
330 ms |
65236 KB |
Output is correct |
106 |
Correct |
400 ms |
74136 KB |
Output is correct |
107 |
Correct |
505 ms |
83432 KB |
Output is correct |
108 |
Correct |
10 ms |
19028 KB |
Output is correct |
109 |
Correct |
11 ms |
19024 KB |
Output is correct |
110 |
Correct |
11 ms |
19104 KB |
Output is correct |
111 |
Correct |
10 ms |
19100 KB |
Output is correct |
112 |
Correct |
11 ms |
19100 KB |
Output is correct |
113 |
Correct |
10 ms |
19028 KB |
Output is correct |
114 |
Correct |
11 ms |
19104 KB |
Output is correct |
115 |
Correct |
10 ms |
19028 KB |
Output is correct |
116 |
Correct |
10 ms |
19088 KB |
Output is correct |
117 |
Correct |
11 ms |
19100 KB |
Output is correct |
118 |
Correct |
11 ms |
19028 KB |
Output is correct |
119 |
Correct |
12 ms |
19556 KB |
Output is correct |
120 |
Correct |
12 ms |
19500 KB |
Output is correct |
121 |
Correct |
207 ms |
56208 KB |
Output is correct |
122 |
Correct |
297 ms |
74424 KB |
Output is correct |
123 |
Correct |
317 ms |
73924 KB |
Output is correct |
124 |
Correct |
11 ms |
19104 KB |
Output is correct |
125 |
Correct |
10 ms |
19036 KB |
Output is correct |
126 |
Correct |
11 ms |
19088 KB |
Output is correct |
127 |
Correct |
409 ms |
99652 KB |
Output is correct |
128 |
Correct |
397 ms |
99984 KB |
Output is correct |
129 |
Correct |
416 ms |
101256 KB |
Output is correct |
130 |
Correct |
12 ms |
19796 KB |
Output is correct |
131 |
Correct |
18 ms |
20308 KB |
Output is correct |
132 |
Correct |
184 ms |
53712 KB |
Output is correct |
133 |
Correct |
327 ms |
74112 KB |
Output is correct |
134 |
Correct |
469 ms |
88824 KB |
Output is correct |
135 |
Correct |
436 ms |
104692 KB |
Output is correct |
136 |
Correct |
444 ms |
98492 KB |
Output is correct |
137 |
Correct |
526 ms |
97088 KB |
Output is correct |
138 |
Correct |
456 ms |
90084 KB |
Output is correct |
139 |
Correct |
418 ms |
84340 KB |
Output is correct |
140 |
Correct |
10 ms |
19028 KB |
Output is correct |
141 |
Correct |
66 ms |
30108 KB |
Output is correct |
142 |
Correct |
33 ms |
22444 KB |
Output is correct |
143 |
Correct |
96 ms |
29620 KB |
Output is correct |
144 |
Correct |
143 ms |
36684 KB |
Output is correct |
145 |
Correct |
225 ms |
53424 KB |
Output is correct |
146 |
Correct |
272 ms |
63064 KB |
Output is correct |
147 |
Correct |
354 ms |
71172 KB |
Output is correct |
148 |
Correct |
405 ms |
78368 KB |
Output is correct |
149 |
Correct |
546 ms |
86192 KB |
Output is correct |
150 |
Correct |
477 ms |
98140 KB |
Output is correct |
151 |
Correct |
408 ms |
104232 KB |
Output is correct |
152 |
Correct |
13 ms |
19936 KB |
Output is correct |
153 |
Correct |
19 ms |
20564 KB |
Output is correct |
154 |
Correct |
211 ms |
54656 KB |
Output is correct |
155 |
Correct |
381 ms |
73980 KB |
Output is correct |
156 |
Correct |
527 ms |
91052 KB |
Output is correct |
157 |
Correct |
10 ms |
19032 KB |
Output is correct |
158 |
Correct |
8 ms |
19028 KB |
Output is correct |
159 |
Correct |
10 ms |
19020 KB |
Output is correct |
160 |
Correct |
9 ms |
19028 KB |
Output is correct |
161 |
Correct |
537 ms |
99684 KB |
Output is correct |
162 |
Correct |
590 ms |
92720 KB |
Output is correct |
163 |
Correct |
539 ms |
90888 KB |
Output is correct |
164 |
Correct |
599 ms |
90224 KB |
Output is correct |
165 |
Incorrect |
3111 ms |
83900 KB |
Solution announced impossible, but it is possible. |
166 |
Halted |
0 ms |
0 KB |
- |