#include "parks.h"
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=int(b); a<int(c); ++a)
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#pragma once
bool dfs(int a, int L, vector<vi>& g, vi& btoa, vi& A, vi& B) {
if (A[a] != L) return 0;
A[a] = -1;
for (int b : g[a]) if (B[b] == L + 1) {
B[b] = 0;
if (btoa[b] == -1 || dfs(btoa[b], L + 1, g, btoa, A, B))
return btoa[b] = a, 1;
}
return 0;
}
int hopcroftKarp(vector<vi>& g, vi& btoa) {
int res = 0;
vi A(g.size()), B(btoa.size()), cur, next;
for (;;) {
fill(all(A), 0);
fill(all(B), 0);
/// Find the starting nodes for BFS (i.e. layer 0).
cur.clear();
for (int a : btoa) if(a != -1) A[a] = -1;
rep(a,0,sz(g)) if(A[a] == 0) cur.push_back(a);
/// Find all layers using bfs.
for (int lay = 1;; lay++) {
bool islast = 0;
next.clear();
for (int a : cur) for (int b : g[a]) {
if (btoa[b] == -1) {
B[b] = lay;
islast = 1;
}
else if (btoa[b] != a && !B[b]) {
B[b] = lay;
next.push_back(btoa[b]);
}
}
if (islast) break;
if (next.empty()) return res;
for (int a : next) A[a] = lay;
cur.swap(next);
}
/// Use DFS to scan for augmenting paths.
rep(a,0,sz(g))
res += dfs(a, 0, g, btoa, A, B);
}
}
/*int faster_matching(vector<vi>& g, vi& btoa) {
vector<vi> g2(btoa.size());
rep(i,0,g.size()) {
rep(j,0,g[i].size()) {
g2[g[i][j]].push_back(i);
}
}
vector<int> deg_one;
rep(i,0,g.size()) {
if(g[i].size()==1) {
deg_one.push_back(i);
}
}
int current = 0;
while(true)
rep(i,0,deg_one.size()) {
current = i;
}
}*/
vector<int> parent;
vector<int> s;
int find(int x) {
if(x==parent[x]) return x;
else return parent[x]=find(parent[x]);
}
void makeset(int x) {
parent[x]=x;
}
bool sameset(int x, int y) {
return find(x)==find(y);
}
void join(int x, int y) {
int xroot = find(x);
int yroot = find(y);
if(s[xroot]>s[yroot]) {
parent[yroot]=xroot;
s[xroot] += s[yroot];
} else {
parent[xroot]=yroot;
s[yroot] += s[xroot];
}
}
int construct_roads(vector<int> x, vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
int n = x.size();
int M = 2*1e5+1;
vector<vector<pair<int,int>>> x_fountains(M);
vector<vector<pair<int,int>>> y_fountains(M);
// first is the coordinate
// second is the index.
rep(i,0,n) {
x_fountains[x[i]].emplace_back(y[i],i);
y_fountains[y[i]].emplace_back(x[i],i);
}
rep(i,0,M) {
sort(x_fountains[i].begin(), x_fountains[i].end());
sort(y_fountains[i].begin(), y_fountains[i].end());
}
vector<int> u, v, a, b;
parent.clear();
parent.resize(n);
s.resize(n);
rep(i,0,n) makeset(i);
rep(i,0,M) {
rep(j,1,x_fountains[i].size()) {
int ind1 = x_fountains[i][j-1].second;
int y1 = x_fountains[i][j-1].first;
int ind2 = x_fountains[i][j].second;
int y2 = x_fountains[i][j].first;
if(y2-y1!=2) continue;
if(sameset(ind1,ind2)) continue;
join(ind1,ind2);
u.push_back(ind1);
v.push_back(ind2);
}
}
rep(i,0,M) {
rep(j,1,y_fountains[i].size()) {
int ind1 = y_fountains[i][j-1].second;
int x1 = y_fountains[i][j-1].first;
int ind2 = y_fountains[i][j].second;
int x2 = y_fountains[i][j].first;
if(x2-x1!=2) continue;
if(sameset(ind1,ind2)) continue;
join(ind1,ind2);
u.push_back(ind1);
v.push_back(ind2);
}
}
int num_roads = u.size();
if(num_roads!=n-1) return 0;
map<pair<int,int>, int> potential_benches;
vector<pair<int,int>> potential_benches2;
vector<vector<int>> graph(num_roads);
rep(i,0,num_roads) {
int f1 = u[i];
int f2 = v[i];
vector<pair<int,int>> temp;
if(x[f1]==x[f2]) {
int mid = (y[f1]+y[f2])/2;
temp.emplace_back(x[f1]-1, mid);
temp.emplace_back(x[f1]+1, mid);
} else {
assert(y[f1]==y[f2]);
int mid = (x[f1]+x[f2])/2;
temp.emplace_back(mid, y[f1]-1);
temp.emplace_back(mid, y[f1]+1);
}
rep(j,0,temp.size()) {
if (!potential_benches.count(temp[j])) {
potential_benches[temp[j]]=potential_benches.size();
potential_benches2.emplace_back(temp[j]);
}
graph[i].push_back(potential_benches[temp[j]]);
}
}
vector<int> btoa(potential_benches.size(),-1);
if(hopcroftKarp(graph, btoa)!=num_roads) return 0;
a.resize(num_roads);
b.resize(num_roads);
rep(i,0,potential_benches2.size()) {
if(btoa[i] != -1) {
a[btoa[i]] = potential_benches2[i].first;
b[btoa[i]] = potential_benches2[i].second;
}
}
build(u, v, a, b);
return 1;
}
Compilation message
parks.cpp:11:9: warning: #pragma once in main file
11 | #pragma once
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
10 ms |
9676 KB |
Output is correct |
3 |
Correct |
10 ms |
9676 KB |
Output is correct |
4 |
Correct |
10 ms |
9676 KB |
Output is correct |
5 |
Correct |
10 ms |
9676 KB |
Output is correct |
6 |
Correct |
11 ms |
9700 KB |
Output is correct |
7 |
Correct |
10 ms |
9676 KB |
Output is correct |
8 |
Correct |
8 ms |
9676 KB |
Output is correct |
9 |
Correct |
258 ms |
41020 KB |
Output is correct |
10 |
Correct |
29 ms |
12736 KB |
Output is correct |
11 |
Correct |
121 ms |
26476 KB |
Output is correct |
12 |
Correct |
44 ms |
14356 KB |
Output is correct |
13 |
Correct |
25 ms |
13048 KB |
Output is correct |
14 |
Correct |
9 ms |
9668 KB |
Output is correct |
15 |
Correct |
11 ms |
9804 KB |
Output is correct |
16 |
Correct |
265 ms |
41016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
10 ms |
9676 KB |
Output is correct |
3 |
Correct |
10 ms |
9676 KB |
Output is correct |
4 |
Correct |
10 ms |
9676 KB |
Output is correct |
5 |
Correct |
10 ms |
9676 KB |
Output is correct |
6 |
Correct |
11 ms |
9700 KB |
Output is correct |
7 |
Correct |
10 ms |
9676 KB |
Output is correct |
8 |
Correct |
8 ms |
9676 KB |
Output is correct |
9 |
Correct |
258 ms |
41020 KB |
Output is correct |
10 |
Correct |
29 ms |
12736 KB |
Output is correct |
11 |
Correct |
121 ms |
26476 KB |
Output is correct |
12 |
Correct |
44 ms |
14356 KB |
Output is correct |
13 |
Correct |
25 ms |
13048 KB |
Output is correct |
14 |
Correct |
9 ms |
9668 KB |
Output is correct |
15 |
Correct |
11 ms |
9804 KB |
Output is correct |
16 |
Correct |
265 ms |
41016 KB |
Output is correct |
17 |
Correct |
9 ms |
9676 KB |
Output is correct |
18 |
Correct |
10 ms |
9696 KB |
Output is correct |
19 |
Correct |
11 ms |
9676 KB |
Output is correct |
20 |
Correct |
10 ms |
9676 KB |
Output is correct |
21 |
Correct |
9 ms |
9676 KB |
Output is correct |
22 |
Correct |
9 ms |
9676 KB |
Output is correct |
23 |
Correct |
502 ms |
62800 KB |
Output is correct |
24 |
Correct |
11 ms |
9700 KB |
Output is correct |
25 |
Correct |
11 ms |
10008 KB |
Output is correct |
26 |
Correct |
10 ms |
9824 KB |
Output is correct |
27 |
Correct |
11 ms |
9932 KB |
Output is correct |
28 |
Correct |
188 ms |
31092 KB |
Output is correct |
29 |
Correct |
285 ms |
41572 KB |
Output is correct |
30 |
Correct |
415 ms |
52104 KB |
Output is correct |
31 |
Correct |
492 ms |
62748 KB |
Output is correct |
32 |
Correct |
10 ms |
9676 KB |
Output is correct |
33 |
Correct |
8 ms |
9676 KB |
Output is correct |
34 |
Correct |
9 ms |
9692 KB |
Output is correct |
35 |
Correct |
11 ms |
9592 KB |
Output is correct |
36 |
Correct |
9 ms |
9676 KB |
Output is correct |
37 |
Correct |
10 ms |
9676 KB |
Output is correct |
38 |
Correct |
9 ms |
9700 KB |
Output is correct |
39 |
Correct |
11 ms |
9692 KB |
Output is correct |
40 |
Correct |
10 ms |
9676 KB |
Output is correct |
41 |
Correct |
9 ms |
9676 KB |
Output is correct |
42 |
Correct |
12 ms |
9676 KB |
Output is correct |
43 |
Correct |
11 ms |
9804 KB |
Output is correct |
44 |
Correct |
13 ms |
9904 KB |
Output is correct |
45 |
Correct |
264 ms |
35448 KB |
Output is correct |
46 |
Correct |
384 ms |
46924 KB |
Output is correct |
47 |
Correct |
340 ms |
47000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
10 ms |
9676 KB |
Output is correct |
3 |
Correct |
10 ms |
9676 KB |
Output is correct |
4 |
Correct |
10 ms |
9676 KB |
Output is correct |
5 |
Correct |
10 ms |
9676 KB |
Output is correct |
6 |
Correct |
11 ms |
9700 KB |
Output is correct |
7 |
Correct |
10 ms |
9676 KB |
Output is correct |
8 |
Correct |
8 ms |
9676 KB |
Output is correct |
9 |
Correct |
258 ms |
41020 KB |
Output is correct |
10 |
Correct |
29 ms |
12736 KB |
Output is correct |
11 |
Correct |
121 ms |
26476 KB |
Output is correct |
12 |
Correct |
44 ms |
14356 KB |
Output is correct |
13 |
Correct |
25 ms |
13048 KB |
Output is correct |
14 |
Correct |
9 ms |
9668 KB |
Output is correct |
15 |
Correct |
11 ms |
9804 KB |
Output is correct |
16 |
Correct |
265 ms |
41016 KB |
Output is correct |
17 |
Correct |
9 ms |
9676 KB |
Output is correct |
18 |
Correct |
10 ms |
9696 KB |
Output is correct |
19 |
Correct |
11 ms |
9676 KB |
Output is correct |
20 |
Correct |
10 ms |
9676 KB |
Output is correct |
21 |
Correct |
9 ms |
9676 KB |
Output is correct |
22 |
Correct |
9 ms |
9676 KB |
Output is correct |
23 |
Correct |
502 ms |
62800 KB |
Output is correct |
24 |
Correct |
11 ms |
9700 KB |
Output is correct |
25 |
Correct |
11 ms |
10008 KB |
Output is correct |
26 |
Correct |
10 ms |
9824 KB |
Output is correct |
27 |
Correct |
11 ms |
9932 KB |
Output is correct |
28 |
Correct |
188 ms |
31092 KB |
Output is correct |
29 |
Correct |
285 ms |
41572 KB |
Output is correct |
30 |
Correct |
415 ms |
52104 KB |
Output is correct |
31 |
Correct |
492 ms |
62748 KB |
Output is correct |
32 |
Correct |
10 ms |
9676 KB |
Output is correct |
33 |
Correct |
8 ms |
9676 KB |
Output is correct |
34 |
Correct |
9 ms |
9692 KB |
Output is correct |
35 |
Correct |
11 ms |
9592 KB |
Output is correct |
36 |
Correct |
9 ms |
9676 KB |
Output is correct |
37 |
Correct |
10 ms |
9676 KB |
Output is correct |
38 |
Correct |
9 ms |
9700 KB |
Output is correct |
39 |
Correct |
11 ms |
9692 KB |
Output is correct |
40 |
Correct |
10 ms |
9676 KB |
Output is correct |
41 |
Correct |
9 ms |
9676 KB |
Output is correct |
42 |
Correct |
12 ms |
9676 KB |
Output is correct |
43 |
Correct |
11 ms |
9804 KB |
Output is correct |
44 |
Correct |
13 ms |
9904 KB |
Output is correct |
45 |
Correct |
264 ms |
35448 KB |
Output is correct |
46 |
Correct |
384 ms |
46924 KB |
Output is correct |
47 |
Correct |
340 ms |
47000 KB |
Output is correct |
48 |
Correct |
10 ms |
9676 KB |
Output is correct |
49 |
Correct |
9 ms |
9692 KB |
Output is correct |
50 |
Correct |
8 ms |
9676 KB |
Output is correct |
51 |
Correct |
9 ms |
9676 KB |
Output is correct |
52 |
Correct |
10 ms |
9676 KB |
Output is correct |
53 |
Correct |
9 ms |
9692 KB |
Output is correct |
54 |
Correct |
8 ms |
9676 KB |
Output is correct |
55 |
Correct |
564 ms |
60480 KB |
Output is correct |
56 |
Correct |
10 ms |
9676 KB |
Output is correct |
57 |
Correct |
15 ms |
10060 KB |
Output is correct |
58 |
Correct |
20 ms |
11212 KB |
Output is correct |
59 |
Correct |
18 ms |
10316 KB |
Output is correct |
60 |
Correct |
224 ms |
35108 KB |
Output is correct |
61 |
Correct |
368 ms |
43924 KB |
Output is correct |
62 |
Correct |
410 ms |
51596 KB |
Output is correct |
63 |
Correct |
481 ms |
60536 KB |
Output is correct |
64 |
Correct |
9 ms |
9676 KB |
Output is correct |
65 |
Correct |
8 ms |
9676 KB |
Output is correct |
66 |
Correct |
9 ms |
9700 KB |
Output is correct |
67 |
Correct |
573 ms |
69304 KB |
Output is correct |
68 |
Correct |
585 ms |
70312 KB |
Output is correct |
69 |
Correct |
557 ms |
69476 KB |
Output is correct |
70 |
Correct |
10 ms |
9932 KB |
Output is correct |
71 |
Correct |
12 ms |
10208 KB |
Output is correct |
72 |
Correct |
258 ms |
34728 KB |
Output is correct |
73 |
Correct |
390 ms |
47228 KB |
Output is correct |
74 |
Correct |
531 ms |
59712 KB |
Output is correct |
75 |
Correct |
531 ms |
64620 KB |
Output is correct |
76 |
Correct |
631 ms |
70232 KB |
Output is correct |
77 |
Correct |
11 ms |
9932 KB |
Output is correct |
78 |
Correct |
13 ms |
10316 KB |
Output is correct |
79 |
Correct |
243 ms |
35512 KB |
Output is correct |
80 |
Correct |
373 ms |
48304 KB |
Output is correct |
81 |
Correct |
542 ms |
61160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
10 ms |
9676 KB |
Output is correct |
3 |
Correct |
10 ms |
9676 KB |
Output is correct |
4 |
Correct |
10 ms |
9676 KB |
Output is correct |
5 |
Correct |
10 ms |
9676 KB |
Output is correct |
6 |
Correct |
11 ms |
9700 KB |
Output is correct |
7 |
Correct |
10 ms |
9676 KB |
Output is correct |
8 |
Correct |
8 ms |
9676 KB |
Output is correct |
9 |
Correct |
258 ms |
41020 KB |
Output is correct |
10 |
Correct |
29 ms |
12736 KB |
Output is correct |
11 |
Correct |
121 ms |
26476 KB |
Output is correct |
12 |
Correct |
44 ms |
14356 KB |
Output is correct |
13 |
Correct |
25 ms |
13048 KB |
Output is correct |
14 |
Correct |
9 ms |
9668 KB |
Output is correct |
15 |
Correct |
11 ms |
9804 KB |
Output is correct |
16 |
Correct |
265 ms |
41016 KB |
Output is correct |
17 |
Correct |
8 ms |
9676 KB |
Output is correct |
18 |
Correct |
10 ms |
9676 KB |
Output is correct |
19 |
Correct |
8 ms |
9676 KB |
Output is correct |
20 |
Correct |
486 ms |
55944 KB |
Output is correct |
21 |
Correct |
459 ms |
54688 KB |
Output is correct |
22 |
Correct |
511 ms |
54572 KB |
Output is correct |
23 |
Correct |
438 ms |
61260 KB |
Output is correct |
24 |
Correct |
81 ms |
18372 KB |
Output is correct |
25 |
Correct |
103 ms |
20276 KB |
Output is correct |
26 |
Correct |
86 ms |
20060 KB |
Output is correct |
27 |
Correct |
410 ms |
68040 KB |
Output is correct |
28 |
Correct |
405 ms |
67992 KB |
Output is correct |
29 |
Correct |
486 ms |
68080 KB |
Output is correct |
30 |
Correct |
461 ms |
68004 KB |
Output is correct |
31 |
Correct |
9 ms |
9676 KB |
Output is correct |
32 |
Correct |
38 ms |
13096 KB |
Output is correct |
33 |
Correct |
111 ms |
18244 KB |
Output is correct |
34 |
Correct |
557 ms |
55952 KB |
Output is correct |
35 |
Correct |
14 ms |
10316 KB |
Output is correct |
36 |
Correct |
37 ms |
12864 KB |
Output is correct |
37 |
Correct |
57 ms |
15708 KB |
Output is correct |
38 |
Correct |
211 ms |
28388 KB |
Output is correct |
39 |
Correct |
288 ms |
35824 KB |
Output is correct |
40 |
Correct |
405 ms |
43144 KB |
Output is correct |
41 |
Correct |
503 ms |
50068 KB |
Output is correct |
42 |
Correct |
547 ms |
56984 KB |
Output is correct |
43 |
Correct |
9 ms |
9676 KB |
Output is correct |
44 |
Correct |
10 ms |
9696 KB |
Output is correct |
45 |
Correct |
11 ms |
9688 KB |
Output is correct |
46 |
Correct |
10 ms |
9676 KB |
Output is correct |
47 |
Correct |
10 ms |
9676 KB |
Output is correct |
48 |
Correct |
9 ms |
9676 KB |
Output is correct |
49 |
Correct |
11 ms |
9696 KB |
Output is correct |
50 |
Correct |
10 ms |
9676 KB |
Output is correct |
51 |
Correct |
10 ms |
9676 KB |
Output is correct |
52 |
Correct |
10 ms |
9688 KB |
Output is correct |
53 |
Correct |
9 ms |
9676 KB |
Output is correct |
54 |
Correct |
10 ms |
9776 KB |
Output is correct |
55 |
Correct |
11 ms |
9896 KB |
Output is correct |
56 |
Correct |
245 ms |
35492 KB |
Output is correct |
57 |
Correct |
389 ms |
47004 KB |
Output is correct |
58 |
Correct |
391 ms |
46980 KB |
Output is correct |
59 |
Correct |
10 ms |
9692 KB |
Output is correct |
60 |
Correct |
10 ms |
9696 KB |
Output is correct |
61 |
Correct |
9 ms |
9804 KB |
Output is correct |
62 |
Correct |
634 ms |
69252 KB |
Output is correct |
63 |
Correct |
553 ms |
70252 KB |
Output is correct |
64 |
Correct |
590 ms |
69408 KB |
Output is correct |
65 |
Correct |
11 ms |
9932 KB |
Output is correct |
66 |
Correct |
13 ms |
10136 KB |
Output is correct |
67 |
Correct |
280 ms |
34836 KB |
Output is correct |
68 |
Correct |
374 ms |
47196 KB |
Output is correct |
69 |
Correct |
597 ms |
59716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
10 ms |
9676 KB |
Output is correct |
3 |
Correct |
10 ms |
9676 KB |
Output is correct |
4 |
Correct |
10 ms |
9676 KB |
Output is correct |
5 |
Correct |
10 ms |
9676 KB |
Output is correct |
6 |
Correct |
11 ms |
9700 KB |
Output is correct |
7 |
Correct |
10 ms |
9676 KB |
Output is correct |
8 |
Correct |
8 ms |
9676 KB |
Output is correct |
9 |
Correct |
258 ms |
41020 KB |
Output is correct |
10 |
Correct |
29 ms |
12736 KB |
Output is correct |
11 |
Correct |
121 ms |
26476 KB |
Output is correct |
12 |
Correct |
44 ms |
14356 KB |
Output is correct |
13 |
Correct |
25 ms |
13048 KB |
Output is correct |
14 |
Correct |
9 ms |
9668 KB |
Output is correct |
15 |
Correct |
11 ms |
9804 KB |
Output is correct |
16 |
Correct |
265 ms |
41016 KB |
Output is correct |
17 |
Correct |
562 ms |
69800 KB |
Output is correct |
18 |
Correct |
561 ms |
69696 KB |
Output is correct |
19 |
Correct |
502 ms |
59372 KB |
Output is correct |
20 |
Correct |
387 ms |
56792 KB |
Output is correct |
21 |
Correct |
435 ms |
59348 KB |
Output is correct |
22 |
Correct |
10 ms |
9676 KB |
Output is correct |
23 |
Correct |
73 ms |
17304 KB |
Output is correct |
24 |
Correct |
17 ms |
10940 KB |
Output is correct |
25 |
Correct |
55 ms |
14144 KB |
Output is correct |
26 |
Correct |
89 ms |
16744 KB |
Output is correct |
27 |
Correct |
262 ms |
34204 KB |
Output is correct |
28 |
Correct |
358 ms |
40448 KB |
Output is correct |
29 |
Correct |
366 ms |
46432 KB |
Output is correct |
30 |
Correct |
451 ms |
52424 KB |
Output is correct |
31 |
Correct |
524 ms |
58316 KB |
Output is correct |
32 |
Correct |
539 ms |
64704 KB |
Output is correct |
33 |
Correct |
614 ms |
70232 KB |
Output is correct |
34 |
Correct |
12 ms |
9932 KB |
Output is correct |
35 |
Correct |
14 ms |
10328 KB |
Output is correct |
36 |
Correct |
251 ms |
35452 KB |
Output is correct |
37 |
Correct |
397 ms |
48348 KB |
Output is correct |
38 |
Correct |
520 ms |
61252 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
10 ms |
9676 KB |
Output is correct |
3 |
Correct |
10 ms |
9676 KB |
Output is correct |
4 |
Correct |
10 ms |
9676 KB |
Output is correct |
5 |
Correct |
10 ms |
9676 KB |
Output is correct |
6 |
Correct |
11 ms |
9700 KB |
Output is correct |
7 |
Correct |
10 ms |
9676 KB |
Output is correct |
8 |
Correct |
8 ms |
9676 KB |
Output is correct |
9 |
Correct |
258 ms |
41020 KB |
Output is correct |
10 |
Correct |
29 ms |
12736 KB |
Output is correct |
11 |
Correct |
121 ms |
26476 KB |
Output is correct |
12 |
Correct |
44 ms |
14356 KB |
Output is correct |
13 |
Correct |
25 ms |
13048 KB |
Output is correct |
14 |
Correct |
9 ms |
9668 KB |
Output is correct |
15 |
Correct |
11 ms |
9804 KB |
Output is correct |
16 |
Correct |
265 ms |
41016 KB |
Output is correct |
17 |
Correct |
9 ms |
9676 KB |
Output is correct |
18 |
Correct |
10 ms |
9696 KB |
Output is correct |
19 |
Correct |
11 ms |
9676 KB |
Output is correct |
20 |
Correct |
10 ms |
9676 KB |
Output is correct |
21 |
Correct |
9 ms |
9676 KB |
Output is correct |
22 |
Correct |
9 ms |
9676 KB |
Output is correct |
23 |
Correct |
502 ms |
62800 KB |
Output is correct |
24 |
Correct |
11 ms |
9700 KB |
Output is correct |
25 |
Correct |
11 ms |
10008 KB |
Output is correct |
26 |
Correct |
10 ms |
9824 KB |
Output is correct |
27 |
Correct |
11 ms |
9932 KB |
Output is correct |
28 |
Correct |
188 ms |
31092 KB |
Output is correct |
29 |
Correct |
285 ms |
41572 KB |
Output is correct |
30 |
Correct |
415 ms |
52104 KB |
Output is correct |
31 |
Correct |
492 ms |
62748 KB |
Output is correct |
32 |
Correct |
10 ms |
9676 KB |
Output is correct |
33 |
Correct |
8 ms |
9676 KB |
Output is correct |
34 |
Correct |
9 ms |
9692 KB |
Output is correct |
35 |
Correct |
11 ms |
9592 KB |
Output is correct |
36 |
Correct |
9 ms |
9676 KB |
Output is correct |
37 |
Correct |
10 ms |
9676 KB |
Output is correct |
38 |
Correct |
9 ms |
9700 KB |
Output is correct |
39 |
Correct |
11 ms |
9692 KB |
Output is correct |
40 |
Correct |
10 ms |
9676 KB |
Output is correct |
41 |
Correct |
9 ms |
9676 KB |
Output is correct |
42 |
Correct |
12 ms |
9676 KB |
Output is correct |
43 |
Correct |
11 ms |
9804 KB |
Output is correct |
44 |
Correct |
13 ms |
9904 KB |
Output is correct |
45 |
Correct |
264 ms |
35448 KB |
Output is correct |
46 |
Correct |
384 ms |
46924 KB |
Output is correct |
47 |
Correct |
340 ms |
47000 KB |
Output is correct |
48 |
Correct |
10 ms |
9676 KB |
Output is correct |
49 |
Correct |
9 ms |
9692 KB |
Output is correct |
50 |
Correct |
8 ms |
9676 KB |
Output is correct |
51 |
Correct |
9 ms |
9676 KB |
Output is correct |
52 |
Correct |
10 ms |
9676 KB |
Output is correct |
53 |
Correct |
9 ms |
9692 KB |
Output is correct |
54 |
Correct |
8 ms |
9676 KB |
Output is correct |
55 |
Correct |
564 ms |
60480 KB |
Output is correct |
56 |
Correct |
10 ms |
9676 KB |
Output is correct |
57 |
Correct |
15 ms |
10060 KB |
Output is correct |
58 |
Correct |
20 ms |
11212 KB |
Output is correct |
59 |
Correct |
18 ms |
10316 KB |
Output is correct |
60 |
Correct |
224 ms |
35108 KB |
Output is correct |
61 |
Correct |
368 ms |
43924 KB |
Output is correct |
62 |
Correct |
410 ms |
51596 KB |
Output is correct |
63 |
Correct |
481 ms |
60536 KB |
Output is correct |
64 |
Correct |
9 ms |
9676 KB |
Output is correct |
65 |
Correct |
8 ms |
9676 KB |
Output is correct |
66 |
Correct |
9 ms |
9700 KB |
Output is correct |
67 |
Correct |
573 ms |
69304 KB |
Output is correct |
68 |
Correct |
585 ms |
70312 KB |
Output is correct |
69 |
Correct |
557 ms |
69476 KB |
Output is correct |
70 |
Correct |
10 ms |
9932 KB |
Output is correct |
71 |
Correct |
12 ms |
10208 KB |
Output is correct |
72 |
Correct |
258 ms |
34728 KB |
Output is correct |
73 |
Correct |
390 ms |
47228 KB |
Output is correct |
74 |
Correct |
531 ms |
59712 KB |
Output is correct |
75 |
Correct |
531 ms |
64620 KB |
Output is correct |
76 |
Correct |
631 ms |
70232 KB |
Output is correct |
77 |
Correct |
11 ms |
9932 KB |
Output is correct |
78 |
Correct |
13 ms |
10316 KB |
Output is correct |
79 |
Correct |
243 ms |
35512 KB |
Output is correct |
80 |
Correct |
373 ms |
48304 KB |
Output is correct |
81 |
Correct |
542 ms |
61160 KB |
Output is correct |
82 |
Correct |
8 ms |
9676 KB |
Output is correct |
83 |
Correct |
10 ms |
9676 KB |
Output is correct |
84 |
Correct |
8 ms |
9676 KB |
Output is correct |
85 |
Correct |
486 ms |
55944 KB |
Output is correct |
86 |
Correct |
459 ms |
54688 KB |
Output is correct |
87 |
Correct |
511 ms |
54572 KB |
Output is correct |
88 |
Correct |
438 ms |
61260 KB |
Output is correct |
89 |
Correct |
81 ms |
18372 KB |
Output is correct |
90 |
Correct |
103 ms |
20276 KB |
Output is correct |
91 |
Correct |
86 ms |
20060 KB |
Output is correct |
92 |
Correct |
410 ms |
68040 KB |
Output is correct |
93 |
Correct |
405 ms |
67992 KB |
Output is correct |
94 |
Correct |
486 ms |
68080 KB |
Output is correct |
95 |
Correct |
461 ms |
68004 KB |
Output is correct |
96 |
Correct |
9 ms |
9676 KB |
Output is correct |
97 |
Correct |
38 ms |
13096 KB |
Output is correct |
98 |
Correct |
111 ms |
18244 KB |
Output is correct |
99 |
Correct |
557 ms |
55952 KB |
Output is correct |
100 |
Correct |
14 ms |
10316 KB |
Output is correct |
101 |
Correct |
37 ms |
12864 KB |
Output is correct |
102 |
Correct |
57 ms |
15708 KB |
Output is correct |
103 |
Correct |
211 ms |
28388 KB |
Output is correct |
104 |
Correct |
288 ms |
35824 KB |
Output is correct |
105 |
Correct |
405 ms |
43144 KB |
Output is correct |
106 |
Correct |
503 ms |
50068 KB |
Output is correct |
107 |
Correct |
547 ms |
56984 KB |
Output is correct |
108 |
Correct |
9 ms |
9676 KB |
Output is correct |
109 |
Correct |
10 ms |
9696 KB |
Output is correct |
110 |
Correct |
11 ms |
9688 KB |
Output is correct |
111 |
Correct |
10 ms |
9676 KB |
Output is correct |
112 |
Correct |
10 ms |
9676 KB |
Output is correct |
113 |
Correct |
9 ms |
9676 KB |
Output is correct |
114 |
Correct |
11 ms |
9696 KB |
Output is correct |
115 |
Correct |
10 ms |
9676 KB |
Output is correct |
116 |
Correct |
10 ms |
9676 KB |
Output is correct |
117 |
Correct |
10 ms |
9688 KB |
Output is correct |
118 |
Correct |
9 ms |
9676 KB |
Output is correct |
119 |
Correct |
10 ms |
9776 KB |
Output is correct |
120 |
Correct |
11 ms |
9896 KB |
Output is correct |
121 |
Correct |
245 ms |
35492 KB |
Output is correct |
122 |
Correct |
389 ms |
47004 KB |
Output is correct |
123 |
Correct |
391 ms |
46980 KB |
Output is correct |
124 |
Correct |
10 ms |
9692 KB |
Output is correct |
125 |
Correct |
10 ms |
9696 KB |
Output is correct |
126 |
Correct |
9 ms |
9804 KB |
Output is correct |
127 |
Correct |
634 ms |
69252 KB |
Output is correct |
128 |
Correct |
553 ms |
70252 KB |
Output is correct |
129 |
Correct |
590 ms |
69408 KB |
Output is correct |
130 |
Correct |
11 ms |
9932 KB |
Output is correct |
131 |
Correct |
13 ms |
10136 KB |
Output is correct |
132 |
Correct |
280 ms |
34836 KB |
Output is correct |
133 |
Correct |
374 ms |
47196 KB |
Output is correct |
134 |
Correct |
597 ms |
59716 KB |
Output is correct |
135 |
Correct |
562 ms |
69800 KB |
Output is correct |
136 |
Correct |
561 ms |
69696 KB |
Output is correct |
137 |
Correct |
502 ms |
59372 KB |
Output is correct |
138 |
Correct |
387 ms |
56792 KB |
Output is correct |
139 |
Correct |
435 ms |
59348 KB |
Output is correct |
140 |
Correct |
10 ms |
9676 KB |
Output is correct |
141 |
Correct |
73 ms |
17304 KB |
Output is correct |
142 |
Correct |
17 ms |
10940 KB |
Output is correct |
143 |
Correct |
55 ms |
14144 KB |
Output is correct |
144 |
Correct |
89 ms |
16744 KB |
Output is correct |
145 |
Correct |
262 ms |
34204 KB |
Output is correct |
146 |
Correct |
358 ms |
40448 KB |
Output is correct |
147 |
Correct |
366 ms |
46432 KB |
Output is correct |
148 |
Correct |
451 ms |
52424 KB |
Output is correct |
149 |
Correct |
524 ms |
58316 KB |
Output is correct |
150 |
Correct |
539 ms |
64704 KB |
Output is correct |
151 |
Correct |
614 ms |
70232 KB |
Output is correct |
152 |
Correct |
12 ms |
9932 KB |
Output is correct |
153 |
Correct |
14 ms |
10328 KB |
Output is correct |
154 |
Correct |
251 ms |
35452 KB |
Output is correct |
155 |
Correct |
397 ms |
48348 KB |
Output is correct |
156 |
Correct |
520 ms |
61252 KB |
Output is correct |
157 |
Correct |
9 ms |
9692 KB |
Output is correct |
158 |
Correct |
12 ms |
9632 KB |
Output is correct |
159 |
Correct |
9 ms |
9676 KB |
Output is correct |
160 |
Correct |
9 ms |
9696 KB |
Output is correct |
161 |
Correct |
424 ms |
53364 KB |
Output is correct |
162 |
Correct |
504 ms |
55836 KB |
Output is correct |
163 |
Correct |
534 ms |
56356 KB |
Output is correct |
164 |
Correct |
603 ms |
56296 KB |
Output is correct |
165 |
Correct |
437 ms |
56076 KB |
Output is correct |
166 |
Correct |
432 ms |
55884 KB |
Output is correct |
167 |
Incorrect |
123 ms |
19260 KB |
Solution announced impossible, but it is possible. |
168 |
Halted |
0 ms |
0 KB |
- |