QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#108769#67. Two Transportationsbashkort#62 1450ms33296kbC++204.0kb2023-05-26 17:10:502024-05-31 13:42:55

Judging History

你现在查看的是最新测评结果

  • [2024-05-31 13:42:55]
  • 评测
  • 测评结果:62
  • 用时:1450ms
  • 内存:33296kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-26 17:10:50]
  • 提交

Azer

#include "Azer.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    constexpr int maxN = 2000, maxQ = 58001;
    constexpr int inf = 1e9 + 7;

    int N, A, Q = 0, S = 0, usedCnt = 0;

    vector<pair<int, int>> adj[maxN];
    set<pair<int, int>> st;

    int dist[maxN];
    bool used[maxN], b[maxQ];
}

void InitA(int N, int A, std::vector<int> U, std::vector<int> V,
           std::vector<int> C) {
    ::N = N, ::A = A;

    fill(dist, dist + N, inf);
    dist[0] = 0;
    used[0] = true;


    for (int i = 0; i < A; ++i) {
        adj[U[i]].emplace_back(V[i], C[i]);
        adj[V[i]].emplace_back(U[i], C[i]);
    }

    for (auto [to, w] : adj[0]) {
        if (dist[to] > dist[0] + w) {
            st.erase({dist[to], to});
            st.emplace(dist[to] = dist[0] + w, to);
        }
    }

    for (int i = 0; i < 20; ++i) {
        SendA(0);
    }
}

void ReceiveA(bool x) {
    b[Q++] = x;

    if (Q % 20 == 0) {
        int v = 0, d = 0, s = Q - 20;

        for (int i = 0; i < 11; ++i) {
            v |= b[s + i] << i;
        }
        for (int i = 0; i < 9; ++i) {
            d |= b[s + 11 + i] << i;
        }


//        cout << "A received: " << v << "; dist0 = " << S + d << "; diff = " << d << endl;

        if (v != 0) {
            st.erase({dist[v], v});
            st.emplace(dist[v] = min(dist[v], S + d), v);
        }

        if (st.empty()) {
            return;
        }

        auto [dis, to] = *st.begin();
        st.erase(st.begin());
        assert(!used[to]);
        used[to] = true;

        for (auto [t, w] : adj[to]) {
            if (!used[t] && dist[t] > dist[to] + w) {
                st.erase({dist[t], t});
                st.emplace(dist[t] = dist[to] + w, t);
            }
        }

        int diff = dis - S;
        S = dis;

        for (int i = 0; i < 11; ++i) {
            SendA(to >> i & 1);
        }
        for (int i = 0; i < 9; ++i) {
            SendA(diff >> i & 1);
        }
    }
}

std::vector<int> Answer() {
    std::vector<int> ans(N);
    for (int k = 0; k < N; ++k) {
        ans[k] = dist[k];
    }
    return ans;
}

Baijan

#include "Baijan.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
    constexpr int maxN = 2000, maxQ = 58000;
    constexpr int inf = 1e9 + 7;

    int N, B, Q = 0, S = 0;

    vector<pair<int, int>> adj[maxN];
    set<pair<int, int>> st;

    int dist[maxN];
    bool used[maxN], b[maxQ];
}

void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
           std::vector<int> D) {
    ::N = N, ::B = B;

    fill(dist, dist + N, inf);

    for (int i = 0; i < B; ++i) {
        adj[S[i]].emplace_back(T[i], D[i]);
        adj[T[i]].emplace_back(S[i], D[i]);
    }
}

