#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define ar array
#define pb push_back
#define ln '\n'
//#define int long long
using i64 = long long;
template <class F, class _S>
bool chmin(F &u, const _S &v){
bool flag = false;
if ( u > v ){
u = v; flag |= true;
}
return flag;
}
template <class F, class _S>
bool chmax(F &u, const _S &v){
bool flag = false;
if ( u < v ){
u = v; flag |= true;
}
return flag;
}
struct Dsu{
vector <int> fa;
int n;
Dsu(int n) : n(n) {
fa.resize(n);
iota(all(fa), 0);
}
int get(int u){
return u ^ fa[u] ? fa[u] = get(fa[u]) : u;
}
bool merge(int u, int v){
u = get(u), v = get(v);
if ( u == v ) return false;
fa[v] = u;
return true;
}
};
int dx[] = {2, -2, 0, 0};
int dy[] = {0, 0, -2, 2};
int construct_roads(std::vector<int> x, std::vector<int> y) {
int n = x.size();
map <int,map<int,int>> id;
for ( int i = 0; i < n; i++ ){
id[x[i]][y[i]] = i;
}
vector <ar<int,2>> e;
//~ Dsu ds(n);
map <ar<int,2>,int> mp;
vector <vector<int>> G(n);
for ( int i = 0; i < n; i++ ){
for ( int j = 0; j < 4; j++ ){
int u = x[i] + dx[j], v = y[i] + dy[j];
if ( !id[u].count(v) ) continue;
G[id[u][v]].pb(i);
G[i].pb(id[u][v]);
}
}
vector <int> vis(n);
queue <int> q;
q.push(0);
vis[0] = 1;
while ( !q.empty() ){
int u = q.front();
q.pop();
for ( auto &v: G[u] ){
if ( vis[v] ) continue;
vis[v] = 1;
q.push(v);
e.pb({u, v});
mp[{v, u}] = mp[{u, v}] = (int)e.size() - 1;
}
}
if ( (int)e.size() != n - 1 ){
return 0;
}
//~ for ( int i = 0; i + 1 < n; i++ ){
//~ cout << e[i][0] << ' ' << e[i][1] << " " << i << ln;
//~ } cout << ln;
vector <vector<int>> adj(n * 2), rev(n * 2);
auto add = [&](int u, int v){
//~ cout << u << " " << v << ln;
adj[u].pb(v);
rev[v].pb(u);
};
for ( int i = 0; i < n - 1; i++ ){
auto [u, v] = e[i];
if ( x[u] == x[v] ){ // vertical
if ( y[u] > y[v] ) swap(u, v);
{ // 0
int a = -1, b = -1;
if ( id[x[u] + 2].count(y[u]) ){
int j = id[x[u] + 2][y[u]]; a = j;
if ( mp.count({u, j}) ){
int k = mp[{u, j}];
add(i, k);
}
}
if ( id[x[u] + 2].count(y[v]) ){
int j = id[x[u] + 2][y[v]]; b = j;
if ( mp.count({j, v}) ){
int k = mp[{j, v}];
add(i, k + n);
}
}
if ( mp.count({a, b}) ){
add(i, mp[{a, b}]);
}
}
{ // 1
int a = -1, b = -1;
if ( id[x[u] - 2].count(y[u]) ){
int j = id[x[u] - 2][y[u]]; a = j;
if ( mp.count({u, j}) ){
int k = mp[{u, j}];
add(i + n, k);
}
}
if ( id[x[u] - 2].count(y[v]) ){
int j = id[x[u] - 2][y[v]]; b = j;
if ( mp.count({j, v}) ){
int k = mp[{j, v}];
add(i + n, k + n);
}
}
if ( mp.count({a, b}) ){
add(i + n, mp[{a, b}] + n);
}
}
} else{ // horizontal
if ( x[u] > x[v] ) swap(u, v);
{ // 0
int a = -1, b = -1;
if ( id[x[u]].count(y[u] - 2) ){
int j = id[x[u]][y[u] - 2]; a = j;
if ( mp.count({u, j}) ){
int k = mp[{u, j}];
add(i, k + n);
}
}
if ( id[x[v]].count(y[v] - 2) ){
int j = id[x[v]][y[v] - 2]; b = j;
if ( mp.count({j, v}) ){
int k = mp[{j, v}];
add(i, k);
}
}
if ( mp.count({a, b}) ){
add(i, mp[{a, b}]);
}
}
{ // 1
int a = -1, b = -1;
if ( id[x[u]].count(y[u] + 2) ){
int j = id[x[u]][y[u] + 2]; a = j;
if ( mp.count({u, j}) ){
int k = mp[{u, j}];
add(i + n, k + n);
}
}
if ( id[x[v]].count(y[v] + 2) ){
int j = id[x[v]][y[v] + 2]; b = j;
if ( mp.count({j, v}) ){
int k = mp[{j, v}];
add(i + n, k);
}
}
if ( mp.count({a, b}) ){
add(i + n, mp[{a, b}] + n);
}
}
}
}
vector <int> ord, us(n * 2);
auto dfs = [&](auto dfs, int u) -> void{
if ( us[u] ) return;
us[u] = true;
for ( auto &v: adj[u] ){
dfs(dfs, v);
}
ord.pb(u);
};
for ( int i = 0; i < n * 2; i++ ){
dfs(dfs, i);
}
reverse(all(ord));
vector <int> c(n * 2, -1);
int ct = 0;
auto trav = [&](auto trav, int u) -> void{
if ( c[u] != -1 ) return;
c[u] = ct;
for ( auto &v: rev[u] ){
trav(trav, v);
}
};
for ( auto &u: ord ){
if ( c[u] != -1 ) continue;
trav(trav, u);
ct++;
}
vector <int> t(n - 1);
for ( int i = 0; i + 1 < n; i++ ){
if ( c[i] == c[i + n] ){
return 0;
}
t[i] = (c[i] < c[i + n]);
}
vector <int> U, V, A, B;
set <pair<int,int>> st;
for ( int i = 0; i + 1 < n; i++ ){
auto [u, v] = e[i];
U.pb(u), V.pb(v);
if ( x[u] == x[v] ){
if ( y[u] > y[v] ) swap(u, v);
A.pb(x[u] + (t[i] ? -1 : 1));
B.pb(y[u] + 1);
} else{
if ( x[u] > x[v] ) swap(u, v);
A.pb(x[u] + 1);
B.pb(y[u] + (t[i] ? 1 : -1));
}
assert(!st.count({A.back(), B.back()}));
st.insert({A.back(), B.back()});
}
build(U, V, A, B);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
432 KB |
Output is correct |
9 |
Correct |
262 ms |
48308 KB |
Output is correct |
10 |
Correct |
21 ms |
5120 KB |
Output is correct |
11 |
Correct |
85 ms |
26180 KB |
Output is correct |
12 |
Correct |
21 ms |
7504 KB |
Output is correct |
13 |
Correct |
42 ms |
9936 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
704 KB |
Output is correct |
16 |
Correct |
268 ms |
48176 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
432 KB |
Output is correct |
9 |
Correct |
262 ms |
48308 KB |
Output is correct |
10 |
Correct |
21 ms |
5120 KB |
Output is correct |
11 |
Correct |
85 ms |
26180 KB |
Output is correct |
12 |
Correct |
21 ms |
7504 KB |
Output is correct |
13 |
Correct |
42 ms |
9936 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
704 KB |
Output is correct |
16 |
Correct |
268 ms |
48176 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1085 ms |
112428 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
5 ms |
1116 KB |
Output is correct |
26 |
Correct |
4 ms |
1080 KB |
Output is correct |
27 |
Correct |
5 ms |
940 KB |
Output is correct |
28 |
Correct |
330 ms |
45388 KB |
Output is correct |
29 |
Correct |
576 ms |
67672 KB |
Output is correct |
30 |
Correct |
812 ms |
90240 KB |
Output is correct |
31 |
Correct |
1037 ms |
112740 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
436 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
2 ms |
604 KB |
Output is correct |
44 |
Correct |
3 ms |
740 KB |
Output is correct |
45 |
Correct |
401 ms |
56340 KB |
Output is correct |
46 |
Correct |
674 ms |
82200 KB |
Output is correct |
47 |
Correct |
651 ms |
81756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
432 KB |
Output is correct |
9 |
Correct |
262 ms |
48308 KB |
Output is correct |
10 |
Correct |
21 ms |
5120 KB |
Output is correct |
11 |
Correct |
85 ms |
26180 KB |
Output is correct |
12 |
Correct |
21 ms |
7504 KB |
Output is correct |
13 |
Correct |
42 ms |
9936 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
704 KB |
Output is correct |
16 |
Correct |
268 ms |
48176 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1085 ms |
112428 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
5 ms |
1116 KB |
Output is correct |
26 |
Correct |
4 ms |
1080 KB |
Output is correct |
27 |
Correct |
5 ms |
940 KB |
Output is correct |
28 |
Correct |
330 ms |
45388 KB |
Output is correct |
29 |
Correct |
576 ms |
67672 KB |
Output is correct |
30 |
Correct |
812 ms |
90240 KB |
Output is correct |
31 |
Correct |
1037 ms |
112740 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
436 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
2 ms |
604 KB |
Output is correct |
44 |
Correct |
3 ms |
740 KB |
Output is correct |
45 |
Correct |
401 ms |
56340 KB |
Output is correct |
46 |
Correct |
674 ms |
82200 KB |
Output is correct |
47 |
Correct |
651 ms |
81756 KB |
Output is correct |
48 |
Correct |
1 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
1134 ms |
116532 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
5 ms |
1264 KB |
Output is correct |
58 |
Correct |
20 ms |
3780 KB |
Output is correct |
59 |
Correct |
14 ms |
2140 KB |
Output is correct |
60 |
Correct |
471 ms |
58356 KB |
Output is correct |
61 |
Correct |
735 ms |
80240 KB |
Output is correct |
62 |
Correct |
994 ms |
96496 KB |
Output is correct |
63 |
Correct |
1145 ms |
116804 KB |
Output is correct |
64 |
Correct |
0 ms |
344 KB |
Output is correct |
65 |
Correct |
0 ms |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
643 ms |
96064 KB |
Output is correct |
68 |
Correct |
693 ms |
96060 KB |
Output is correct |
69 |
Correct |
660 ms |
95664 KB |
Output is correct |
70 |
Correct |
5 ms |
1112 KB |
Output is correct |
71 |
Correct |
10 ms |
1628 KB |
Output is correct |
72 |
Correct |
466 ms |
56908 KB |
Output is correct |
73 |
Correct |
833 ms |
85908 KB |
Output is correct |
74 |
Correct |
1145 ms |
113728 KB |
Output is correct |
75 |
Correct |
1129 ms |
107576 KB |
Output is correct |
76 |
Correct |
687 ms |
96040 KB |
Output is correct |
77 |
Correct |
6 ms |
1372 KB |
Output is correct |
78 |
Correct |
15 ms |
2140 KB |
Output is correct |
79 |
Correct |
431 ms |
55832 KB |
Output is correct |
80 |
Correct |
703 ms |
84292 KB |
Output is correct |
81 |
Correct |
982 ms |
111680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
432 KB |
Output is correct |
9 |
Correct |
262 ms |
48308 KB |
Output is correct |
10 |
Correct |
21 ms |
5120 KB |
Output is correct |
11 |
Correct |
85 ms |
26180 KB |
Output is correct |
12 |
Correct |
21 ms |
7504 KB |
Output is correct |
13 |
Correct |
42 ms |
9936 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
704 KB |
Output is correct |
16 |
Correct |
268 ms |
48176 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
388 KB |
Output is correct |
20 |
Correct |
1109 ms |
138624 KB |
Output is correct |
21 |
Correct |
1061 ms |
130116 KB |
Output is correct |
22 |
Correct |
1094 ms |
130112 KB |
Output is correct |
23 |
Correct |
607 ms |
86924 KB |
Output is correct |
24 |
Correct |
166 ms |
20048 KB |
Output is correct |
25 |
Correct |
377 ms |
26228 KB |
Output is correct |
26 |
Correct |
301 ms |
26192 KB |
Output is correct |
27 |
Correct |
714 ms |
96316 KB |
Output is correct |
28 |
Correct |
730 ms |
96324 KB |
Output is correct |
29 |
Correct |
921 ms |
96320 KB |
Output is correct |
30 |
Correct |
939 ms |
96284 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
46 ms |
8608 KB |
Output is correct |
33 |
Correct |
118 ms |
19996 KB |
Output is correct |
34 |
Correct |
1182 ms |
137400 KB |
Output is correct |
35 |
Correct |
14 ms |
2396 KB |
Output is correct |
36 |
Correct |
83 ms |
8720 KB |
Output is correct |
37 |
Correct |
177 ms |
15708 KB |
Output is correct |
38 |
Correct |
433 ms |
47744 KB |
Output is correct |
39 |
Correct |
632 ms |
65092 KB |
Output is correct |
40 |
Correct |
849 ms |
83780 KB |
Output is correct |
41 |
Correct |
1106 ms |
100760 KB |
Output is correct |
42 |
Correct |
1324 ms |
118352 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
436 KB |
Output is correct |
45 |
Correct |
0 ms |
344 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
348 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
0 ms |
344 KB |
Output is correct |
53 |
Correct |
1 ms |
344 KB |
Output is correct |
54 |
Correct |
3 ms |
600 KB |
Output is correct |
55 |
Correct |
3 ms |
704 KB |
Output is correct |
56 |
Correct |
405 ms |
56296 KB |
Output is correct |
57 |
Correct |
592 ms |
82240 KB |
Output is correct |
58 |
Correct |
665 ms |
82324 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
0 ms |
348 KB |
Output is correct |
61 |
Correct |
0 ms |
348 KB |
Output is correct |
62 |
Correct |
609 ms |
96048 KB |
Output is correct |
63 |
Correct |
610 ms |
96152 KB |
Output is correct |
64 |
Correct |
566 ms |
95628 KB |
Output is correct |
65 |
Correct |
5 ms |
1112 KB |
Output is correct |
66 |
Correct |
9 ms |
1624 KB |
Output is correct |
67 |
Correct |
429 ms |
57136 KB |
Output is correct |
68 |
Correct |
666 ms |
86076 KB |
Output is correct |
69 |
Correct |
1070 ms |
113572 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
432 KB |
Output is correct |
9 |
Correct |
262 ms |
48308 KB |
Output is correct |
10 |
Correct |
21 ms |
5120 KB |
Output is correct |
11 |
Correct |
85 ms |
26180 KB |
Output is correct |
12 |
Correct |
21 ms |
7504 KB |
Output is correct |
13 |
Correct |
42 ms |
9936 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
704 KB |
Output is correct |
16 |
Correct |
268 ms |
48176 KB |
Output is correct |
17 |
Correct |
731 ms |
101184 KB |
Output is correct |
18 |
Correct |
715 ms |
101444 KB |
Output is correct |
19 |
Correct |
1109 ms |
130264 KB |
Output is correct |
20 |
Correct |
1301 ms |
111680 KB |
Output is correct |
21 |
Correct |
947 ms |
89840 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
126 ms |
18192 KB |
Output is correct |
24 |
Correct |
33 ms |
4432 KB |
Output is correct |
25 |
Correct |
119 ms |
12116 KB |
Output is correct |
26 |
Correct |
229 ms |
19156 KB |
Output is correct |
27 |
Correct |
569 ms |
58432 KB |
Output is correct |
28 |
Correct |
760 ms |
73032 KB |
Output is correct |
29 |
Correct |
1036 ms |
88384 KB |
Output is correct |
30 |
Correct |
1168 ms |
101904 KB |
Output is correct |
31 |
Correct |
1387 ms |
116428 KB |
Output is correct |
32 |
Correct |
963 ms |
107584 KB |
Output is correct |
33 |
Correct |
614 ms |
96060 KB |
Output is correct |
34 |
Correct |
7 ms |
1368 KB |
Output is correct |
35 |
Correct |
12 ms |
2140 KB |
Output is correct |
36 |
Correct |
451 ms |
56380 KB |
Output is correct |
37 |
Correct |
701 ms |
84136 KB |
Output is correct |
38 |
Correct |
1079 ms |
111492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
432 KB |
Output is correct |
9 |
Correct |
262 ms |
48308 KB |
Output is correct |
10 |
Correct |
21 ms |
5120 KB |
Output is correct |
11 |
Correct |
85 ms |
26180 KB |
Output is correct |
12 |
Correct |
21 ms |
7504 KB |
Output is correct |
13 |
Correct |
42 ms |
9936 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
704 KB |
Output is correct |
16 |
Correct |
268 ms |
48176 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1085 ms |
112428 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
5 ms |
1116 KB |
Output is correct |
26 |
Correct |
4 ms |
1080 KB |
Output is correct |
27 |
Correct |
5 ms |
940 KB |
Output is correct |
28 |
Correct |
330 ms |
45388 KB |
Output is correct |
29 |
Correct |
576 ms |
67672 KB |
Output is correct |
30 |
Correct |
812 ms |
90240 KB |
Output is correct |
31 |
Correct |
1037 ms |
112740 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
436 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
2 ms |
604 KB |
Output is correct |
44 |
Correct |
3 ms |
740 KB |
Output is correct |
45 |
Correct |
401 ms |
56340 KB |
Output is correct |
46 |
Correct |
674 ms |
82200 KB |
Output is correct |
47 |
Correct |
651 ms |
81756 KB |
Output is correct |
48 |
Correct |
1 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
1134 ms |
116532 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
5 ms |
1264 KB |
Output is correct |
58 |
Correct |
20 ms |
3780 KB |
Output is correct |
59 |
Correct |
14 ms |
2140 KB |
Output is correct |
60 |
Correct |
471 ms |
58356 KB |
Output is correct |
61 |
Correct |
735 ms |
80240 KB |
Output is correct |
62 |
Correct |
994 ms |
96496 KB |
Output is correct |
63 |
Correct |
1145 ms |
116804 KB |
Output is correct |
64 |
Correct |
0 ms |
344 KB |
Output is correct |
65 |
Correct |
0 ms |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
643 ms |
96064 KB |
Output is correct |
68 |
Correct |
693 ms |
96060 KB |
Output is correct |
69 |
Correct |
660 ms |
95664 KB |
Output is correct |
70 |
Correct |
5 ms |
1112 KB |
Output is correct |
71 |
Correct |
10 ms |
1628 KB |
Output is correct |
72 |
Correct |
466 ms |
56908 KB |
Output is correct |
73 |
Correct |
833 ms |
85908 KB |
Output is correct |
74 |
Correct |
1145 ms |
113728 KB |
Output is correct |
75 |
Correct |
1129 ms |
107576 KB |
Output is correct |
76 |
Correct |
687 ms |
96040 KB |
Output is correct |
77 |
Correct |
6 ms |
1372 KB |
Output is correct |
78 |
Correct |
15 ms |
2140 KB |
Output is correct |
79 |
Correct |
431 ms |
55832 KB |
Output is correct |
80 |
Correct |
703 ms |
84292 KB |
Output is correct |
81 |
Correct |
982 ms |
111680 KB |
Output is correct |
82 |
Correct |
0 ms |
348 KB |
Output is correct |
83 |
Correct |
0 ms |
348 KB |
Output is correct |
84 |
Correct |
0 ms |
388 KB |
Output is correct |
85 |
Correct |
1109 ms |
138624 KB |
Output is correct |
86 |
Correct |
1061 ms |
130116 KB |
Output is correct |
87 |
Correct |
1094 ms |
130112 KB |
Output is correct |
88 |
Correct |
607 ms |
86924 KB |
Output is correct |
89 |
Correct |
166 ms |
20048 KB |
Output is correct |
90 |
Correct |
377 ms |
26228 KB |
Output is correct |
91 |
Correct |
301 ms |
26192 KB |
Output is correct |
92 |
Correct |
714 ms |
96316 KB |
Output is correct |
93 |
Correct |
730 ms |
96324 KB |
Output is correct |
94 |
Correct |
921 ms |
96320 KB |
Output is correct |
95 |
Correct |
939 ms |
96284 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
46 ms |
8608 KB |
Output is correct |
98 |
Correct |
118 ms |
19996 KB |
Output is correct |
99 |
Correct |
1182 ms |
137400 KB |
Output is correct |
100 |
Correct |
14 ms |
2396 KB |
Output is correct |
101 |
Correct |
83 ms |
8720 KB |
Output is correct |
102 |
Correct |
177 ms |
15708 KB |
Output is correct |
103 |
Correct |
433 ms |
47744 KB |
Output is correct |
104 |
Correct |
632 ms |
65092 KB |
Output is correct |
105 |
Correct |
849 ms |
83780 KB |
Output is correct |
106 |
Correct |
1106 ms |
100760 KB |
Output is correct |
107 |
Correct |
1324 ms |
118352 KB |
Output is correct |
108 |
Correct |
0 ms |
348 KB |
Output is correct |
109 |
Correct |
0 ms |
436 KB |
Output is correct |
110 |
Correct |
0 ms |
344 KB |
Output is correct |
111 |
Correct |
0 ms |
348 KB |
Output is correct |
112 |
Correct |
0 ms |
348 KB |
Output is correct |
113 |
Correct |
0 ms |
348 KB |
Output is correct |
114 |
Correct |
1 ms |
348 KB |
Output is correct |
115 |
Correct |
0 ms |
348 KB |
Output is correct |
116 |
Correct |
0 ms |
348 KB |
Output is correct |
117 |
Correct |
0 ms |
344 KB |
Output is correct |
118 |
Correct |
1 ms |
344 KB |
Output is correct |
119 |
Correct |
3 ms |
600 KB |
Output is correct |
120 |
Correct |
3 ms |
704 KB |
Output is correct |
121 |
Correct |
405 ms |
56296 KB |
Output is correct |
122 |
Correct |
592 ms |
82240 KB |
Output is correct |
123 |
Correct |
665 ms |
82324 KB |
Output is correct |
124 |
Correct |
0 ms |
348 KB |
Output is correct |
125 |
Correct |
0 ms |
348 KB |
Output is correct |
126 |
Correct |
0 ms |
348 KB |
Output is correct |
127 |
Correct |
609 ms |
96048 KB |
Output is correct |
128 |
Correct |
610 ms |
96152 KB |
Output is correct |
129 |
Correct |
566 ms |
95628 KB |
Output is correct |
130 |
Correct |
5 ms |
1112 KB |
Output is correct |
131 |
Correct |
9 ms |
1624 KB |
Output is correct |
132 |
Correct |
429 ms |
57136 KB |
Output is correct |
133 |
Correct |
666 ms |
86076 KB |
Output is correct |
134 |
Correct |
1070 ms |
113572 KB |
Output is correct |
135 |
Correct |
731 ms |
101184 KB |
Output is correct |
136 |
Correct |
715 ms |
101444 KB |
Output is correct |
137 |
Correct |
1109 ms |
130264 KB |
Output is correct |
138 |
Correct |
1301 ms |
111680 KB |
Output is correct |
139 |
Correct |
947 ms |
89840 KB |
Output is correct |
140 |
Correct |
0 ms |
348 KB |
Output is correct |
141 |
Correct |
126 ms |
18192 KB |
Output is correct |
142 |
Correct |
33 ms |
4432 KB |
Output is correct |
143 |
Correct |
119 ms |
12116 KB |
Output is correct |
144 |
Correct |
229 ms |
19156 KB |
Output is correct |
145 |
Correct |
569 ms |
58432 KB |
Output is correct |
146 |
Correct |
760 ms |
73032 KB |
Output is correct |
147 |
Correct |
1036 ms |
88384 KB |
Output is correct |
148 |
Correct |
1168 ms |
101904 KB |
Output is correct |
149 |
Correct |
1387 ms |
116428 KB |
Output is correct |
150 |
Correct |
963 ms |
107584 KB |
Output is correct |
151 |
Correct |
614 ms |
96060 KB |
Output is correct |
152 |
Correct |
7 ms |
1368 KB |
Output is correct |
153 |
Correct |
12 ms |
2140 KB |
Output is correct |
154 |
Correct |
451 ms |
56380 KB |
Output is correct |
155 |
Correct |
701 ms |
84136 KB |
Output is correct |
156 |
Correct |
1079 ms |
111492 KB |
Output is correct |
157 |
Correct |
0 ms |
344 KB |
Output is correct |
158 |
Correct |
0 ms |
348 KB |
Output is correct |
159 |
Correct |
0 ms |
348 KB |
Output is correct |
160 |
Correct |
0 ms |
348 KB |
Output is correct |
161 |
Incorrect |
1661 ms |
110064 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |