Submission #812344

# Submission time Handle Problem Language Result Execution time Memory
812344 2023-08-07T08:27:04 Z penguinman Fountain Parks (IOI21_parks) C++17
50 / 100
1692 ms 123236 KB
#include "parks.h"

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::vector;
using std::string;
using ll = int;
using vi = vector<ll>;
using vii = vector<vi>;
using pii = std::pair<ll,ll>;
using std::endl;

#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define ln "\n"
#define pb emplace_back
#define mp std::make_pair
#define all(a) a.begin(),a.end()

int construct_roads(std::vector<int> x, std::vector<int> y) {
    std::map<pii,ll> xy;
    std::map<pii,ll> rev;
    rep(i,0,x.size()) xy[mp(x[i],y[i])] = i;
    ll cnt__ = 0;
    rep(i,0,x.size()){
        vi P = {2,0}, Q = {0,2};
        vi R = {0,1}, S = {1,0};
        rep(j,0,2){
            if(xy.count(mp(x[i]+P[j], y[i]+Q[j]))){
                ll mx = x[i]+P[j]/2;
                ll my = y[i]+Q[j]/2;
                rev[mp(mx+R[j], my+S[j])] = rev[mp(mx-R[j],my-S[j])] = 0;
                cnt__++;
            }
        }
    }
    if(cnt__ != ll(x.size()-1)){
        vector<std::map<ll,ll>> X(7);
        rep(i,0,x.size()){
            if(x[i] > 6 || x[i] < 2) return 0;
            X[x[i]][y[i]] = i;
        }
        vi u,v,a,b;
        vi par(x.size());
        rep(i,0,x.size()) par[i] = i;
        std::function<ll(ll)> root = [&](ll now){
            if(par[now] == now) return now;
            return par[now] = root(par[now]);
        };
        for(auto el: X[2]){
            if(X[2].count(el.first+2)){
                u.pb(el.second);
                ll next = X[2][el.first+2];
                v.pb(next);
                a.pb(1);
                b.pb(el.first+1);
                par[root(el.second)] = root(next);
            }
        }
        for(auto el: X[6]){
            if(X[6].count(el.first+2)){
                u.pb(el.second);
                ll next = X[6][el.first+2];
                v.pb(next);
                a.pb(7);
                b.pb(el.first+1);
                par[root(el.second)] = root(next);
            }
        }
        std::set<pii> used;
        for(auto el: X[4]){
            if(X[4].count(el.first+2)){
                ll next = X[4][el.first+2];
                par[root(next)] = root(el.second);
                ll rx = -1, ry = -1;
                if(el.first%4 == 0) rx = 3, ry = el.first+1;
                if(el.first%4 == 2) rx = 5, ry = el.first+1;
                used.insert(mp(rx, ry));
                u.pb(el.second);
                v.pb(next);
                a.pb(rx);
                b.pb(ry);
            }
        }
        for(auto el: X[4]){
            if(X[2].count(el.first)){
                ll next = X[2][el.first];
                if(root(next) != root(el.second)){
                    par[root(next)] = root(el.second);
                    u.pb(el.second);
                    v.pb(next);
                    ll rx = -1, ry = -1;
                    if(!used.count(mp(3,el.first-1))) rx = 3, ry = el.first-1;
                    if(!used.count(mp(3,el.first+1))) rx = 3, ry = el.first+1;
                    assert(rx != -1);
                    a.pb(rx);
                    b.pb(ry);
                    used.insert(mp(rx, ry));
                }
            }
            if(X[6].count(el.first)){
                ll next = X[6][el.first];
                if(root(next) != root(el.second)){
                    par[root(next)] = root(el.second);
                    u.pb(el.second);
                    v.pb(next);
                    ll rx = -1, ry = -1;
                    if(!used.count(mp(5,el.first-1))) rx = 5, ry = el.first-1;
                    if(!used.count(mp(5,el.first+1))) rx = 5, ry = el.first+1;
                    assert(rx != -1);
                    a.pb(rx);
                    b.pb(ry);
                    used.insert(mp(rx, ry));
                }
            }
        }
        if(u.size()+1 == x.size()){
            build(u,v,a,b);
            return 1;
        }
        else return 0;
    }
    ll N = 0;
    vi rx, ry;
    for(auto &el: rev){
        el.second = N++;
        rx.pb(el.first.first);
        ry.pb(el.first.second);
    }
    vii edge(N);
    vii eu(N), ev(N);
    rep(i,0,x.size()){
        vi P = {2,0}, Q = {0,2};
        vi R = {0,1}, S = {1,0};
        rep(j,0,2){
            if(xy.count(mp(x[i]+P[j], y[i]+Q[j]))){
                ll mx = x[i]+P[j]/2;
                ll my = y[i]+Q[j]/2;
                ll nu = rev[mp(mx+R[j], my+S[j])];
                ll nv = rev[mp(mx-R[j],my-S[j])];
                ll nxy = xy[mp(x[i]+P[j], y[i]+Q[j])];
                edge[nu].pb(nv);
                eu[nu].pb(i);
                ev[nu].pb(nxy);
                edge[nv].pb(nu);
                eu[nv].pb(i);
                ev[nv].pb(nxy);
            }
        }
    }
    vi cnt(N);
    rep(i,0,N) cnt[i] = edge[i].size();
    vi u,v,a,b;
    rep(k,0,N){
        if(cnt[k] != 1) continue;
        cnt[k]--;
        ll now = k;
        while(true){
            ll nex = -1;
            rep(i,0,edge[now].size()){
                ll next = edge[now][i];
                if(cnt[next] == 0) continue;
                u.pb(eu[now][i]);
                v.pb(ev[now][i]);
                a.pb(rx[now]);
                b.pb(ry[now]);
                cnt[next]--;
                if(cnt[next] == 1){
                    cnt[next]--;
                    nex = next;
                }
            }
            if(nex == -1) break;
            now = nex;
        }
    }
    rep(i,0,N){
        if(cnt[i] > 2) return 0;
    }
    rep(i,0,N){
        assert(cnt[i] == 0 || cnt[i] == 2);
        if(cnt[i] == 0) continue;
        cnt[i] = 0;
        ll now = i;
        while(true){
            ll val = -1;
            rep(j,0,edge[now].size()){
                ll next = edge[now][j];
                if(cnt[next] == 0) continue;
                u.pb(eu[now][j]);
                v.pb(ev[now][j]);
                a.pb(rx[now]);
                b.pb(ry[now]);
                val = cnt[next];
                cnt[next] = 0;
                now = next;
                break;
            }
            if(val == -1) break;
        }
        rep(j,0,edge[now].size()){
            ll next = edge[now][j];
            if(next != i) continue;
            u.pb(eu[now][j]);
            v.pb(ev[now][j]);
            a.pb(rx[now]);
            b.pb(ry[now]);
        }
    }
    build(u,v,a,b);
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 556 ms 60892 KB Output is correct
10 Correct 19 ms 6356 KB Output is correct
11 Correct 119 ms 32928 KB Output is correct
12 Correct 28 ms 9336 KB Output is correct
13 Correct 52 ms 12444 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 534 ms 60856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 556 ms 60892 KB Output is correct
10 Correct 19 ms 6356 KB Output is correct
11 Correct 119 ms 32928 KB Output is correct
12 Correct 28 ms 9336 KB Output is correct
13 Correct 52 ms 12444 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 534 ms 60856 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 773 ms 63664 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 2 ms 596 KB Output is correct
26 Correct 4 ms 1108 KB Output is correct
27 Correct 6 ms 1364 KB Output is correct
28 Correct 205 ms 25640 KB Output is correct
29 Correct 358 ms 38320 KB Output is correct
30 Correct 551 ms 51024 KB Output is correct
31 Correct 901 ms 63636 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 216 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 3 ms 724 KB Output is correct
44 Correct 4 ms 980 KB Output is correct
45 Correct 548 ms 46020 KB Output is correct
46 Correct 862 ms 67264 KB Output is correct
47 Correct 858 ms 67268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 556 ms 60892 KB Output is correct
10 Correct 19 ms 6356 KB Output is correct
11 Correct 119 ms 32928 KB Output is correct
12 Correct 28 ms 9336 KB Output is correct
13 Correct 52 ms 12444 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 534 ms 60856 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 773 ms 63664 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 2 ms 596 KB Output is correct
26 Correct 4 ms 1108 KB Output is correct
27 Correct 6 ms 1364 KB Output is correct
28 Correct 205 ms 25640 KB Output is correct
29 Correct 358 ms 38320 KB Output is correct
30 Correct 551 ms 51024 KB Output is correct
31 Correct 901 ms 63636 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 216 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 3 ms 724 KB Output is correct
44 Correct 4 ms 980 KB Output is correct
45 Correct 548 ms 46020 KB Output is correct
46 Correct 862 ms 67264 KB Output is correct
47 Correct 858 ms 67268 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 0 ms 212 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 0 ms 212 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 792 ms 58432 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 3 ms 724 KB Output is correct
58 Correct 10 ms 2060 KB Output is correct
59 Correct 15 ms 2772 KB Output is correct
60 Correct 350 ms 29400 KB Output is correct
61 Correct 471 ms 39448 KB Output is correct
62 Correct 604 ms 48276 KB Output is correct
63 Correct 714 ms 58520 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 0 ms 212 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 1403 ms 121592 KB Output is correct
68 Correct 1590 ms 121504 KB Output is correct
69 Correct 1556 ms 120908 KB Output is correct
70 Correct 6 ms 1256 KB Output is correct
71 Correct 12 ms 2260 KB Output is correct
72 Correct 462 ms 44892 KB Output is correct
73 Correct 894 ms 67672 KB Output is correct
74 Correct 1267 ms 89640 KB Output is correct
75 Correct 746 ms 61164 KB Output is correct
76 Correct 637 ms 65396 KB Output is correct
77 Correct 7 ms 1492 KB Output is correct
78 Correct 14 ms 2536 KB Output is correct
79 Correct 256 ms 28840 KB Output is correct
80 Correct 481 ms 43168 KB Output is correct
81 Correct 700 ms 57516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 556 ms 60892 KB Output is correct
10 Correct 19 ms 6356 KB Output is correct
11 Correct 119 ms 32928 KB Output is correct
12 Correct 28 ms 9336 KB Output is correct
13 Correct 52 ms 12444 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 534 ms 60856 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 876 ms 76184 KB Output is correct
21 Correct 1046 ms 75936 KB Output is correct
22 Correct 954 ms 75992 KB Output is correct
23 Correct 1044 ms 105536 KB Output is correct
24 Correct 200 ms 17600 KB Output is correct
25 Correct 522 ms 42508 KB Output is correct
26 Correct 482 ms 42540 KB Output is correct
27 Correct 1404 ms 123032 KB Output is correct
28 Correct 1480 ms 123008 KB Output is correct
29 Correct 1432 ms 122928 KB Output is correct
30 Correct 1421 ms 123088 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 36 ms 6564 KB Output is correct
33 Correct 76 ms 9248 KB Output is correct
34 Correct 990 ms 76200 KB Output is correct
35 Correct 11 ms 1848 KB Output is correct
36 Correct 68 ms 8472 KB Output is correct
37 Correct 163 ms 16800 KB Output is correct
38 Correct 316 ms 34656 KB Output is correct
39 Correct 624 ms 46960 KB Output is correct
40 Correct 819 ms 60312 KB Output is correct
41 Correct 1031 ms 72812 KB Output is correct
42 Correct 1366 ms 85184 KB Output is correct
43 Correct 1 ms 296 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 0 ms 300 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 296 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 0 ms 300 KB Output is correct
51 Correct 1 ms 340 KB Output is correct
52 Correct 1 ms 300 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 4 ms 724 KB Output is correct
55 Correct 5 ms 1108 KB Output is correct
56 Correct 560 ms 46868 KB Output is correct
57 Correct 939 ms 68388 KB Output is correct
58 Correct 837 ms 68452 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 296 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1376 ms 123212 KB Output is correct
63 Correct 1492 ms 123236 KB Output is correct
64 Correct 1692 ms 122628 KB Output is correct
65 Correct 7 ms 1332 KB Output is correct
66 Correct 11 ms 2388 KB Output is correct
67 Correct 473 ms 45648 KB Output is correct
68 Correct 927 ms 68928 KB Output is correct
69 Correct 1343 ms 91340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 556 ms 60892 KB Output is correct
10 Correct 19 ms 6356 KB Output is correct
11 Correct 119 ms 32928 KB Output is correct
12 Correct 28 ms 9336 KB Output is correct
13 Correct 52 ms 12444 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 534 ms 60856 KB Output is correct
17 Incorrect 572 ms 41060 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 556 ms 60892 KB Output is correct
10 Correct 19 ms 6356 KB Output is correct
11 Correct 119 ms 32928 KB Output is correct
12 Correct 28 ms 9336 KB Output is correct
13 Correct 52 ms 12444 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 2 ms 852 KB Output is correct
16 Correct 534 ms 60856 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 773 ms 63664 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 2 ms 596 KB Output is correct
26 Correct 4 ms 1108 KB Output is correct
27 Correct 6 ms 1364 KB Output is correct
28 Correct 205 ms 25640 KB Output is correct
29 Correct 358 ms 38320 KB Output is correct
30 Correct 551 ms 51024 KB Output is correct
31 Correct 901 ms 63636 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 216 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 3 ms 724 KB Output is correct
44 Correct 4 ms 980 KB Output is correct
45 Correct 548 ms 46020 KB Output is correct
46 Correct 862 ms 67264 KB Output is correct
47 Correct 858 ms 67268 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 0 ms 212 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 0 ms 212 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 792 ms 58432 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 3 ms 724 KB Output is correct
58 Correct 10 ms 2060 KB Output is correct
59 Correct 15 ms 2772 KB Output is correct
60 Correct 350 ms 29400 KB Output is correct
61 Correct 471 ms 39448 KB Output is correct
62 Correct 604 ms 48276 KB Output is correct
63 Correct 714 ms 58520 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 0 ms 212 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 1403 ms 121592 KB Output is correct
68 Correct 1590 ms 121504 KB Output is correct
69 Correct 1556 ms 120908 KB Output is correct
70 Correct 6 ms 1256 KB Output is correct
71 Correct 12 ms 2260 KB Output is correct
72 Correct 462 ms 44892 KB Output is correct
73 Correct 894 ms 67672 KB Output is correct
74 Correct 1267 ms 89640 KB Output is correct
75 Correct 746 ms 61164 KB Output is correct
76 Correct 637 ms 65396 KB Output is correct
77 Correct 7 ms 1492 KB Output is correct
78 Correct 14 ms 2536 KB Output is correct
79 Correct 256 ms 28840 KB Output is correct
80 Correct 481 ms 43168 KB Output is correct
81 Correct 700 ms 57516 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 0 ms 212 KB Output is correct
84 Correct 0 ms 212 KB Output is correct
85 Correct 876 ms 76184 KB Output is correct
86 Correct 1046 ms 75936 KB Output is correct
87 Correct 954 ms 75992 KB Output is correct
88 Correct 1044 ms 105536 KB Output is correct
89 Correct 200 ms 17600 KB Output is correct
90 Correct 522 ms 42508 KB Output is correct
91 Correct 482 ms 42540 KB Output is correct
92 Correct 1404 ms 123032 KB Output is correct
93 Correct 1480 ms 123008 KB Output is correct
94 Correct 1432 ms 122928 KB Output is correct
95 Correct 1421 ms 123088 KB Output is correct
96 Correct 1 ms 304 KB Output is correct
97 Correct 36 ms 6564 KB Output is correct
98 Correct 76 ms 9248 KB Output is correct
99 Correct 990 ms 76200 KB Output is correct
100 Correct 11 ms 1848 KB Output is correct
101 Correct 68 ms 8472 KB Output is correct
102 Correct 163 ms 16800 KB Output is correct
103 Correct 316 ms 34656 KB Output is correct
104 Correct 624 ms 46960 KB Output is correct
105 Correct 819 ms 60312 KB Output is correct
106 Correct 1031 ms 72812 KB Output is correct
107 Correct 1366 ms 85184 KB Output is correct
108 Correct 1 ms 296 KB Output is correct
109 Correct 1 ms 212 KB Output is correct
110 Correct 0 ms 300 KB Output is correct
111 Correct 0 ms 212 KB Output is correct
112 Correct 1 ms 296 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 1 ms 212 KB Output is correct
115 Correct 0 ms 300 KB Output is correct
116 Correct 1 ms 340 KB Output is correct
117 Correct 1 ms 300 KB Output is correct
118 Correct 1 ms 212 KB Output is correct
119 Correct 4 ms 724 KB Output is correct
120 Correct 5 ms 1108 KB Output is correct
121 Correct 560 ms 46868 KB Output is correct
122 Correct 939 ms 68388 KB Output is correct
123 Correct 837 ms 68452 KB Output is correct
124 Correct 1 ms 212 KB Output is correct
125 Correct 1 ms 296 KB Output is correct
126 Correct 1 ms 212 KB Output is correct
127 Correct 1376 ms 123212 KB Output is correct
128 Correct 1492 ms 123236 KB Output is correct
129 Correct 1692 ms 122628 KB Output is correct
130 Correct 7 ms 1332 KB Output is correct
131 Correct 11 ms 2388 KB Output is correct
132 Correct 473 ms 45648 KB Output is correct
133 Correct 927 ms 68928 KB Output is correct
134 Correct 1343 ms 91340 KB Output is correct
135 Incorrect 572 ms 41060 KB Solution announced impossible, but it is possible.
136 Halted 0 ms 0 KB -