#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
struct dsu{
ll n;
vector<ll> p;
dsu(ll N):n(N),p(N,-1){}
ll g(ll i){
return p[i]<0?i:p[i]=g(p[i]);
}
bool m(ll a, ll b){
a = g(a);
b = g(b);
if(a==b) return false;
if(p[a]>p[b]) swap(a,b);
p[a]+=p[b];
p[b]=a;
return true;
}
};
struct obj{
ll x,y,i;
bool operator<(const obj &o) const{
return x!=o.x?x<o.x:y<o.y;
}
obj operator+(const obj &o) const{
return {x+o.x,y+o.y,i};
}
obj operator-(const obj &o) const{
return {x-o.x,y-o.y,i};
}
bool operator==(const obj &o) const{
return x==o.x&&y==o.y;
}
bool operator!=(const obj &o) const{
return x!=o.x||y!=o.y;
}
obj turn() const{
return {y,-x,i};
}
};
using pos = obj;
struct pr{
ll i,c;
bool operator<(const pr &o) const{
return c>o.c;
}
};
struct ppr{
pos a,b;
ll w;
bool operator<(const ppr &o) const{
return w>o.w;
}
};
ostream& operator<<(ostream& o, const pos &p){
return o << "(" << p.x << "," << p.y << ";" << p.i << ")";
}
pos mid(const pos &a, const pos &b){
return {(a.x+b.x)/2,(a.y+b.y)/2,0};
}
array<pos,2> mids(const pos &a, const pos &b){
pos m = mid(a,b);
array<pos,2> r = {m+(a-m).turn(),m+(b-m).turn()};
////cerr << "mids of " << a << " " << b << " -> " << r[0] << " " << r[1] << "\n";
return r;
}
int construct_roads(std::vector<int> x, std::vector<int> y) {
mt19937_64 mt(random_device{}());
ll n = x.size();
vector<obj> fs = {{0,2,0},{0,-2,0},{2,0,0},{-2,0,0}};
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
ll t0 = time(0);
while(time(0)<t0+3){
vector<ll> ans_u,ans_v,ans_a,ans_b;
vector<obj> a(n);
for(ll i = 0;i<n;i++){
a[i] = {x[i],y[i],i};
}
//shuffle(ord.begin(),ord.end(),mt);
sort(a.begin(),a.end());
dsu d(n);
vector<pair<pos,pos>> cons;
vector<pair<pos,pos>> ord;
for(pos u : a){
for(pos f : fs){
pos v = u+f;
auto it = lower_bound(a.begin(),a.end(),v);
if (it==a.end()||*it!=v) continue;
v = *it;
ord.push_back({u,v});
}
}
shuffle(ord.begin(),ord.end(),mt);
vector<ll> h(n,0);
{
priority_queue<ppr> q;
for(auto [u,v] : ord) q.push({u,v,0});
while(!q.empty()){
auto [u,v,c] = q.top();q.pop();
if (h[u.i]+h[v.i]>c) continue;
if(d.m(u.i,v.i)){
h[u.i]++;
h[v.i]++;
//cerr << "con " << u << " " << v << "\n";
cons.push_back({u,v});
{
pos p1 = u;
for(pos f : fs){
pos p2 = p1+f;
auto it = lower_bound(a.begin(),a.end(),p2);
if (it==a.end()||*it!=p2) continue;
p2 = *it;
q.push({p1,p2,h[p1.i]+h[p2.i]});
}
}
{
pos p1 = v;
for(pos f : fs){
pos p2 = p1+f;
auto it = lower_bound(a.begin(),a.end(),p2);
if (it==a.end()||*it!=p2) continue;
p2 = *it;
q.push({p1,p2,h[p1.i]+h[p2.i]});
}
}
}
}
}
if(cons.size()<n-1) return 0;
vector<pos> v;
for(auto [p0,p1] : cons){
for(pos p : mids(p0,p1)) v.push_back(p);
}
sort(v.begin(),v.end());
v.erase(unique(v.begin(),v.end()),v.end());
ll m = v.size();
vector<pair<pos,pos>> ops;
vector<vector<ll>> con(m);
vector<ll> u(n-1,0);
for(auto [p0,p1] : cons){
auto o = mids(p0,p1);
ll i = lower_bound(v.begin(),v.end(),o[0])-v.begin();
ll j = lower_bound(v.begin(),v.end(),o[1])-v.begin();
pair<pos,pos> op = {min(o[0],o[1]),max(o[0],o[1])};
//cerr << "ops " << op.first << " " << op.second << "\n";
ops.push_back(op);
con[i].push_back(j);
con[j].push_back(i);
}
sort(ops.begin(),ops.end());
vector<ll> um(m,0);
//shuffle(idl.begin(),idl.end(),mt);
priority_queue<pr> q;
for(ll i = 0;i<m;i++) q.push({i,con[i].size()});
while(!q.empty()){
auto [i,_] = q.top();q.pop();
if (um[i]) continue;
shuffle(con[i].begin(),con[i].end(),mt);
for(ll j : con[i]){
pair<pos,pos> op = {min(v[i],v[j]),max(v[i],v[j])};
//cerr << "test " << op.first << " " << op.second << "\n";
auto it = lower_bound(ops.begin(),ops.end(),op);
if (it==ops.end()) {
//cerr << "error 1\n";
continue;
}
//cerr << "got " << (*it).first << " " << (*it).second << "\n";
if ((*it)!=op) {
//cerr << "error 2\n";
continue;
}
ll idx = it-ops.begin();
//cerr << "idx= " << idx << "\n";
if(u[idx]) {
//cerr << "error 3\n";
continue;
}
u[idx] = 1;
um[i] = 1;
for(ll z = 0;z<con[j].size();z++) if(con[j][z]==i){
con[j].erase(con[j].begin()+z);
break;
}
q.push({j,con[j].size()});
pos p = v[i];
ans_a.push_back(p.x);
ans_b.push_back(p.y);
auto os = mids(v[i],v[j]);
//cerr << "use " << p << " from " << os[0] << " " << os[1] << "\n";
ll idx1 = (*lower_bound(a.begin(),a.end(),os[0])).i;
ll idx2 = (*lower_bound(a.begin(),a.end(),os[1])).i;
ans_u.push_back(idx1);
ans_v.push_back(idx2);
break;
}
}
if(ans_u.size()<n-1) continue;
build(ans_u,ans_v,ans_a,ans_b);
return 1;
}
return 0;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:134:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<obj, obj> >::size_type' {aka 'long unsigned int'} and 'll' {aka 'int'} [-Wsign-compare]
134 | if(cons.size()<n-1) return 0;
| ~~~~~~~~~~~^~~~
parks.cpp:159:52: warning: narrowing conversion of '(& con.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)i)))->std::vector<int>::size()' from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'll' {aka 'int'} [-Wnarrowing]
159 | for(ll i = 0;i<m;i++) q.push({i,con[i].size()});
| ~~~~~~~~~~~^~
parks.cpp:185:31: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
185 | for(ll z = 0;z<con[j].size();z++) if(con[j][z]==i){
| ~^~~~~~~~~~~~~~
parks.cpp:189:38: warning: narrowing conversion of '(& con.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)j)))->std::vector<int>::size()' from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'll' {aka 'int'} [-Wnarrowing]
189 | q.push({j,con[j].size()});
| ~~~~~~~~~~~^~
parks.cpp:202:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'int'} [-Wsign-compare]
202 | if(ans_u.size()<n-1) continue;
| ~~~~~~~~~~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
251 ms |
34840 KB |
Output is correct |
10 |
Correct |
20 ms |
3640 KB |
Output is correct |
11 |
Correct |
118 ms |
18764 KB |
Output is correct |
12 |
Correct |
30 ms |
5444 KB |
Output is correct |
13 |
Correct |
50 ms |
10356 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
860 KB |
Output is correct |
16 |
Correct |
234 ms |
35124 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
251 ms |
34840 KB |
Output is correct |
10 |
Correct |
20 ms |
3640 KB |
Output is correct |
11 |
Correct |
118 ms |
18764 KB |
Output is correct |
12 |
Correct |
30 ms |
5444 KB |
Output is correct |
13 |
Correct |
50 ms |
10356 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
860 KB |
Output is correct |
16 |
Correct |
234 ms |
35124 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
625 ms |
66008 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
2 ms |
860 KB |
Output is correct |
26 |
Correct |
5 ms |
1368 KB |
Output is correct |
27 |
Correct |
7 ms |
1908 KB |
Output is correct |
28 |
Correct |
229 ms |
27652 KB |
Output is correct |
29 |
Correct |
341 ms |
39940 KB |
Output is correct |
30 |
Correct |
501 ms |
55984 KB |
Output is correct |
31 |
Correct |
604 ms |
66736 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
348 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 |
348 KB |
Output is correct |
43 |
Correct |
3 ms |
1080 KB |
Output is correct |
44 |
Correct |
4 ms |
956 KB |
Output is correct |
45 |
Correct |
261 ms |
32604 KB |
Output is correct |
46 |
Correct |
396 ms |
49804 KB |
Output is correct |
47 |
Correct |
427 ms |
47032 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
251 ms |
34840 KB |
Output is correct |
10 |
Correct |
20 ms |
3640 KB |
Output is correct |
11 |
Correct |
118 ms |
18764 KB |
Output is correct |
12 |
Correct |
30 ms |
5444 KB |
Output is correct |
13 |
Correct |
50 ms |
10356 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
860 KB |
Output is correct |
16 |
Correct |
234 ms |
35124 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
625 ms |
66008 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
2 ms |
860 KB |
Output is correct |
26 |
Correct |
5 ms |
1368 KB |
Output is correct |
27 |
Correct |
7 ms |
1908 KB |
Output is correct |
28 |
Correct |
229 ms |
27652 KB |
Output is correct |
29 |
Correct |
341 ms |
39940 KB |
Output is correct |
30 |
Correct |
501 ms |
55984 KB |
Output is correct |
31 |
Correct |
604 ms |
66736 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
348 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 |
348 KB |
Output is correct |
43 |
Correct |
3 ms |
1080 KB |
Output is correct |
44 |
Correct |
4 ms |
956 KB |
Output is correct |
45 |
Correct |
261 ms |
32604 KB |
Output is correct |
46 |
Correct |
396 ms |
49804 KB |
Output is correct |
47 |
Correct |
427 ms |
47032 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
0 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 |
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 |
697 ms |
70312 KB |
Output is correct |
56 |
Correct |
1 ms |
344 KB |
Output is correct |
57 |
Correct |
6 ms |
1216 KB |
Output is correct |
58 |
Correct |
14 ms |
2520 KB |
Output is correct |
59 |
Correct |
16 ms |
4304 KB |
Output is correct |
60 |
Correct |
324 ms |
33960 KB |
Output is correct |
61 |
Correct |
470 ms |
53936 KB |
Output is correct |
62 |
Correct |
1105 ms |
87836 KB |
Output is correct |
63 |
Correct |
1418 ms |
103468 KB |
Output is correct |
64 |
Correct |
0 ms |
604 KB |
Output is correct |
65 |
Correct |
1 ms |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
622 ms |
70216 KB |
Output is correct |
68 |
Correct |
605 ms |
73096 KB |
Output is correct |
69 |
Correct |
538 ms |
73700 KB |
Output is correct |
70 |
Correct |
5 ms |
1240 KB |
Output is correct |
71 |
Correct |
10 ms |
2284 KB |
Output is correct |
72 |
Correct |
267 ms |
32272 KB |
Output is correct |
73 |
Correct |
425 ms |
49016 KB |
Output is correct |
74 |
Correct |
613 ms |
66792 KB |
Output is correct |
75 |
Correct |
639 ms |
70396 KB |
Output is correct |
76 |
Correct |
525 ms |
73096 KB |
Output is correct |
77 |
Correct |
7 ms |
1400 KB |
Output is correct |
78 |
Correct |
12 ms |
2532 KB |
Output is correct |
79 |
Correct |
279 ms |
33284 KB |
Output is correct |
80 |
Correct |
467 ms |
54808 KB |
Output is correct |
81 |
Correct |
610 ms |
70952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
251 ms |
34840 KB |
Output is correct |
10 |
Correct |
20 ms |
3640 KB |
Output is correct |
11 |
Correct |
118 ms |
18764 KB |
Output is correct |
12 |
Correct |
30 ms |
5444 KB |
Output is correct |
13 |
Correct |
50 ms |
10356 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
860 KB |
Output is correct |
16 |
Correct |
234 ms |
35124 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
528 ms |
60836 KB |
Output is correct |
21 |
Correct |
541 ms |
59684 KB |
Output is correct |
22 |
Correct |
560 ms |
57884 KB |
Output is correct |
23 |
Correct |
484 ms |
68292 KB |
Output is correct |
24 |
Correct |
56 ms |
7252 KB |
Output is correct |
25 |
Correct |
373 ms |
55072 KB |
Output is correct |
26 |
Correct |
294 ms |
55728 KB |
Output is correct |
27 |
Correct |
587 ms |
73592 KB |
Output is correct |
28 |
Correct |
547 ms |
70840 KB |
Output is correct |
29 |
Correct |
624 ms |
70712 KB |
Output is correct |
30 |
Correct |
628 ms |
71556 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
37 ms |
4392 KB |
Output is correct |
33 |
Correct |
31 ms |
3788 KB |
Output is correct |
34 |
Correct |
513 ms |
58696 KB |
Output is correct |
35 |
Correct |
14 ms |
2580 KB |
Output is correct |
36 |
Correct |
80 ms |
15088 KB |
Output is correct |
37 |
Correct |
172 ms |
29884 KB |
Output is correct |
38 |
Correct |
229 ms |
25992 KB |
Output is correct |
39 |
Correct |
318 ms |
32436 KB |
Output is correct |
40 |
Correct |
430 ms |
45896 KB |
Output is correct |
41 |
Correct |
501 ms |
52552 KB |
Output is correct |
42 |
Correct |
626 ms |
62072 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
348 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 |
0 ms |
344 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
344 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
2 ms |
860 KB |
Output is correct |
55 |
Correct |
4 ms |
1068 KB |
Output is correct |
56 |
Correct |
274 ms |
31084 KB |
Output is correct |
57 |
Correct |
429 ms |
45580 KB |
Output is correct |
58 |
Correct |
393 ms |
50164 KB |
Output is correct |
59 |
Correct |
0 ms |
344 KB |
Output is correct |
60 |
Correct |
0 ms |
344 KB |
Output is correct |
61 |
Correct |
0 ms |
348 KB |
Output is correct |
62 |
Correct |
545 ms |
72736 KB |
Output is correct |
63 |
Correct |
533 ms |
69744 KB |
Output is correct |
64 |
Correct |
629 ms |
71680 KB |
Output is correct |
65 |
Correct |
6 ms |
1240 KB |
Output is correct |
66 |
Correct |
12 ms |
2168 KB |
Output is correct |
67 |
Correct |
264 ms |
32876 KB |
Output is correct |
68 |
Correct |
434 ms |
49428 KB |
Output is correct |
69 |
Correct |
604 ms |
62992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
251 ms |
34840 KB |
Output is correct |
10 |
Correct |
20 ms |
3640 KB |
Output is correct |
11 |
Correct |
118 ms |
18764 KB |
Output is correct |
12 |
Correct |
30 ms |
5444 KB |
Output is correct |
13 |
Correct |
50 ms |
10356 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
860 KB |
Output is correct |
16 |
Correct |
234 ms |
35124 KB |
Output is correct |
17 |
Correct |
550 ms |
71152 KB |
Output is correct |
18 |
Correct |
562 ms |
70060 KB |
Output is correct |
19 |
Correct |
535 ms |
60024 KB |
Output is correct |
20 |
Correct |
621 ms |
66088 KB |
Output is correct |
21 |
Correct |
539 ms |
66060 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
83 ms |
10188 KB |
Output is correct |
24 |
Correct |
31 ms |
5240 KB |
Output is correct |
25 |
Correct |
119 ms |
20212 KB |
Output is correct |
26 |
Correct |
217 ms |
33800 KB |
Output is correct |
27 |
Correct |
293 ms |
31084 KB |
Output is correct |
28 |
Correct |
400 ms |
40056 KB |
Output is correct |
29 |
Correct |
503 ms |
51624 KB |
Output is correct |
30 |
Correct |
551 ms |
59484 KB |
Output is correct |
31 |
Correct |
640 ms |
62604 KB |
Output is correct |
32 |
Correct |
607 ms |
66988 KB |
Output is correct |
33 |
Correct |
542 ms |
72816 KB |
Output is correct |
34 |
Correct |
7 ms |
1396 KB |
Output is correct |
35 |
Correct |
12 ms |
2592 KB |
Output is correct |
36 |
Correct |
270 ms |
32244 KB |
Output is correct |
37 |
Correct |
422 ms |
53000 KB |
Output is correct |
38 |
Correct |
628 ms |
66760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
251 ms |
34840 KB |
Output is correct |
10 |
Correct |
20 ms |
3640 KB |
Output is correct |
11 |
Correct |
118 ms |
18764 KB |
Output is correct |
12 |
Correct |
30 ms |
5444 KB |
Output is correct |
13 |
Correct |
50 ms |
10356 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
860 KB |
Output is correct |
16 |
Correct |
234 ms |
35124 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
625 ms |
66008 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
2 ms |
860 KB |
Output is correct |
26 |
Correct |
5 ms |
1368 KB |
Output is correct |
27 |
Correct |
7 ms |
1908 KB |
Output is correct |
28 |
Correct |
229 ms |
27652 KB |
Output is correct |
29 |
Correct |
341 ms |
39940 KB |
Output is correct |
30 |
Correct |
501 ms |
55984 KB |
Output is correct |
31 |
Correct |
604 ms |
66736 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
348 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 |
348 KB |
Output is correct |
43 |
Correct |
3 ms |
1080 KB |
Output is correct |
44 |
Correct |
4 ms |
956 KB |
Output is correct |
45 |
Correct |
261 ms |
32604 KB |
Output is correct |
46 |
Correct |
396 ms |
49804 KB |
Output is correct |
47 |
Correct |
427 ms |
47032 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
0 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 |
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 |
697 ms |
70312 KB |
Output is correct |
56 |
Correct |
1 ms |
344 KB |
Output is correct |
57 |
Correct |
6 ms |
1216 KB |
Output is correct |
58 |
Correct |
14 ms |
2520 KB |
Output is correct |
59 |
Correct |
16 ms |
4304 KB |
Output is correct |
60 |
Correct |
324 ms |
33960 KB |
Output is correct |
61 |
Correct |
470 ms |
53936 KB |
Output is correct |
62 |
Correct |
1105 ms |
87836 KB |
Output is correct |
63 |
Correct |
1418 ms |
103468 KB |
Output is correct |
64 |
Correct |
0 ms |
604 KB |
Output is correct |
65 |
Correct |
1 ms |
344 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
622 ms |
70216 KB |
Output is correct |
68 |
Correct |
605 ms |
73096 KB |
Output is correct |
69 |
Correct |
538 ms |
73700 KB |
Output is correct |
70 |
Correct |
5 ms |
1240 KB |
Output is correct |
71 |
Correct |
10 ms |
2284 KB |
Output is correct |
72 |
Correct |
267 ms |
32272 KB |
Output is correct |
73 |
Correct |
425 ms |
49016 KB |
Output is correct |
74 |
Correct |
613 ms |
66792 KB |
Output is correct |
75 |
Correct |
639 ms |
70396 KB |
Output is correct |
76 |
Correct |
525 ms |
73096 KB |
Output is correct |
77 |
Correct |
7 ms |
1400 KB |
Output is correct |
78 |
Correct |
12 ms |
2532 KB |
Output is correct |
79 |
Correct |
279 ms |
33284 KB |
Output is correct |
80 |
Correct |
467 ms |
54808 KB |
Output is correct |
81 |
Correct |
610 ms |
70952 KB |
Output is correct |
82 |
Correct |
0 ms |
344 KB |
Output is correct |
83 |
Correct |
0 ms |
348 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
528 ms |
60836 KB |
Output is correct |
86 |
Correct |
541 ms |
59684 KB |
Output is correct |
87 |
Correct |
560 ms |
57884 KB |
Output is correct |
88 |
Correct |
484 ms |
68292 KB |
Output is correct |
89 |
Correct |
56 ms |
7252 KB |
Output is correct |
90 |
Correct |
373 ms |
55072 KB |
Output is correct |
91 |
Correct |
294 ms |
55728 KB |
Output is correct |
92 |
Correct |
587 ms |
73592 KB |
Output is correct |
93 |
Correct |
547 ms |
70840 KB |
Output is correct |
94 |
Correct |
624 ms |
70712 KB |
Output is correct |
95 |
Correct |
628 ms |
71556 KB |
Output is correct |
96 |
Correct |
0 ms |
344 KB |
Output is correct |
97 |
Correct |
37 ms |
4392 KB |
Output is correct |
98 |
Correct |
31 ms |
3788 KB |
Output is correct |
99 |
Correct |
513 ms |
58696 KB |
Output is correct |
100 |
Correct |
14 ms |
2580 KB |
Output is correct |
101 |
Correct |
80 ms |
15088 KB |
Output is correct |
102 |
Correct |
172 ms |
29884 KB |
Output is correct |
103 |
Correct |
229 ms |
25992 KB |
Output is correct |
104 |
Correct |
318 ms |
32436 KB |
Output is correct |
105 |
Correct |
430 ms |
45896 KB |
Output is correct |
106 |
Correct |
501 ms |
52552 KB |
Output is correct |
107 |
Correct |
626 ms |
62072 KB |
Output is correct |
108 |
Correct |
0 ms |
348 KB |
Output is correct |
109 |
Correct |
0 ms |
348 KB |
Output is correct |
110 |
Correct |
0 ms |
348 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 |
0 ms |
344 KB |
Output is correct |
115 |
Correct |
0 ms |
348 KB |
Output is correct |
116 |
Correct |
0 ms |
344 KB |
Output is correct |
117 |
Correct |
0 ms |
348 KB |
Output is correct |
118 |
Correct |
0 ms |
348 KB |
Output is correct |
119 |
Correct |
2 ms |
860 KB |
Output is correct |
120 |
Correct |
4 ms |
1068 KB |
Output is correct |
121 |
Correct |
274 ms |
31084 KB |
Output is correct |
122 |
Correct |
429 ms |
45580 KB |
Output is correct |
123 |
Correct |
393 ms |
50164 KB |
Output is correct |
124 |
Correct |
0 ms |
344 KB |
Output is correct |
125 |
Correct |
0 ms |
344 KB |
Output is correct |
126 |
Correct |
0 ms |
348 KB |
Output is correct |
127 |
Correct |
545 ms |
72736 KB |
Output is correct |
128 |
Correct |
533 ms |
69744 KB |
Output is correct |
129 |
Correct |
629 ms |
71680 KB |
Output is correct |
130 |
Correct |
6 ms |
1240 KB |
Output is correct |
131 |
Correct |
12 ms |
2168 KB |
Output is correct |
132 |
Correct |
264 ms |
32876 KB |
Output is correct |
133 |
Correct |
434 ms |
49428 KB |
Output is correct |
134 |
Correct |
604 ms |
62992 KB |
Output is correct |
135 |
Correct |
550 ms |
71152 KB |
Output is correct |
136 |
Correct |
562 ms |
70060 KB |
Output is correct |
137 |
Correct |
535 ms |
60024 KB |
Output is correct |
138 |
Correct |
621 ms |
66088 KB |
Output is correct |
139 |
Correct |
539 ms |
66060 KB |
Output is correct |
140 |
Correct |
0 ms |
344 KB |
Output is correct |
141 |
Correct |
83 ms |
10188 KB |
Output is correct |
142 |
Correct |
31 ms |
5240 KB |
Output is correct |
143 |
Correct |
119 ms |
20212 KB |
Output is correct |
144 |
Correct |
217 ms |
33800 KB |
Output is correct |
145 |
Correct |
293 ms |
31084 KB |
Output is correct |
146 |
Correct |
400 ms |
40056 KB |
Output is correct |
147 |
Correct |
503 ms |
51624 KB |
Output is correct |
148 |
Correct |
551 ms |
59484 KB |
Output is correct |
149 |
Correct |
640 ms |
62604 KB |
Output is correct |
150 |
Correct |
607 ms |
66988 KB |
Output is correct |
151 |
Correct |
542 ms |
72816 KB |
Output is correct |
152 |
Correct |
7 ms |
1396 KB |
Output is correct |
153 |
Correct |
12 ms |
2592 KB |
Output is correct |
154 |
Correct |
270 ms |
32244 KB |
Output is correct |
155 |
Correct |
422 ms |
53000 KB |
Output is correct |
156 |
Correct |
628 ms |
66760 KB |
Output is correct |
157 |
Correct |
0 ms |
348 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 |
2721 ms |
146448 KB |
Solution announced impossible, but it is possible. |
162 |
Halted |
0 ms |
0 KB |
- |