void ReceiveB(bool y) {
    b[Q++] = y;

    if (Q % 20 == 0) {
        int v = 0, d = 0, s = Q - 20;

        for (int i = 0; i < 11; ++i) {
            v |= b[s + i] << i;
        }
        for (int i = 0; i < 9; ++i) {
            d |= b[s + 11 + i] << i;
        }

        S += d;
        used[v] = true;
        st.erase({dist[v], v});
        dist[v] = S;

        cerr << "B received: " << v << "; dist0 = " << S << "; diff = " << d << endl;

        for (auto [to, w] : adj[v]) {
            cerr << v << " " << to << " " << w << endl;
            if (!used[to] && dist[to] > dist[v] + w) {
                st.erase({dist[to], to});
                st.emplace(dist[to] = dist[v] + w, to);
            }
        }

        if (st.empty()) {
            for (int i = 0; i < 20; ++i) {
                SendB(0);
            }
        } else {
            auto [dis, to] = *st.begin();
            assert(dis >= S);
            assert(!used[to] && dis >= S);

            for (int i = 0; i < 11; ++i) {
                SendB(to >> i & 1);
            }
            for (int i = 0; i < 9; ++i) {
                SendB((dis - S) >> i & 1);
            }
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 10ms
memory: 4004kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 1 0 -1
1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 -1
1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 -1
0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 1 -1
0 1 0 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 0 0 -1
1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 -1...

output:

-1
0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 1 1 0 1 0 -1
1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 -1
1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 -1
0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 1 -1
0 1 0 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 0 0 -1
1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 -1
1 1 1 1 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 0...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 8
Accepted
time: 0ms
memory: 3856kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
-1
-1

output:

-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 0
Wrong Answer
time: 12ms
memory: 4064kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 -1
1 0 1 0 1 0 0 1 0 1 0 1 1 1 0 0 0 1 0 1 -1
0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 1 -1
1 0 0 1 1 0 0 1 0 0 1 1 1 1 0 0 0 0 1 0 -1
1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 -1
1 0 0 1 0 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 -1...

output:

-1
0 0 0 1 1 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 1 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 0 1 1 1...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #3:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 11ms
memory: 3956kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 -1
1 1 1 0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 -1
1 1 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 1 0 0 -1
1 0 1 0 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 -1
1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 -1
1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 0 0 -1...

output:

-1
1 0 1 0 1 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 -1
1 0 1 0 1 1 1 1 1 1 0 0 0 1 1 0 1 1 0 0 -1
1 0 1 0 1 1 1 1 1 1 0 0 1 0 1 0 1 1 0 0 -1
1 0 1 0 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 -1
1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 -1
1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 0 0 -1
1 1 0 1 0 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #4:

score: 38
Accepted

Test #24:

score: 38
Accepted
time: 4ms
memory: 4176kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0 -1
0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 0 1 1 1 0 -1
0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 0 -1
1 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 0 -1
1 0 0 1 1 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 -1
1 1 0 0 0 1 1 0 1 1 0 1 1 0 0 1 0 0 0 0 -1...

output:

-1
1 0 0 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0 -1
0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 0 1 1 1 0 -1
0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 0 -1
1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 1 -1
1 0 0 1 1 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 -1
1 1 0 0 0 1 1 0 1 1 0 1 1 0 0 1 0 0 0 0 -1
1 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 0 0 0...

input:


output:

0
1881
1737
1168
3083
3390
3240
1917
2761
3069
1616
1782
2120
1261
1381
1964
2536
2081
2469
1905
1175
2320
3849
2144
3819
2474
1769
3175
2218
3112
2407
2562
1266
1923
2468
1811
2501
2161
3587
1380
1928
2050
1753
2438
2193
2729
3206
3721
1096
1643
3010
2372
2816
3461
2515
2578
2019
705
2094
2798
1525...

result:

ok 900 lines

Test #25:

score: 38
Accepted
time: 7ms
memory: 3988kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 -1
1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 -1
1 0 1 0 0 1 1 1 0 1 0 0 1 1 0 0 0 0 0 0 -1
0 1 1 0 1 1 1 1 1 0 0 1 0 1 0 0 0 0 0 0 -1
1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 0 0 0 0 0 -1
1 1 1 0 1 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 -1...

output:

-1
0 0 0 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 -1
1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 -1
1 0 1 0 0 1 1 1 0 1 0 0 1 1 0 0 0 0 0 0 -1
0 1 1 0 1 1 1 1 1 0 0 1 0 1 0 0 0 0 0 0 -1
1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 0 0 0 0 0 -1
1 1 1 0 1 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 -1
1 1 0 1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0...

input:


output:

0
102
1819
640
785
3114
1460
1485
3249
2366
1600
629
2885
2097
2674
1950
3906
2266
3967
3495
2248
2822
3860
66
753
1648
4184
2735
807
2201
538
1711
3818
4350
1696
271
3801
2955
1175
3933
3620
913
2200
1439
2758
835
1547
1668
201
1805
3773
2654
907
3408
3704
4150
3022
1121
3613
2341
1261
2363
2718
42...

result:

ok 900 lines

Test #26:

score: 38
Accepted
time: 320ms
memory: 11248kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 -1
0 1 0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 -1
1 1 0 0 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 -1
0 1 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 -1
1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 -1
1 1 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 -1...

output:

-1
1 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 1 0 0 0 -1
1 0 0 1 0 1 0 1 1 0 0 1 1 0 0 0 1 0 0 0 -1
1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 0 0 0 0 -1
1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 0 0 0 -1
1 0 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 0 -1
0 1 0 0 1 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 -1
0 1 0 0 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0...

input:


output:

0
958
1664
390
858
3011
2944
682
2574
1091
1742
1661
443
458
2289
2450
2952
1189
2633
1799
1260
1162
1773
270
496
2428
1648
1741
1123
123
121
1238
2459
301
1317
2011
158
735
1351
25
1794
3034
876
2345
1558
613
2422
1681
2995
813
1299
2437
187
494
2734
2347
3053
975
674
1525
535
79
812
487
2017
2149
...

result:

ok 900 lines

Test #27:

score: 38
Accepted
time: 1ms
memory: 4236kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 1 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 1 -1
0 1 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 0 1 -1
1 1 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 1 -1
1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 1 -1
0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 1 0 -1
0 1 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 1 -1...

output:

-1
1 1 1 1 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 1 -1
0 1 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 0 1 -1
1 1 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 1 -1
1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 1 -1
0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 1 0 -1
0 1 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 1 -1
0 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 0 1...

input:


output:

0
218908
99957
228474
201934
283938
95330
71505
284830
48108
72755
157670
174806
63619
82171
50613
216342
128546
92374
115678
212495
19614
173452
182243
239168
171023
16304
300686
7352
39208
271252
166242
192010
54190
261551
137895
44491
165463
306440
65636
149301
257570
87294
88051
198315
53539
796...

result:

ok 900 lines

Test #28:

score: 38
Accepted
time: 279ms
memory: 9280kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 1 0 1 0 1 0 1 1 0 0 0 0 0 0 0 -1
1 1 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 -1
0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 -1
0 0 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 0 0 0 -1
0 1 0 0 0 0 1 0 0 1 0 1 1 1 0 0 0 0 0 0 -1
1 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 -1...

output:

-1
1 1 0 0 1 1 0 1 0 1 0 1 1 0 0 0 0 0 0 0 -1
1 0 0 1 1 0 1 0 1 1 0 0 1 1 0 1 1 0 0 0 -1
0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 -1
0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 0 0 0 0 -1
0 1 0 0 0 0 1 0 0 1 0 1 1 1 0 0 0 0 0 0 -1
1 0 0 0 1 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 -1
0 1 1 0 1 1 1 0 1 1 0 0 1 0 0 0 0 0 0 0...

input:


output:

0
883
2383
2370
2113
1520
666
3408
1994
482
3477
1876
467
1795
2951
2939
535
530
2433
550
1702
2607
2381
2425
847
3032
1293
1375
2847
43
3361
1828
2224
1744
1169
766
2704
1799
2100
1657
1676
3043
3186
803
3293
788
1564
2884
1602
3199
257
3314
228
121
272
93
1568
1641
429
1195
1364
1640
80
2077
979
9...

result:

ok 900 lines

Test #29:

score: 38
Accepted
time: 14ms
memory: 3868kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 1 1 0 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 -1
0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 -1
0 1 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 0 1 -1
1 1 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 1 -1
0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1 -1
1 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 -1...

output:

-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 1 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

input:


output:

0
254195
204724
119091
97169
161776
43101
290118
178213
204344
171556
20729
128866
253399
159707
176488
177264
14928
309186
7722
267342
63030
176726
250689
128579
274660
35373
92578
184511
109010
58998
254635
200113
300743
113313
234507
56172
258975
256003
149419
231641
36184
136692
249223
230383
21...

result:

ok 900 lines

Test #30:

score: 38
Accepted
time: 14ms
memory: 3956kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 -1
0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 1 0 0 1 -1
0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 -1
0 1 0 1 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 -1
1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 0 -1
1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 0 0 -1...

output:

-1
1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 -1
0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 1 0 0 1 -1
0 1 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 0 -1
0 1 0 1 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 -1
1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 0 -1
1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 0 0 -1
0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0...

input:


output:

0
25277
26805
15193
35909
44825
48971
4157
19379
18934
58040
56499
18305
37267
41159
15689
56551
33746
8192
7081
41964
31606
488
5159
11039
1231
11924
42328
45323
16351
26035
47328
5772
3436
43382
24053
33033
58005
8503
32728
51229
46034
52127
45183
22839
6672
11670
44298
24112
49712
1380
17322
5471...

result:

ok 899 lines

Test #31:

score: 38
Accepted
time: 14ms
memory: 4256kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 1 0 0 0 0 -1
1 1 1 1 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 0 -1
0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 -1
0 1 1 1 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 -1
0 1 0 0 0 0 1 0 1 1 0 1 0 0 1 1 0 0 0 0 -1
1 0 0 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 -1...

output:

-1
1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 1 0 0 0 0 -1
1 1 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 -1
0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 -1
0 1 1 1 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 -1
0 1 0 0 0 0 1 0 1 1 0 1 0 0 1 1 0 0 0 0 -1
0 0 0 1 0 0 1 0 0 0 0 0 0 1 1 1 0 1 1 0 -1
0 0 0 1 0 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0...

input:


output:

0
43507
25929
55747
2431
3576
37955
53713
13426
53622
13425
22518
60091
47411
52049
11708
5692
43483
18855
16072
45029
33518
23451
44394
7204
53193
21582
32062
30688
50100
31795
29498
40857
15537
21080
55173
24066
37834
39655
59219
30612
34288
31773
49561
52053
22220
36611
53251
43188
53180
21786
44...

result:

ok 900 lines

Test #32:

score: 38
Accepted
time: 100ms
memory: 7852kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 1 1 1 1 1 1 0 1 0 0 1 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1
1 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 0 1 0 1 0 0 0 0 0 0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 -1
1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0...

input:


output:

0
810
468
495
482
639
338
659
619
581
322
384
968
360
740
678
670
427
511
460
548
362
664
510
535
813
716
417
687
341
535
598
396
456
606
702
613
531
524
696
785
417
504
667
534
593
597
502
475
388
387
339
627
786
601
520
505
655
521
665
566
825
644
628
384
513
638
593
430
565
574
461
784
507
688
69...

result:

ok 899 lines

Test #37:

score: 38
Accepted
time: 1ms
memory: 3856kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
-1
-1

output:

-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
-1

input:


output:

0

result:

ok single line: '0'

Subtask #5:

score: 14
Accepted

Test #38:

score: 14
Accepted
time: 4ms
memory: 3880kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 0 0 -1
1 0 0 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 1 -1
1 0 0 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 1 1 1 1 1 0 0 0 1 0 1 1 0 0 0 -1
1 0 1 0 1 0 0 1 0 0 0 1 0 0 1 1 1 1 1 0 -1
0 0 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 0 1 -1...

output:

-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 1 -1
1 0 0 0 1 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 1 1 1 1 1 0 0 0 1 0 1 1 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 0 1 1 -1
0 1 1 0 1 0 1 0 0 1 0 0 1 1 1 1 1 1 0 0...

input:


output:

0
3467
3039
3862
3565
4266
3258
4604
3860
2661
3573
3113
2706
3757
4805
4448
4392
3163
3673
4568
3500
3334
3197
2491
4036
2868
3743
4219
2747
3122
3210
2314
3397
3285
2805
2031
2187
3950
3654
3459
3114
3197
1499
5106
3000
3488
3210
3597
4420
3511
4094
3802
3848
2962
4031
3068
4292
3084
4077
4153
407...

result:

ok 1100 lines

Test #39:

score: 14
Accepted
time: 0ms
memory: 3936kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 -1
1 0 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 0 0 0 -1
1 1 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 -1
0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 -1
0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 -1
0 1 1 0 1 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 -1...

output:

-1
1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 -1
1 0 1 1 0 0 0 0 0 1 0 1 1 1 0 0 1 0 1 0 -1
1 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 -1
1 0 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 -1
1 0 1 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0 -1
1 0 1 1 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 0 -1
1 0 1 1 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 0...

input:


output:

0
485
399
2142
681
2834
3651
3030
983
464
2014
2770
2896
691
1552
1351
213
2098
1101
1045
3762
3341
778
644
3199
1965
2409
3611
1656
812
3557
329
613
1997
1194
2828
3289
1513
2336
3551
2512
317
1189
3282
880
3169
1565
3554
637
764
294
1573
3516
3593
756
1533
2643
1941
1944
3766
84
538
2659
3720
21
2...

result:

ok 1100 lines

Test #40:

score: 14
Accepted
time: 6ms
memory: 3904kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 1 0 0 0 1 0 0 1 1 0 0 0 1 1 1 1 -1
0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 -1
1 1 0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 1 1 -1
0 0 0 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 1 1 -1
0 1 0 1 1 0 0 0 0 1 0 0 1 1 1 0 1 1 1 1 -1
1 0 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 1 1 1 -1...

output:

-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

input:


output:

0
210526
379348
30270
237071
524240
475727
459547
248812
335379
257106
398469
131103
219828
81790
511965
128693
170425
404799
477680
155716
337816
356356
346125
446801
82284
206625
383283
150289
57817
395524
346617
490398
326552
203201
92509
471818
114979
318729
122347
109099
175823
253216
192446
45...

result:

ok 1100 lines

Test #41:

score: 14
Accepted
time: 292ms
memory: 9168kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 -1
0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 -1
1 1 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 -1
0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 -1
0 1 0 1 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 -1
1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1...

output:

-1
1 0 0 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 -1
0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 -1
1 1 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 -1
0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 -1
0 1 0 1 0 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 -1
1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1
1 1 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 0 0 0...

input:


output:

0
2364
2591
4037
1605
414
3363
1276
5694
1847
3578
4251
5658
2844
3170
23
3702
764
1242
4358
1494
5117
3596
4418
5206
2620
3349
38
4961
502
4135
4230
2021
1158
2696
2980
5841
859
1554
5229
712
2959
4312
977
3236
985
5852
1880
349
4246
3956
2035
1665
4912
4142
2204
3493
3941
4442
4979
4782
3881
2721
...

result:

ok 1100 lines

Test #42:

score: 14
Accepted
time: 7ms
memory: 3956kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 -1
1 0 0 1 0 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 -1
0 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 1 1 1 1 -1
1 1 0 1 1 0 1 1 0 1 0 0 0 1 0 0 1 1 1 1 -1
1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 1 -1
1 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 -1...

output:

-1
1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 -1
1 0 0 1 0 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 -1
0 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 1 1 1 1 -1
1 1 0 1 1 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 -1
1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 1 -1
1 0 1 1 1 0 1 0 1 0 0 1 1 1 1 0 1 1 1 1 -1
0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1...

input:


output:

0
340247
281511
481199
261964
236970
75001
397977
168553
536533
231571
280526
143501
465039
472377
246251
164125
86247
100966
490973
58851
498320
214467
395518
138127
372035
252612
255060
509604
119520
377892
116589
42134
337782
524257
511573
244797
258498
23019
212502
202750
507150
454297
136661
15...

result:

ok 1100 lines

Test #43:

score: 14
Accepted
time: 276ms
memory: 9384kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 1 1 0 1 1 0 1 1 0 1 0 1 0 0 0 0 0 0 -1
0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 -1
1 1 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 -1
1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 -1
0 1 0 1 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 -1
1 0 0 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 -1...

output:

-1
1 0 0 1 0 0 1 0 0 0 0 1 1 0 1 1 0 0 0 0 -1
0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 -1
1 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 -1
1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 -1
1 0 0 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0 0 0 -1
1 0 0 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0...

input:


output:

0
2382
5419
4264
3453
2212
940
387
4911
331
4677
1520
2246
1426
857
5397
2323
1222
5442
958
324
4433
4019
2130
1505
962
3350
4920
2673
798
616
26
717
90
3526
884
4514
2573
1813
3136
4801
3004
3795
1591
4001
3992
3929
4084
2508
1760
450
2138
4441
744
2364
1115
4684
5241
4059
2548
3726
5293
1534
1780
...

result:

ok 1100 lines

Test #44:

score: 14
Accepted
time: 0ms
memory: 3972kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 0 -1
1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 1 0 0 -1
0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 1 0 0 0 0 -1
1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 1 0 0 0 0 -1
1 0 1 1 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0 0 -1
0 1 1 1 1 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 -1...

output:

-1
1 1 1 0 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 0 -1
0 0 1 0 1 1 0 1 0 1 0 1 1 1 0 1 1 0 0 1 -1
0 0 1 0 1 1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 -1
1 0 1 1 0 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 -1
1 0 1 1 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0 0 -1
0 1 1 1 1 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

input:


output:

0
56612
46646
70332
29956
46342
11842
17257
59957
40858
70493
22180
23014
49433
71497
6230
58197
55258
37226
38791
40531
57212
28743
46826
64193
43311
53343
28705
57981
53729
36109
14630
16707
68352
749
64100
39470
20223
58014
34874
28467
42764
6806
39240
21423
16155
51419
13259
47410
43258
8051
602...

result:

ok 1099 lines

Test #45:

score: 14
Accepted
time: 13ms
memory: 3932kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 -1
0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 -1
0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 -1
1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 0 0 0 0 0 -1
1 0 1 1 0 1 1 1 1 1 0 1 1 0 0 1 0 1 1 0 -1
1 1 1 1 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 0 -1...

output:

-1
0 0 1 0 0 1 1 1 0 1 0 1 0 0 0 0 1 1 1 0 -1
0 0 1 0 0 1 1 1 0 1 0 0 1 0 0 1 0 1 1 0 -1
0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 -1
1 0 1 0 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 -1
1 0 1 1 0 1 1 1 1 1 0 1 1 0 0 1 0 1 1 0 -1
1 1 1 1 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 0 -1
0 1 0 0 1 0 1 1 0 0 0 1 1 1 1 1 1 0 1 0...

input:


output:

0
13779
31463
50623
3014
16772
66071
45164
46748
851
25183
32310
36312
24768
39627
24518
72796
65480
57846
33639
33178
5571
29978
52735
57311
58959
19352
8162
21002
71234
77215
71183
11254
49123
68218
21300
10788
7964
75919
72172
32240
23160
64342
57922
15603
7913
50574
72859
50973
13531
13119
69870...

result:

ok 1100 lines

Test #46:

score: 14
Accepted
time: 139ms
memory: 9216kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 -1
1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 -1
1 0 1 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 -1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 0 0 -1
0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 -1
0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 0 1 0 0 0 -1
0 1 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 0 0 -1
0 1 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0...

input:


output:

0
557
342
401
405
567
510
647
494
715
369
504
915
441
524
270
490
581
333
406
480
350
404
499
726
362
695
943
362
534
536
292
394
421
888
428
483
370
526
461
432
422
542
360
580
481
559
474
221
524
296
524
176
352
743
461
381
556
407
260
280
392
361
540
275
345
455
571
520
559
619
422
329
481
520
54...

result:

ok 1098 lines

Subtask #6:

score: 10
Accepted

Test #51:

score: 10
Accepted
time: 16ms
memory: 4240kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 1 1 0 1 0 -1
0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 1 -1
1 1 1 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 -1
0 1 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 -1
1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 0 0 -1
0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 1 -1...

output:

-1
1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 1 1 0 1 0 -1
0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 1 -1
1 1 1 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 0 1 1 0 0 0 0 1 1 1 0 0 1 0 1 -1
1 0 0 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 0 0...

input:


output:

0
4745
3326
5133
4107
3809
4087
3569
3801
3371
5482
4438
4540
1609
3082
3493
5097
2942
4117
3617
3593
4172
4473
4646
2942
4752
2852
3739
4756
2996
4071
3100
3564
2168
4235
4849
4666
4920
5046
3687
4237
1693
3180
3644
4302
3744
3547
3893
5204
4387
3021
4202
4162
4068
4622
4081
4042
5002
3673
3223
271...

result:

ok 1400 lines

Test #52:

score: 10
Accepted
time: 10ms
memory: 4264kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 1 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 -1
1 1 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 -1
0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 -1
1 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 -1
0 1 1 0 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0 0 -1
1 0 1 0 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 0 -1...

output:

-1
1 1 1 1 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 -1
1 1 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 -1
0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 -1
1 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 -1
0 1 1 0 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0 0 -1
1 0 1 0 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 0 -1
0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 0 0...

input:


output:

0
1322
3847
7297
1111
1848
4534
963
6857
1143
5230
4985
6529
1758
4904
4743
1671
5896
622
466
2920
5036
2538
3118
2408
4402
4506
4191
736
942
2404
5008
3551
26
4793
4484
3567
2420
6757
3489
1112
130
4844
1859
81
570
5510
4544
2171
111
2224
1178
6304
4483
1088
886
3247
860
4292
4103
1817
1904
777
335...

result:

ok 1400 lines

Test #53:

score: 10
Accepted
time: 735ms
memory: 18112kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 1 1 0 1 1 1 1 0 0 0 1 0 0 0 0 0 0 0 -1
0 0 0 1 1 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 -1
1 1 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 -1
0 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 -1
1 1 1 1 0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 -1
1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 -1...

output:

-1
1 0 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 1 0 0 -1
1 0 0 0 1 1 0 1 1 1 0 0 1 1 1 1 0 0 0 0 -1
1 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 0 0 -1
1 0 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 0 0 0 -1
0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 -1
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 -1
0 0 0 1 0 1 1 0 1 0 1 1 0 1 1 0 0 0 0 0...

input:


output:

0
1946
1393
1639
22
1939
1656
99
1387
1834
778
1732
1696
340
1504
321
108
851
1055
613
477
640
175
1468
677
1652
1780
217
740
1675
1707
1399
456
1753
2007
1731
1431
1973
786
431
1781
1786
671
1679
1878
1140
293
202
1173
1663
122
1445
684
1408
1419
544
1906
574
1354
1816
763
1430
2022
313
2063
1312
4...

result:

ok 1400 lines

Test #54:

score: 10
Accepted
time: 4ms
memory: 4216kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 1 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 1 1 -1
0 1 1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 -1
0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 1 0 1 0 1 -1
1 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0 1 1 1 1 -1
1 0 1 1 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 1 -1
0 0 1 0 0 1 1 1 0 0 1 0 1 0 1 0 0 1 0 1 -1...

output:

-1
1 0 1 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 1 1 -1
0 1 1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 -1
0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 1 0 1 0 1 -1
1 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0 1 1 1 1 -1
1 0 1 1 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 1 -1
0 0 1 0 0 1 1 1 0 0 1 0 1 0 1 0 0 1 0 1 -1
0 1 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1...

input:


output:

0
123618
325605
373557
3095
215569
359767
181294
146617
121060
302418
513838
473825
269086
69788
284057
6553
75606
404330
516765
453617
52651
158846
499026
68510
206419
336405
242434
499675
427701
186572
243227
224127
366651
33353
218056
48482
282573
262550
67590
343717
215253
298648
231392
32103
26...

result:

ok 1400 lines

Test #55:

score: 10
Accepted
time: 570ms
memory: 15768kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 1 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 -1
1 0 0 1 1 0 1 0 1 0 0 0 1 1 0 0 0 0 0 0 -1
1 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 -1
0 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 0 -1
1 1 0 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 -1
0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 -1...

output:

-1
1 0 0 1 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 -1
1 1 0 1 1 0 1 1 1 1 0 0 0 1 1 1 0 0 0 0 -1
1 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 -1
1 1 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0 0 -1
1 1 0 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 -1
1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 0 0 0 0 0 -1
0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0...

input:


output:

0
1650
3059
720
1596
2577
2736
3880
3078
1459
4855
2403
2072
2522
3641
3990
1567
839
4302
2993
4384
2983
4335
1099
2239
2979
4083
813
701
264
3186
3267
3899
910
954
3921
1304
1804
3441
1535
3465
17
1429
4489
1948
1576
286
1731
2954
1824
1819
3677
487
2531
2316
1782
2440
3792
1997
3004
3688
3764
3477...

result:

ok 1400 lines

Test #56:

score: 10
Accepted
time: 10ms
memory: 3976kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 0 0 1 1 1 -1
0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 0 1 -1
0 1 0 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 0 1 -1
1 0 1 1 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 -1
0 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 1 0 1 1 -1
0 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 1 1 1 -1...

output:

-1
0 0 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 1 1 1 -1
0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 0 1 -1
0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 -1
1 0 1 1 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 -1
0 0 1 1 1 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 -1
0 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 1 1 1 -1
1 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 1 1...

input:


output:

0
527233
497614
191530
503517
341895
85570
251120
423540
438801
498571
283991
22733
233912
195995
495218
175149
185812
246238
188904
386751
430686
353390
510731
243441
384993
251774
493322
394709
472549
398352
151431
182166
165086
414181
331962
506183
220800
321331
336546
93905
144738
233014
181431
...

result:

ok 1400 lines

Test #57:

score: 10
Accepted
time: 16ms
memory: 3980kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 1 1 0 -1
1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 -1
1 1 0 0 0 1 1 0 1 0 0 1 0 1 1 1 0 1 0 0 -1
1 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 1 0 0 -1
0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 -1
0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 1 0 0 1 0 -1...

output:

-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 -1
1 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 1 1 0 -1
1 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 1 0 0 -1
0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 -1
0 0 1 0 0 0 1 1 0 1 0 1 1 0 1 1 1 0 1 0 -1
0 0 1 0 0 0 1 1 0 1 0 0 1 0 0 0 1 0 0 0...

input:


output:

0
69249
19894
27525
64030
80319
41290
57930
48962
22688
92119
91456
60910
63616
39416
89589
47172
2327
5537
93836
79736
56072
55686
42092
35822
15690
62806
69573
8603
14564
45026
53881
40807
35755
53735
27987
8072
64357
47639
54920
31083
42085
66808
76691
60047
68297
87353
44637
81350
67494
80034
66...

result:

ok 1399 lines

Test #58:

score: 10
Accepted
time: 5ms
memory: 4004kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 1 1 0 -1
1 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 -1
0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 -1
1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 0 0 0 0 0 -1
0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 -1
0 1 0 1 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 -1...

output:

-1
0 0 0 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 0 1 -1
0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 0 0 0 1 0 -1
0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 0 -1
1 0 1 1 1 0 1 0 1 0 0 0 0 1 1 1 0 1 0 0...

input:


output:

0
65671
51954
46989
27975
8965
27506
40881
85961
65485
17036
87269
43194
74200
87320
62891
4522
82878
75702
70199
68611
6557
72291
63344
47119
34643
49412
67486
32317
52613
73069
31475
32366
41140
63802
49819
52326
16653
64978
78765
58085
18859
18100
19683
38035
71330
88431
2255
54092
61603
19358
89...

result:

ok 1400 lines

Test #59:

score: 10
Accepted
time: 130ms
memory: 9272kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 -1
1 1 0 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 -1
0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1
0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -1...

output:

-1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

input:


output:

0
9
9
6
6
10
10
9
6
10
9
9
10
8
8
9
10
8
10
7
9
8
9
9
9
10
3
11
8
8
9
9
8
10
10
10
10
11
7
9
7
7
5
8
10
9
11
7
8
10
7
10
10
8
10
10
9
8
10
10
9
7
8
8
8
10
8
7
8
9
7
9
9
9
7
7
6
10
3
7
7
10
6
9
11
7
7
10
8
10
11
8
7
10
9
2
10
8
12
8
8
8
10
11
9
8
10
10
9
8
8
9
8
8
6
9
7
9
12
9
9
9
9
9
10
9
10
10
7
12...

result:

ok 1400 lines

Test #60:

score: 10
Accepted
time: 1221ms
memory: 27604kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 -1
1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1
1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 -1
1 1 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0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 0 0 1 0 0 0 0 0 -1
1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 -1
0 1 0 0 0 1 1 1 1 0 0 1 1 0 0 1 0 1 0 0...

input:


output:

0
938
1076
1300
1046
1024
1161
962
890
1357
1166
908
1077
1049
1192
1103
1194
998
1234
977
1135
1164
1158
1064
763
1090
976
1366
1023
1121
768
1257
1201
1065
902
885
1003
1038
778
1086
1007
1160
972
1179
1129
816
1132
968
1249
1189
1110
718
1141
925
1126
1055
1184
1322
926
1070
1150
941
1207
1141
11...

result:

ok 1399 lines

Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 0
Wrong Answer
time: 14ms
memory: 4160kb

input:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 0 1 0 1 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 -1
1 1 0 0 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 1 -1
1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 1 0 1 1 1 -1
1 0 1 0 1 0 1 0 0 0 1 0 1 1 0 0 1 1 0 0 -1
0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 0 -1
0 1 0 1 0 1 0 0 0 0 0 1 0 1 1 1 1 1 0 0 -1...

output:

-1
0 0 1 0 1 1 1 0 0 0 1 1 1 0 0 1 1 1 1 1 -1
1 1 0 0 1 1 0 0 0 0 1 1 1 0 0 1 1 1 1 1 -1
1 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 1 1 1 -1
1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 -1
0 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 0 0 0 1 -1
0 1 0 1 0 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 -1
0 1 0 0 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1...

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''