#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
const int U = 1.01e5;
struct Segment{
int x, y;
bool vert;
};
struct Range{
int a, b;
};
struct Dsu{
Dsu(int n_) : p(n_, -1){}
int f(int x){
return p[x] < 0 ? x : p[x] = f(p[x]);
}
bool u(int a, int b){
a = f(a);
b = f(b);
if(a == b) return false;
p[b] = a;
return true;
}
vector<int> p;
};
// 2-sat in linear time via backtracking.
class Two_Sat {
public:
int N; // number of variables
vector<int> val; // assignment of x is at val[2x] and -x at val[2x+1]
vector<char> valid; // changes made at time i are kept iff valid[i]
vector<vector<int> > G; // graph of implications G[x][i] = y means (x -> y)
Two_Sat(int N_) : N(N_) { // create a formula over N variables (numbered 1 to N)
G.resize(2*N);
}
int add_variable() {
G.emplace_back();
G.emplace_back();
return N++;
}
private:
// converts a signed variable index to its position in val[] and G[]
int to_ind(int x) {
return 2*(abs(x)-1) + (x<0);
}
// Add a directed edge to the graph.
// You most likely do not want to call this yourself!
void add_edge(int a, int b) {
G[to_ind(a)].push_back(to_ind(b));
}
int time() {
return valid.size()-1;
}
bool dfs(int x) {
if(valid[abs(val[x])]) return val[x]>0;
val[x] = time();
val[x^1] = -time();
for(int e:G[x])
if(!dfs(e))
return false;
return true;
}
public:
// Add the or-clause: (a or b)
void add_or(int a, int b) {
add_edge(-a,b);
add_edge(-b,a);
}
// Add the implication: a -> b
void add_implication(int a, int b) {
add_or(-a, b);
}
// Add condition: x is true
void add_true(int x) {
add_or(x,x);
}
// At most one with linear number of clauses
template<typename T>
void add_at_most_one(T vars) {
if(vars.begin() == vars.end()) return;
int last = *vars.begin();
int cur = 0;
for(int const&e:vars){
if(e == last) continue;
if(cur == 0) cur = e;
else {
add_or(-cur, -e);
int new_cur = add_variable();
cur = add_implication(cur, new_cur);
add_implication(e, new_cur);
cur = new_cur;
}
}
if(cur != 0){
add_or(-cur, -last);
}
}
bool solve() {
val.assign(2*N, 0);
valid.assign(1, 0);
for(int i=0; i<(int)val.size(); i+=2) {
if(!valid[abs(val[i])]) {
valid.push_back(1);
if(!dfs(i)) {
valid.back()=0;
valid.push_back(1);
if(!dfs(i+1)) return false;
}
}
}
return true;
}
};
const int inf = 1e9;
int construct_roads(vector<int> X, vector<int> Y) {
const int n = X.size();
map<pair<int, int>, int> decode;
for(int i=0; i<n; ++i){
decode[make_pair(X[i], Y[i])] = i;
}
Dsu uni(n);
vector<array<int, 4> > to(n, {-1, -1, -1, -1});
vector<array<int, 4> > var(n, {0, 0, 0, 0});
int vars = 0;
for(int j : {1, 3, 0, 2}){
for(int i=0; i<n; ++i){
int x = X[i], y = Y[i];
if(j == 0) x+=2;
if(j == 2) x-=2;
if(j == 1) y+=2;
if(j == 3) y-=2;
if(decode.count(make_pair(x, y))){
to[i][j] = decode[make_pair(x, y)];
if(uni.u(i, to[i][j])){
assert(var[i][j] == 0);
++vars;
var[i][j] = vars;
var[to[i][j]][j^2] = vars;
}
//cerr << i << " " << X[i] << " " << Y[i] << " with " << j << " -> " << x << " " << y << " " << to[i][j] << " " << var[i][j] << "\n";
}
}
}
Two_Sat sat(vars);
auto check = [&](int a, int b){
if(a == 0 || a == inf) return;
if(b == 0 || b == inf) return;
//cerr << "or " << a << " " << b << "\n";
sat.add_or(a, b);
};
for(int i=0; i<n; ++i){
check(var[i][0], var[i][1]);
check(var[i][2], -var[i][1]);
check(-var[i][2], -var[i][3]);
check(-var[i][0], var[i][3]);
if(to[i][0] != -1){
check(var[i][1], -var[to[i][0]][1]);
}
if(to[i][1]!= -1){
check(var[i][0], -var[to[i][1]][0]);
}
}
assert(sat.solve());
vector<int> out_a, out_b, out_x, out_y;
for(int i=0; i<n; ++i){
for(int j=0; j<2; ++j) if(var[i][j] && var[i][j] != inf){
const int e = to[i][j];
out_a.push_back(i);
out_b.push_back(e);
int x = X[i];
int y = Y[i];
if(j == 0) x+=1;
if(j == 2) x-=1;
if(j == 1) y+=1;
if(j == 3) y-=1;
int add;
if(sat.val[2*var[i][j]-2]>0){
add = -1;
} else {
add = 1;
}
if(j%2 == 0) y += add;
else x += add;
out_x.push_back(x);
out_y.push_back(y);
}
}
if((int)out_x.size() == n-1){
build(out_a, out_b, out_x, out_y);
return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
225 ms |
21976 KB |
Output is correct |
10 |
Correct |
13 ms |
2508 KB |
Output is correct |
11 |
Correct |
83 ms |
12040 KB |
Output is correct |
12 |
Correct |
21 ms |
3536 KB |
Output is correct |
13 |
Correct |
52 ms |
8644 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
3 ms |
588 KB |
Output is correct |
16 |
Correct |
289 ms |
21984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
225 ms |
21976 KB |
Output is correct |
10 |
Correct |
13 ms |
2508 KB |
Output is correct |
11 |
Correct |
83 ms |
12040 KB |
Output is correct |
12 |
Correct |
21 ms |
3536 KB |
Output is correct |
13 |
Correct |
52 ms |
8644 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
3 ms |
588 KB |
Output is correct |
16 |
Correct |
289 ms |
21984 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1075 ms |
49980 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
2 ms |
588 KB |
Output is correct |
26 |
Correct |
5 ms |
972 KB |
Output is correct |
27 |
Correct |
6 ms |
1100 KB |
Output is correct |
28 |
Correct |
257 ms |
20436 KB |
Output is correct |
29 |
Correct |
442 ms |
30144 KB |
Output is correct |
30 |
Correct |
647 ms |
40084 KB |
Output is correct |
31 |
Correct |
959 ms |
49984 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
204 KB |
Output is correct |
38 |
Correct |
1 ms |
204 KB |
Output is correct |
39 |
Correct |
1 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
3 ms |
716 KB |
Output is correct |
44 |
Correct |
4 ms |
972 KB |
Output is correct |
45 |
Correct |
272 ms |
25940 KB |
Output is correct |
46 |
Correct |
480 ms |
37296 KB |
Output is correct |
47 |
Correct |
565 ms |
37300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
225 ms |
21976 KB |
Output is correct |
10 |
Correct |
13 ms |
2508 KB |
Output is correct |
11 |
Correct |
83 ms |
12040 KB |
Output is correct |
12 |
Correct |
21 ms |
3536 KB |
Output is correct |
13 |
Correct |
52 ms |
8644 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
3 ms |
588 KB |
Output is correct |
16 |
Correct |
289 ms |
21984 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1075 ms |
49980 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
2 ms |
588 KB |
Output is correct |
26 |
Correct |
5 ms |
972 KB |
Output is correct |
27 |
Correct |
6 ms |
1100 KB |
Output is correct |
28 |
Correct |
257 ms |
20436 KB |
Output is correct |
29 |
Correct |
442 ms |
30144 KB |
Output is correct |
30 |
Correct |
647 ms |
40084 KB |
Output is correct |
31 |
Correct |
959 ms |
49984 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
204 KB |
Output is correct |
38 |
Correct |
1 ms |
204 KB |
Output is correct |
39 |
Correct |
1 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
3 ms |
716 KB |
Output is correct |
44 |
Correct |
4 ms |
972 KB |
Output is correct |
45 |
Correct |
272 ms |
25940 KB |
Output is correct |
46 |
Correct |
480 ms |
37296 KB |
Output is correct |
47 |
Correct |
565 ms |
37300 KB |
Output is correct |
48 |
Correct |
1 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
1 ms |
204 KB |
Output is correct |
52 |
Correct |
1 ms |
204 KB |
Output is correct |
53 |
Correct |
1 ms |
204 KB |
Output is correct |
54 |
Correct |
1 ms |
204 KB |
Output is correct |
55 |
Correct |
924 ms |
52104 KB |
Output is correct |
56 |
Correct |
1 ms |
204 KB |
Output is correct |
57 |
Correct |
5 ms |
716 KB |
Output is correct |
58 |
Correct |
12 ms |
1868 KB |
Output is correct |
59 |
Correct |
19 ms |
2696 KB |
Output is correct |
60 |
Correct |
379 ms |
26164 KB |
Output is correct |
61 |
Correct |
586 ms |
35240 KB |
Output is correct |
62 |
Correct |
827 ms |
42920 KB |
Output is correct |
63 |
Correct |
1045 ms |
52004 KB |
Output is correct |
64 |
Correct |
1 ms |
204 KB |
Output is correct |
65 |
Correct |
1 ms |
204 KB |
Output is correct |
66 |
Correct |
1 ms |
204 KB |
Output is correct |
67 |
Correct |
701 ms |
43696 KB |
Output is correct |
68 |
Correct |
759 ms |
43648 KB |
Output is correct |
69 |
Correct |
734 ms |
43380 KB |
Output is correct |
70 |
Correct |
6 ms |
1228 KB |
Output is correct |
71 |
Correct |
14 ms |
2124 KB |
Output is correct |
72 |
Correct |
398 ms |
26232 KB |
Output is correct |
73 |
Correct |
719 ms |
39204 KB |
Output is correct |
74 |
Correct |
985 ms |
51964 KB |
Output is correct |
75 |
Correct |
893 ms |
48692 KB |
Output is correct |
76 |
Correct |
675 ms |
43692 KB |
Output is correct |
77 |
Correct |
8 ms |
1484 KB |
Output is correct |
78 |
Correct |
16 ms |
2352 KB |
Output is correct |
79 |
Correct |
327 ms |
25576 KB |
Output is correct |
80 |
Correct |
611 ms |
38304 KB |
Output is correct |
81 |
Correct |
1049 ms |
50908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
225 ms |
21976 KB |
Output is correct |
10 |
Correct |
13 ms |
2508 KB |
Output is correct |
11 |
Correct |
83 ms |
12040 KB |
Output is correct |
12 |
Correct |
21 ms |
3536 KB |
Output is correct |
13 |
Correct |
52 ms |
8644 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
3 ms |
588 KB |
Output is correct |
16 |
Correct |
289 ms |
21984 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1104 ms |
59676 KB |
Output is correct |
21 |
Correct |
1105 ms |
57132 KB |
Output is correct |
22 |
Correct |
1134 ms |
57264 KB |
Output is correct |
23 |
Correct |
700 ms |
37312 KB |
Output is correct |
24 |
Correct |
568 ms |
22976 KB |
Output is correct |
25 |
Correct |
872 ms |
37300 KB |
Output is correct |
26 |
Correct |
724 ms |
37284 KB |
Output is correct |
27 |
Correct |
796 ms |
43704 KB |
Output is correct |
28 |
Correct |
790 ms |
43700 KB |
Output is correct |
29 |
Correct |
965 ms |
43712 KB |
Output is correct |
30 |
Correct |
913 ms |
43744 KB |
Output is correct |
31 |
Correct |
1 ms |
204 KB |
Output is correct |
32 |
Correct |
34 ms |
3952 KB |
Output is correct |
33 |
Correct |
222 ms |
11532 KB |
Output is correct |
34 |
Correct |
1120 ms |
58520 KB |
Output is correct |
35 |
Correct |
18 ms |
2828 KB |
Output is correct |
36 |
Correct |
126 ms |
12132 KB |
Output is correct |
37 |
Correct |
359 ms |
23872 KB |
Output is correct |
38 |
Correct |
280 ms |
21872 KB |
Output is correct |
39 |
Correct |
440 ms |
29872 KB |
Output is correct |
40 |
Correct |
665 ms |
37776 KB |
Output is correct |
41 |
Correct |
870 ms |
45884 KB |
Output is correct |
42 |
Correct |
1095 ms |
53788 KB |
Output is correct |
43 |
Correct |
1 ms |
204 KB |
Output is correct |
44 |
Correct |
1 ms |
204 KB |
Output is correct |
45 |
Correct |
1 ms |
204 KB |
Output is correct |
46 |
Correct |
1 ms |
204 KB |
Output is correct |
47 |
Correct |
1 ms |
204 KB |
Output is correct |
48 |
Correct |
1 ms |
328 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
1 ms |
204 KB |
Output is correct |
52 |
Correct |
1 ms |
204 KB |
Output is correct |
53 |
Correct |
1 ms |
204 KB |
Output is correct |
54 |
Correct |
3 ms |
716 KB |
Output is correct |
55 |
Correct |
4 ms |
972 KB |
Output is correct |
56 |
Correct |
310 ms |
25900 KB |
Output is correct |
57 |
Correct |
568 ms |
37476 KB |
Output is correct |
58 |
Correct |
553 ms |
37436 KB |
Output is correct |
59 |
Correct |
1 ms |
204 KB |
Output is correct |
60 |
Correct |
1 ms |
280 KB |
Output is correct |
61 |
Correct |
1 ms |
204 KB |
Output is correct |
62 |
Correct |
705 ms |
43696 KB |
Output is correct |
63 |
Correct |
706 ms |
43696 KB |
Output is correct |
64 |
Correct |
681 ms |
43648 KB |
Output is correct |
65 |
Correct |
6 ms |
1228 KB |
Output is correct |
66 |
Correct |
13 ms |
2112 KB |
Output is correct |
67 |
Correct |
336 ms |
26152 KB |
Output is correct |
68 |
Correct |
644 ms |
39188 KB |
Output is correct |
69 |
Correct |
913 ms |
52132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
225 ms |
21976 KB |
Output is correct |
10 |
Correct |
13 ms |
2508 KB |
Output is correct |
11 |
Correct |
83 ms |
12040 KB |
Output is correct |
12 |
Correct |
21 ms |
3536 KB |
Output is correct |
13 |
Correct |
52 ms |
8644 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
3 ms |
588 KB |
Output is correct |
16 |
Correct |
289 ms |
21984 KB |
Output is correct |
17 |
Correct |
816 ms |
43812 KB |
Output is correct |
18 |
Correct |
815 ms |
43808 KB |
Output is correct |
19 |
Correct |
1136 ms |
56956 KB |
Output is correct |
20 |
Correct |
1070 ms |
51056 KB |
Output is correct |
21 |
Correct |
832 ms |
42176 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
81 ms |
8424 KB |
Output is correct |
24 |
Correct |
42 ms |
5112 KB |
Output is correct |
25 |
Correct |
208 ms |
16832 KB |
Output is correct |
26 |
Correct |
472 ms |
28044 KB |
Output is correct |
27 |
Correct |
408 ms |
26624 KB |
Output is correct |
28 |
Correct |
590 ms |
33144 KB |
Output is correct |
29 |
Correct |
731 ms |
39548 KB |
Output is correct |
30 |
Correct |
937 ms |
46268 KB |
Output is correct |
31 |
Correct |
1097 ms |
52712 KB |
Output is correct |
32 |
Correct |
916 ms |
48672 KB |
Output is correct |
33 |
Correct |
691 ms |
43804 KB |
Output is correct |
34 |
Correct |
8 ms |
1484 KB |
Output is correct |
35 |
Correct |
15 ms |
2352 KB |
Output is correct |
36 |
Correct |
364 ms |
25720 KB |
Output is correct |
37 |
Correct |
609 ms |
38292 KB |
Output is correct |
38 |
Correct |
945 ms |
51004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
225 ms |
21976 KB |
Output is correct |
10 |
Correct |
13 ms |
2508 KB |
Output is correct |
11 |
Correct |
83 ms |
12040 KB |
Output is correct |
12 |
Correct |
21 ms |
3536 KB |
Output is correct |
13 |
Correct |
52 ms |
8644 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
3 ms |
588 KB |
Output is correct |
16 |
Correct |
289 ms |
21984 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
1075 ms |
49980 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
2 ms |
588 KB |
Output is correct |
26 |
Correct |
5 ms |
972 KB |
Output is correct |
27 |
Correct |
6 ms |
1100 KB |
Output is correct |
28 |
Correct |
257 ms |
20436 KB |
Output is correct |
29 |
Correct |
442 ms |
30144 KB |
Output is correct |
30 |
Correct |
647 ms |
40084 KB |
Output is correct |
31 |
Correct |
959 ms |
49984 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
204 KB |
Output is correct |
38 |
Correct |
1 ms |
204 KB |
Output is correct |
39 |
Correct |
1 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
3 ms |
716 KB |
Output is correct |
44 |
Correct |
4 ms |
972 KB |
Output is correct |
45 |
Correct |
272 ms |
25940 KB |
Output is correct |
46 |
Correct |
480 ms |
37296 KB |
Output is correct |
47 |
Correct |
565 ms |
37300 KB |
Output is correct |
48 |
Correct |
1 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
1 ms |
204 KB |
Output is correct |
52 |
Correct |
1 ms |
204 KB |
Output is correct |
53 |
Correct |
1 ms |
204 KB |
Output is correct |
54 |
Correct |
1 ms |
204 KB |
Output is correct |
55 |
Correct |
924 ms |
52104 KB |
Output is correct |
56 |
Correct |
1 ms |
204 KB |
Output is correct |
57 |
Correct |
5 ms |
716 KB |
Output is correct |
58 |
Correct |
12 ms |
1868 KB |
Output is correct |
59 |
Correct |
19 ms |
2696 KB |
Output is correct |
60 |
Correct |
379 ms |
26164 KB |
Output is correct |
61 |
Correct |
586 ms |
35240 KB |
Output is correct |
62 |
Correct |
827 ms |
42920 KB |
Output is correct |
63 |
Correct |
1045 ms |
52004 KB |
Output is correct |
64 |
Correct |
1 ms |
204 KB |
Output is correct |
65 |
Correct |
1 ms |
204 KB |
Output is correct |
66 |
Correct |
1 ms |
204 KB |
Output is correct |
67 |
Correct |
701 ms |
43696 KB |
Output is correct |
68 |
Correct |
759 ms |
43648 KB |
Output is correct |
69 |
Correct |
734 ms |
43380 KB |
Output is correct |
70 |
Correct |
6 ms |
1228 KB |
Output is correct |
71 |
Correct |
14 ms |
2124 KB |
Output is correct |
72 |
Correct |
398 ms |
26232 KB |
Output is correct |
73 |
Correct |
719 ms |
39204 KB |
Output is correct |
74 |
Correct |
985 ms |
51964 KB |
Output is correct |
75 |
Correct |
893 ms |
48692 KB |
Output is correct |
76 |
Correct |
675 ms |
43692 KB |
Output is correct |
77 |
Correct |
8 ms |
1484 KB |
Output is correct |
78 |
Correct |
16 ms |
2352 KB |
Output is correct |
79 |
Correct |
327 ms |
25576 KB |
Output is correct |
80 |
Correct |
611 ms |
38304 KB |
Output is correct |
81 |
Correct |
1049 ms |
50908 KB |
Output is correct |
82 |
Correct |
1 ms |
204 KB |
Output is correct |
83 |
Correct |
1 ms |
204 KB |
Output is correct |
84 |
Correct |
1 ms |
204 KB |
Output is correct |
85 |
Correct |
1104 ms |
59676 KB |
Output is correct |
86 |
Correct |
1105 ms |
57132 KB |
Output is correct |
87 |
Correct |
1134 ms |
57264 KB |
Output is correct |
88 |
Correct |
700 ms |
37312 KB |
Output is correct |
89 |
Correct |
568 ms |
22976 KB |
Output is correct |
90 |
Correct |
872 ms |
37300 KB |
Output is correct |
91 |
Correct |
724 ms |
37284 KB |
Output is correct |
92 |
Correct |
796 ms |
43704 KB |
Output is correct |
93 |
Correct |
790 ms |
43700 KB |
Output is correct |
94 |
Correct |
965 ms |
43712 KB |
Output is correct |
95 |
Correct |
913 ms |
43744 KB |
Output is correct |
96 |
Correct |
1 ms |
204 KB |
Output is correct |
97 |
Correct |
34 ms |
3952 KB |
Output is correct |
98 |
Correct |
222 ms |
11532 KB |
Output is correct |
99 |
Correct |
1120 ms |
58520 KB |
Output is correct |
100 |
Correct |
18 ms |
2828 KB |
Output is correct |
101 |
Correct |
126 ms |
12132 KB |
Output is correct |
102 |
Correct |
359 ms |
23872 KB |
Output is correct |
103 |
Correct |
280 ms |
21872 KB |
Output is correct |
104 |
Correct |
440 ms |
29872 KB |
Output is correct |
105 |
Correct |
665 ms |
37776 KB |
Output is correct |
106 |
Correct |
870 ms |
45884 KB |
Output is correct |
107 |
Correct |
1095 ms |
53788 KB |
Output is correct |
108 |
Correct |
1 ms |
204 KB |
Output is correct |
109 |
Correct |
1 ms |
204 KB |
Output is correct |
110 |
Correct |
1 ms |
204 KB |
Output is correct |
111 |
Correct |
1 ms |
204 KB |
Output is correct |
112 |
Correct |
1 ms |
204 KB |
Output is correct |
113 |
Correct |
1 ms |
328 KB |
Output is correct |
114 |
Correct |
1 ms |
204 KB |
Output is correct |
115 |
Correct |
1 ms |
204 KB |
Output is correct |
116 |
Correct |
1 ms |
204 KB |
Output is correct |
117 |
Correct |
1 ms |
204 KB |
Output is correct |
118 |
Correct |
1 ms |
204 KB |
Output is correct |
119 |
Correct |
3 ms |
716 KB |
Output is correct |
120 |
Correct |
4 ms |
972 KB |
Output is correct |
121 |
Correct |
310 ms |
25900 KB |
Output is correct |
122 |
Correct |
568 ms |
37476 KB |
Output is correct |
123 |
Correct |
553 ms |
37436 KB |
Output is correct |
124 |
Correct |
1 ms |
204 KB |
Output is correct |
125 |
Correct |
1 ms |
280 KB |
Output is correct |
126 |
Correct |
1 ms |
204 KB |
Output is correct |
127 |
Correct |
705 ms |
43696 KB |
Output is correct |
128 |
Correct |
706 ms |
43696 KB |
Output is correct |
129 |
Correct |
681 ms |
43648 KB |
Output is correct |
130 |
Correct |
6 ms |
1228 KB |
Output is correct |
131 |
Correct |
13 ms |
2112 KB |
Output is correct |
132 |
Correct |
336 ms |
26152 KB |
Output is correct |
133 |
Correct |
644 ms |
39188 KB |
Output is correct |
134 |
Correct |
913 ms |
52132 KB |
Output is correct |
135 |
Correct |
816 ms |
43812 KB |
Output is correct |
136 |
Correct |
815 ms |
43808 KB |
Output is correct |
137 |
Correct |
1136 ms |
56956 KB |
Output is correct |
138 |
Correct |
1070 ms |
51056 KB |
Output is correct |
139 |
Correct |
832 ms |
42176 KB |
Output is correct |
140 |
Correct |
1 ms |
204 KB |
Output is correct |
141 |
Correct |
81 ms |
8424 KB |
Output is correct |
142 |
Correct |
42 ms |
5112 KB |
Output is correct |
143 |
Correct |
208 ms |
16832 KB |
Output is correct |
144 |
Correct |
472 ms |
28044 KB |
Output is correct |
145 |
Correct |
408 ms |
26624 KB |
Output is correct |
146 |
Correct |
590 ms |
33144 KB |
Output is correct |
147 |
Correct |
731 ms |
39548 KB |
Output is correct |
148 |
Correct |
937 ms |
46268 KB |
Output is correct |
149 |
Correct |
1097 ms |
52712 KB |
Output is correct |
150 |
Correct |
916 ms |
48672 KB |
Output is correct |
151 |
Correct |
691 ms |
43804 KB |
Output is correct |
152 |
Correct |
8 ms |
1484 KB |
Output is correct |
153 |
Correct |
15 ms |
2352 KB |
Output is correct |
154 |
Correct |
364 ms |
25720 KB |
Output is correct |
155 |
Correct |
609 ms |
38292 KB |
Output is correct |
156 |
Correct |
945 ms |
51004 KB |
Output is correct |
157 |
Correct |
1 ms |
204 KB |
Output is correct |
158 |
Correct |
1 ms |
204 KB |
Output is correct |
159 |
Correct |
1 ms |
204 KB |
Output is correct |
160 |
Correct |
1 ms |
204 KB |
Output is correct |
161 |
Runtime error |
1012 ms |
94092 KB |
Execution killed with signal 6 |
162 |
Halted |
0 ms |
0 KB |
- |