QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#948466#10155. Bit Counting SequenceSorahISAAC ✓18ms7400kbC++237.9kb2025-03-23 05:28:062025-03-23 05:28:06

Judging History

This is the latest submission verdict.

  • [2025-03-23 05:28:06]
  • Judged
  • Verdict: AC
  • Time: 18ms
  • Memory: 7400kb
  • [2025-03-23 05:28:06]
  • Submitted

answer

#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA

void solve() {
    int N; cin >> N;
    
    vector<int> A(N);
    for (int &x : A) cin >> x;
    
    auto p = [&](int x) -> int { return __builtin_popcountll(x); };
    
    int ans = 0;
    for (int i = 1, ex = 1, lst_d = -1; i < N; ++ex) {
        int d = A[0] + ex - A[i];
        if (d <= lst_d) { print(-1); return; }
        // debug(i, d);
        
        for (int j = 1; j < (int(1)<<d) and i + j < N; ++j) {
            if (A[i+j] != A[i] + p(j)) { print(-1); return; }
        }
        
        ans = (int(1) << d) + N - i - 1;
        i += (int(1) << d);
        lst_d = d;
    }
    
    int ex = A[N-1] - p(ans);
    // debug(ans, p(ans), A[N-1], ex);
    if (ex < 0) { print(-1); return; }
    
    int hbit = (ans ? __lg(ans) : -1);
    while (ex--) ans |= (int(1) << ++hbit);
    
    ans -= N - 1;
    print(ans);
}

int32_t main() {
    fastIO();
    
    int t = 1; cin >> t;
    for (int _ = 1; _ <= t; ++_) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
    
    return 0;
}

#else

#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;

using i64 = long long;
using i128 = __int128;
#define int i64
using f80 = long double;
using f128 = __float128;
#define double f80
using pii = pair<int, int>;
template <typename T> using Prior = std::priority_queue<T>;
template <typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>;

// #define X first
// #define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define SZ(x) ((int)(x).size())

template <size_t D, typename T> struct Vec : vector<Vec<D-1, T>> {
    static_assert(D >= 1, "Vector dimension must be greater than zero!");
    template <typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D-1, T>>(n, Vec<D-1, T>(args...)) {}
};

template <typename T> struct Vec<1, T> : vector<T> {
    Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
};

template <class F>
inline constexpr decltype(auto) lambda_fix(F&& f) {
    return [f = std::forward<F>(f)](auto&&... args) {
        return f(f, std::forward<decltype(args)>(args)...);
    };
}

#ifdef local
#define fastIO() void()
#define debug(...) \
    _color.emplace_back("\u001b[31m"), \
    fprintf(stderr, "%sAt [%s], line %d: (%s) = ", _color.back().c_str(), __FUNCTION__, __LINE__, #__VA_ARGS__), \
    _do(__VA_ARGS__), _color.pop_back(), \
    fprintf(stderr, "%s", _color.back().c_str())
#define print(...) \
    fprintf(stdout, "%s", "\u001b[36m"), \
    _P(__VA_ARGS__), \
    fprintf(stdout, "%s", "\u001b[0m")

deque<string> _color{"\u001b[0m"};

template <typename T> concept is_string = is_same_v<T, string&> or is_same_v<T, const string&>;
template <typename T> concept is_iterable = requires (T _t) {begin(_t);};

template <typename T> inline void _print_err(T &&_t);
template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t);
template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu);

inline void _do() {cerr << "\n";};
template <typename T> inline void _do(T &&_t) {_print_err(_t), cerr << "\n";}
template <typename T, typename ...U> inline void _do(T &&_t, U &&..._u) {_print_err(_t), cerr << ", ", _do(_u...);}
#else
#define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
#define debug(...) void()
#define print(...) _P(__VA_ARGS__)
#endif

inline void _P() {cout << "\n";};
template <typename T> inline void _P(T &&_t) {cout << _t << "\n";}
template <typename T, typename ...U> inline void _P(T &&_t, U &&..._u) {cout << _t << " ", _P(_u...);}

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline int getRand(int L, int R) {
    if (L > R) swap(L, R);
    return (int)(rng() % ((uint64_t)R - L + 1) + L);
}

template <typename T, typename U> bool chmin(T &lhs, U rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename T, typename U> bool chmax(T &lhs, U rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}

/// below are Fast I/O and _print_err templates ///

/*
/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///

#include <unistd.h>

const int S = 65536;

int OP = 0;
char OB[S];

inline char RC() {
    static char buf[S], *p = buf, *q = buf;
    return p == q and (q = (p = buf) + read(0, buf, S)) == buf ? -1 : *p++;
}

inline int RI() {
    static char c;
    int a;
    while (((c = RC()) < '0' or c > '9') and c != '-' and c != -1);
    if (c == '-') {
        a = 0;
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a -= c ^ '0';
    }
    else {
        a = c ^ '0';
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a += c ^ '0';
    }
    return a;
}

inline void WI(int n, char c = '\n') {
    static char buf[20], p;
    if (n == 0) OB[OP++] = '0';
    p = 0;
    if (n < 0) {
        OB[OP++] = '-';
        while (n) buf[p++] = '0' - (n % 10), n /= 10;
    }
    else {
        while (n) buf[p++] = '0' + (n % 10), n /= 10;
    }
    for (--p; p >= 0; --p) OB[OP++] = buf[p];
    OB[OP++] = c;
    if (OP > S-20) write(1, OB, OP), OP = 0;
}

/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
*/

#ifdef local

template <typename T> inline void _print_err(T &&_t) {cerr << _t;}

template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>) {
    string _tmp_color = _color.back();
    ++_tmp_color[3], _color.emplace_back(_tmp_color);
    cerr << _color.back() << "[";
    for (bool _first = true; auto &_x : _t) {
        if (!_first) cerr << ", ";
        _print_err(_x), _first = false;
    }
    cerr << "]" << (_color.pop_back(), _color.back());
}

template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu) {
    string _tmp_color = _color.back();
    ++_tmp_color[3], _color.emplace_back(_tmp_color);
    cerr << _color.back() << "(";
    _print_err(_tu.first), cerr << ", ", _print_err(_tu.second);
    cerr << ")" << (_color.pop_back(), _color.back());
    return os;
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t) {
    if (!I) {
        string _tmp_color = _color.back();
        ++_tmp_color[3], _color.emplace_back(_tmp_color);
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t) {
    if (!I) {
        string _tmp_color = _color.back();
        ++_tmp_color[3], _color.emplace_back(_tmp_color);
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

#endif

#endif

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3712kb

input:

4
5
3 3 4 1 2
3
2 1 2
2
60 60
2
8 0

output:

13
3
2305843009213693949
-1

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 18ms
memory: 7396kb

input:

1
500000
9 9 10 9 10 10 11 8 9 9 10 9 10 10 11 9 10 10 11 10 11 11 12 8 9 9 10 9 10 10 11 9 10 10 11 10 11 11 12 9 10 10 11 10 11 11 12 10 11 11 12 11 12 12 13 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 4 5 5 6 5 6 6 7 5 6 6 7 6 7 7 8 4 5 5 6 5 6 6 7 5 6 6 7 6 7 7 8 5 6 6 7 6 7 7 8 6 7 7 8 7 8 8 9 4 5 5 6 5 6 ...

output:

100297

result:

ok single line: '100297'

Test #3:

score: 0
Accepted
time: 5ms
memory: 3712kb

input:

1000
33
2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3
209
3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 ...

output:

5
11
10
15
17
3
17
2
2
7
4
4
10
1
17
10
19
13
3
4
7
4
7
15
8
14
15
8
3
17
2
12
1
11
16
4
12
4
2
5
7
19
12
2
7
3
10
2
0
0
11
7
10
7
1
3
11
16
9
9
15
15
1
2
16
9
9
5
9
19
8
17
7
15
2
12
16
2
6
17
8
16
3
7
14
6
4
18
3
10
11
3
1
14
8
16
10
12
19
8
1
12
19
4
2
12
8
10
6
8
7
7
1
15
12
18
8
4
8
5
4
12
10
1...

result:

ok 1000 lines

Test #4:

score: 0
Accepted
time: 4ms
memory: 3584kb

input:

1000
115
2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3
81
2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 ...

output:

17
10
9
8
9
0
19
16
14
10
16
9
10
13
8
7
19
16
5
2
3
16
13
0
5
15
12
5
9
11
9
6
14
19
5
13
10
9
16
11
15
0
12
7
6
19
4
10
5
15
3
13
10
8
8
7
19
19
15
6
2
19
9
2
7
6
14
6
4
9
19
3
17
10
3
16
7
5
3
12
18
14
1
2
14
0
5
1
11
17
14
2
0
5
8
9
4
17
16
19
6
18
4
2
1
4
12
7
11
6
5
4
2
1
8
19
6
11
14
19
14
3
...

result:

ok 1000 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

61
1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
1
10
1
11
1
12
1
13
1
14
1
15
1
16
1
17
1
18
1
19
1
20
1
21
1
22
1
23
1
24
1
25
1
26
1
27
1
28
1
29
1
30
1
31
1
32
1
33
1
34
1
35
1
36
1
37
1
38
1
39
1
40
1
41
1
42
1
43
1
44
1
45
1
46
1
47
1
48
1
49
1
50
1
51
1
52
1
53
1
54
1
55
1
56
1
57
1
58
1
59
1
60

output:

0
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823
2147483647
4294967295
8589934591
17179869183
34359738367
68719476735
137438953471
274877906943
549755813887
1099...

result:

ok 61 lines

Test #6:

score: 0
Accepted
time: 16ms
memory: 7400kb

input:

1
500000
27 28 28 29 28 29 29 30 27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 28 29 29 30 29 30 30 31 29 30 30 31 30 31 31 32 27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 28 29 29 30 29 30 30 31 29 30 30 31 30 31 31 32 28 29 29 30 29 30 30 31 29 ...

output:

1099510361352

result:

ok single line: '1099510361352'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

625
4
0 0 0 0
4
0 0 0 1
4
0 0 0 2
4
0 0 0 3
4
0 0 0 4
4
0 0 1 0
4
0 0 1 1
4
0 0 1 2
4
0 0 1 3
4
0 0 1 4
4
0 0 2 0
4
0 0 2 1
4
0 0 2 2
4
0 0 2 3
4
0 0 2 4
4
0 0 3 0
4
0 0 3 1
4
0 0 3 2
4
0 0 3 3
4
0 0 3 4
4
0 0 4 0
4
0 0 4 1
4
0 0 4 2
4
0 0 4 3
4
0 0 4 4
4
0 1 0 0
4
0 1 0 1
4
0 1 0 2
4
0 1 0 3
4
0 1 ...

output:

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

result:

ok 625 lines

Test #8:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

1000
50
26 27 26 27 27 28 26 27 27 28 27 28 28 29 25 26 26 27 26 27 27 28 26 27 27 28 27 28 28 29 26 27 27 28 27 28 28 29 27 28 28 29 28 29 29 30 1 2 2 3
50
20 19 20 20 21 16 17 17 18 17 18 18 19 17 18 18 19 18 19 19 20 17 18 18 19 18 19 19 20 18 19 19 20 19 20 20 21 17 18 18 19 18 19 19 20 18 19 19...

output:

1073741778
4194235
966
32711
148
77
8589934589
71
8388560
8140
4065
288230376151711688
1073741786
68719476713
8589934562
45
35184372088784
75
-1
4078
16777149
4294967235
137438953454
8388584
32753
17592186044351
35184372088795
16777194
4027
144
76
2199023255509
134217708
131048
147
2251799813685220
...

result:

ok 1000 lines

Test #9:

score: 0
Accepted
time: 4ms
memory: 3712kb

input:

1000
50
4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5
50
5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 2 3 3 4 3 4 4 5 3
50
19 19 20 18 19 19 20 19 20 20 21 18 19 19 20 19 20 20 21 19 20 20 21 20 21 21 22 1 2 2...

output:

75
151
4194277
8796093022151
39
4398046511099
56
1099511627742
36028797018963963
144115188075855797
72057594037927931
576460752303423456
-1
2097107
1099511627716
16777161
997
32700
2251799813685224
1125899906842599
149
9007199254740974
144115188075855815
151
153
36028797018963889
156
67108831
112589...

result:

ok 1000 lines

Test #10:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

1000
50
12 12 13 10 11 11 12 11 12 12 13 11 12 12 13 12 13 13 14 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5
50
18 17 18 18 19 17 18 18 19 18 19 19 20 17 18 18 19 18 19 19 20 18 19 19 20 19 20 20 21 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3
50
19 18 19 19 20 18 19 19 20 19 20 20 21...

output:

16365
2097123
4194227
146
8168
80
149
8138
1125899906842576
281474976710623
143
144115188075855810
274877906875
246
67108842
32701
73
140737488355254
562949953421234
35184372088827
21
2199023255475
18014398509481934
70368744177659
68
2251799813685205
1048541
2147483639
32738
34359738299
900719925474...

result:

ok 1000 lines

Test #11:

score: 0
Accepted
time: 16ms
memory: 7396kb

input:

1
500000
32 32 33 32 33 33 34 30 31 31 32 31 32 32 33 31 32 32 33 32 33 33 34 31 32 32 33 32 33 33 34 32 33 33 34 33 34 34 35 30 31 31 32 31 32 32 33 31 32 32 33 32 33 33 34 31 32 32 33 32 33 33 34 32 33 33 34 33 34 34 35 31 32 32 33 32 33 33 34 32 33 33 34 33 34 34 35 32 33 33 34 33 34 34 35 33 34 ...

output:

-1

result:

ok single line: '-1'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1000
50
33 32 33 33 34 32 33 33 34 33 34 34 35 32 33 33 34 33 34 34 35 33 34 34 35 34 35 35 36 31 32 32 33 32 33 33 34 32 33 33 34 33 34 34 35 32 33 33 34 33
50
37 38 37 38 38 39 37 38 38 39 38 39 39 40 37 38 38 39 38 39 39 40 38 39 39 40 39 40 40 41 37 38 38 39 38 39 39 40 38 39 39 40 39 40 40 41 3...

output:

137438953379
4398046511042
4194171
17179869085
274877906782
68719476630
4294967236
8589926351
4398046510832
68719476666
549755813809
268435401
17179868920
549755813776
34359738255
68719476566
2147481576
134217675
4294967167
137438953390
268435399
2147483471
17179869093
68719476631
4294967184
8589934...

result:

ok 1000 lines

Test #13:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000
20
59 59 5 8 56 42 0 55 2 49 35 51 31 37 23 58 14 44 45 42
20
34 36 58 41 60 31 17 6 14 4 28 27 13 17 41 26 2 21 17 53
20
60 40 6 10 43 47 15 58 36 53 58 24 3 40 33 11 19 20 25 48
20
49 35 41 8 14 25 21 44 9 23 6 31 22 37 49 50 18 58 11 51
20
15 56 24 51 5 6 46 0 48 29 41 30 5 29 54 59 21 19 53...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 1000 lines

Test #14:

score: 0
Accepted
time: 4ms
memory: 3712kb

input:

1000
280
1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3...

output:

16
16
11
6
10
5
14
0
2
18
3
6
19
7
17
13
7
18
18
4
0
16
0
3
17
1
10
14
3
0
5
11
6
10
2
13
0
14
0
8
3
8
13
8
7
18
7
19
9
1
9
19
0
16
6
17
17
1
6
9
11
5
12
19
7
11
4
7
1
9
13
4
16
13
9
19
8
4
1
4
12
18
4
8
14
16
17
1
16
5
1
7
10
9
13
9
3
14
16
17
9
16
10
4
12
16
1
16
4
15
1
0
12
18
10
6
13
16
15
6
12
...

result:

ok 1000 lines

Test #15:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1000
2
32 48
2
32 49
2
32 50
2
32 51
2
32 52
2
32 53
2
32 54
2
32 55
2
32 56
2
32 57
2
32 58
2
32 59
2
32 60
2
33 0
2
33 1
2
33 2
2
33 3
2
33 4
2
33 5
2
33 6
2
33 7
2
33 8
2
33 9
2
33 10
2
33 11
2
33 12
2
33 13
2
33 14
2
33 15
2
33 16
2
33 17
2
33 18
2
33 19
2
33 20
2
33 21
2
33 22
2
33 23
2
33 24
2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
8589934591
12884901887
15032385535
16106127359
16642998271
16911433727
17045651455
17112760319
17146314751
17163091967
17171480575
17175674879
17177772031
17178820607
17179344895
17179607039
17179738111
17179803647
17179836415
17179852799
17179860991
1717986...

result:

ok 1000 lines

Test #16:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

721
2
49 11
2
49 12
2
49 13
2
49 14
2
49 15
2
49 16
2
49 17
2
49 18
2
49 19
2
49 20
2
49 21
2
49 22
2
49 23
2
49 24
2
49 25
2
49 26
2
49 27
2
49 28
2
49 29
2
49 30
2
49 31
2
49 32
2
49 33
2
49 34
2
49 35
2
49 36
2
49 37
2
49 38
2
49 39
2
49 40
2
49 41
2
49 42
2
49 43
2
49 44
2
49 45
2
49 46
2
49 47
...

output:

1125350151028735
1125625028935679
1125762467889151
1125831187365887
1125865547104255
1125882726973439
1125891316908031
1125895611875327
1125897759358975
1125898833100799
1125899369971711
1125899638407167
1125899772624895
1125899839733759
1125899873288191
1125899890065407
1125899898454015
11258999026...

result:

ok 721 lines

Test #17:

score: 0
Accepted
time: 16ms
memory: 7396kb

input:

1
500000
26 27 25 26 26 27 26 27 27 28 23 24 24 25 24 25 25 26 24 25 25 26 25 26 26 27 24 25 25 26 25 26 26 27 25 26 26 27 26 27 27 28 24 25 25 26 25 26 26 27 25 26 26 27 26 27 27 28 25 26 26 27 26 27 27 28 26 27 27 28 27 28 28 29 21 22 22 23 22 23 23 24 22 23 23 24 23 24 24 25 22 23 23 24 23 24 24 ...

output:

68718964150

result:

ok single line: '68718964150'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

243
5
0 0 0 0 0
5
0 0 0 0 1
5
0 0 0 0 2
5
0 0 0 1 0
5
0 0 0 1 1
5
0 0 0 1 2
5
0 0 0 2 0
5
0 0 0 2 1
5
0 0 0 2 2
5
0 0 1 0 0
5
0 0 1 0 1
5
0 0 1 0 2
5
0 0 1 1 0
5
0 0 1 1 1
5
0 0 1 1 2
5
0 0 1 2 0
5
0 0 1 2 1
5
0 0 1 2 2
5
0 0 2 0 0
5
0 0 2 0 1
5
0 0 2 0 2
5
0 0 2 1 0
5
0 0 2 1 1
5
0 0 2 1 2
5
0 0 2 ...

output:

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

result:

ok 243 lines

Test #19:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

1000
50
26 27 22 23 23 24 23 24 24 25 23 24 24 25 24 25 25 26 23 24 24 25 24 25 25 26 24 25 25 26 25 26 26 27 23 24 24 25 24 25 25 26 24 25 25 26 25 26 26 27
50
39 40 40 41 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5
50
28 29 28 29 29 30 27 28 28 29 28...

output:

268435390
2199023255548
2147483626
134217724
4503599627370430
67108835
71
73
155
73
67108826
2027
65483
1073741754
68719476712
149
4194284
67108863
151
268435413
524270
34359738346
36028797018963912
8388543
70368744177653
33554368
288230376151711718
549755813885
262065
576460752303423467
1
71
67
140...

result:

ok 1000 lines

Test #20:

score: 0
Accepted
time: 17ms
memory: 7396kb

input:

1
500000
30 31 31 32 31 32 32 33 31 32 32 33 32 33 33 34 31 32 32 33 32 33 33 34 32 33 33 34 33 34 34 35 31 32 32 33 32 33 33 34 32 33 33 34 33 34 34 35 32 33 33 34 33 34 34 35 33 34 34 35 34 35 35 36 31 32 32 33 32 33 33 34 32 33 33 34 33 34 34 35 32 33 33 34 33 34 34 35 33 34 34 35 34 35 35 36 32 ...

output:

562949952897024

result:

ok single line: '562949952897024'

Test #21:

score: 0
Accepted
time: 17ms
memory: 7268kb

input:

1
500000
52 52 53 52 53 53 54 50 51 51 52 51 52 52 53 51 52 52 53 52 53 53 54 51 52 52 53 52 53 53 54 52 53 53 54 53 54 54 55 45 46 46 47 46 47 47 48 46 47 47 48 47 48 48 49 46 47 47 48 47 48 48 49 47 48 48 49 48 49 49 50 46 47 47 48 47 48 48 49 47 48 48 49 48 49 49 50 47 48 48 49 48 49 49 50 48 49 ...

output:

576460752303138777

result:

ok single line: '576460752303138777'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1000
2
16 24
2
16 25
2
16 26
2
16 27
2
16 28
2
16 29
2
16 30
2
16 31
2
16 32
2
16 33
2
16 34
2
16 35
2
16 36
2
16 37
2
16 38
2
16 39
2
16 40
2
16 41
2
16 42
2
16 43
2
16 44
2
16 45
2
16 46
2
16 47
2
16 48
2
16 49
2
16 50
2
16 51
2
16 52
2
16 53
2
16 54
2
16 55
2
16 56
2
16 57
2
16 58
2
16 59
2
16 60...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
131071
196607
229375
245759
253951
258047
260095
261119
261631
261887
262015
262079
262111
262127
262135
262139
262141
262142
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 1000 lines

Test #23:

score: 0
Accepted
time: 5ms
memory: 3840kb

input:

1000
181
2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4...

output:

5
18
11
9
5
5
15
7
3
11
1
14
0
4
12
4
12
2
17
18
13
2
19
17
1
12
18
0
17
16
10
17
11
9
3
6
1
0
14
11
3
6
14
0
13
14
2
15
5
9
15
12
9
0
4
19
4
15
3
4
7
7
5
8
2
12
12
9
15
6
13
12
14
18
0
1
0
9
12
4
9
8
4
7
8
4
16
11
13
8
3
8
6
8
15
4
0
9
19
17
17
12
11
17
0
10
11
17
1
19
14
1
5
0
12
0
1
3
8
5
16
11
9...

result:

ok 1000 lines

Test #24:

score: 0
Accepted
time: 15ms
memory: 7264kb

input:

1
500000
25 46 53 47 29 46 34 39 0 4 52 37 39 27 26 29 48 47 44 44 15 58 40 60 23 46 0 29 59 20 18 50 22 0 52 50 30 17 60 20 21 37 53 55 37 8 36 23 37 42 44 27 20 21 18 58 46 26 50 0 29 9 30 33 10 1 55 12 31 55 54 35 2 58 43 49 58 30 46 11 52 45 8 57 39 18 52 48 40 28 8 34 20 21 60 43 47 0 19 30 12 ...

output:

-1

result:

ok single line: '-1'

Test #25:

score: 0
Accepted
time: 17ms
memory: 7396kb

input:

1
500000
49 50 49 50 50 51 49 50 50 51 50 51 51 52 49 50 50 51 50 51 51 52 50 51 51 52 51 52 52 53 46 47 47 48 47 48 48 49 47 48 48 49 48 49 49 50 47 48 48 49 48 49 49 50 48 49 49 50 49 50 50 51 47 48 48 49 48 49 49 50 48 49 49 50 49 50 50 51 48 49 49 50 49 50 50 51 49 50 50 51 50 51 51 52 47 48 48 ...

output:

576460752303124706

result:

ok single line: '576460752303124706'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

600
50
19 20 18 19 19 20 19 20 20 21 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5
50
44 44 45 42 43 43 44 43 44 44 45 43 44 44 45 44 45 45 46 42 43 43 44 43 44 44 45 43 44 44 45 44 45 45 46 43 44 44 45 44 45 45 46 44 45 45 46 45 46 46
50
15 15 16 15 16 16 17 14 15 ...

output:

2097142
140737488355277
524233
69
281474976710631
157
65507
16777207
8796093022172
156
1099511627727
1048533
155
262125
281474976710622
147
4398046511040
2008
549755813878
150
9007199254740986
1125899906842599
8388529
281474976710593
68
16777160
288230376151711716
145
73
9007199254740967
71
152
3355...

result:

ok 600 lines

Test #27:

score: 0
Accepted
time: 15ms
memory: 7356kb

input:

1
500000
31 31 32 30 31 31 32 31 32 32 33 29 30 30 31 30 31 31 32 30 31 31 32 31 32 32 33 30 31 31 32 31 32 32 33 31 32 32 33 32 33 33 34 26 27 27 28 27 28 28 29 27 28 28 29 28 29 29 30 27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 28 29 29 30 29 30 ...

output:

-1

result:

ok single line: '-1'

Test #28:

score: 0
Accepted
time: 18ms
memory: 7396kb

input:

1
500000
11 8 9 9 10 9 10 10 11 9 10 10 11 10 11 11 12 8 9 9 10 9 10 10 11 9 10 10 11 10 11 11 12 9 10 10 11 10 11 11 12 10 11 11 12 11 12 12 13 7 8 8 9 8 9 9 10 8 9 9 10 9 10 10 11 8 9 9 10 9 10 10 11 9 10 10 11 10 11 11 12 8 9 9 10 9 10 10 11 9 10 10 11 10 11 11 12 9 10 10 11 10 11 11 12 10 11 11 ...

output:

347471

result:

ok single line: '347471'

Test #29:

score: 0
Accepted
time: 4ms
memory: 3712kb

input:

1000
71
3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4
77
2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5...

output:

13
6
6
6
10
18
5
17
18
1
5
19
12
6
13
6
14
15
18
7
7
8
14
9
10
13
8
14
7
11
11
19
17
16
6
19
7
6
8
9
17
18
12
1
19
6
16
15
16
8
18
17
19
5
8
15
7
1
17
5
14
12
5
17
19
8
0
8
19
6
16
13
13
2
13
12
18
6
15
17
5
4
11
6
4
1
11
4
19
3
7
14
1
2
3
11
19
11
18
6
4
2
1
5
19
13
2
6
6
3
0
16
4
7
3
16
11
6
0
8
1...

result:

ok 1000 lines

Test #30:

score: 0
Accepted
time: 16ms
memory: 7392kb

input:

1
500000
6 6 7 6 7 7 8 5 6 6 7 6 7 7 8 6 7 7 8 7 8 8 9 5 6 6 7 6 7 7 8 6 7 7 8 7 8 8 9 6 7 7 8 7 8 8 9 7 8 8 9 8 9 9 10 5 6 6 7 6 7 7 8 6 7 7 8 7 8 8 9 6 7 7 8 7 8 8 9 7 8 8 9 8 9 9 10 6 7 7 8 7 8 8 9 7 8 8 9 8 9 9 10 7 8 8 9 8 9 9 10 8 9 9 10 9 10 10 11 5 6 6 7 6 7 7 8 6 7 7 8 7 8 8 9 6 7 7 8 7 8 8...

output:

132873

result:

ok single line: '132873'

Test #31:

score: 0
Accepted
time: 17ms
memory: 7264kb

input:

1
500000
31 32 32 33 32 33 33 34 27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 28 29 29 30 29 30 30 31 29 30 30 31 30 31 31 32 28 29 29 30 29 30 30 31 29 30 30 31 30 31 31 32 29 30 30 31 30 31 31 32 30 31 31 32 31 32 32 33 28 29 29 30 29 30 30 31 29 30 30 31 30 31 31 32 29 30 30 31 30 31 31 32 30 ...

output:

-1

result:

ok single line: '-1'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1000
50
2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5
50
15 14 15 15 16 14 15 15 16 15 16 16 17 14 15 15 16 15 16 16 17 15 16 16 17 16 17 17 18 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3
50
25 26 23 24 24 25 24 25 25 26 24 25 25 26 25 26 26 27 23 ...

output:

72
262115
268435406
8388602
16777195
35184372088757
510
17179869143
8796093022143
69
2046
67108838
72057594037927863
65509
4294967250
268435424
75
2044
71
78
262106
155
34359738319
549755813822
144115188075855847
9007199254740945
140737488355314
576460752303423483
274877906894
131052
1022
76
2199023...

result:

ok 1000 lines

Test #33:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

1000
50
27 28 27 28 28 29 26 27 27 28 27 28 28 29 27 28 28 29 28 29 29 30 26 27 27 28 27 28 28 29 27 28 28 29 28 29 29 30 27 28 28 29 28 29 29 30 28 29 29 30
50
28 28 29 26 27 27 28 27 28 28 29 27 28 28 29 28 29 29 30 26 27 27 28 27 28 28 29 27 28 28 29 28 29 29 30 27 28 28 29 28 29 29 30 28 29 29 3...

output:

2147483594
2147483597
8589934453
68719476632
536870830
34359738276
137438953394
34359738298
268435392
4294967158
1073741535
4294967211
68719476436
2147483598
8589934501
4294967188
2147483573
34359738296
4294967186
4294967135
68719476642
2147483561
2147483513
17179869031
2147483542
274877906858
85899...

result:

ok 1000 lines

Test #34:

score: 0
Accepted
time: 5ms
memory: 3840kb

input:

1000
2
1 2
185
2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6 3 4 4 5 4 5 5 6 4 5 5 6 5 6 6 7 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3...

output:

2
3
6
0
18
19
9
7
3
18
4
4
13
8
5
9
9
9
10
3
16
6
3
8
9
19
2
18
19
19
11
19
12
3
17
15
13
5
1
17
0
17
17
14
18
6
19
9
19
10
13
15
4
10
16
16
18
2
12
7
1
7
16
16
15
6
6
15
13
10
11
6
1
5
12
14
18
2
9
16
4
7
7
3
1
14
7
8
1
11
19
11
18
11
8
7
1
18
19
2
18
19
6
9
12
18
0
6
15
16
19
16
1
1
7
8
19
7
11
14...

result:

ok 1000 lines

Test #35:

score: 0
Accepted
time: 3ms
memory: 3584kb

input:

1000
50
37 38 36 37 37 38 37 38 38 39 36 37 37 38 37 38 38 39 37 38 38 39 38 39 39 40 34 35 35 36 35 36 36 37 35 36 36 37 36 37 37 38 35 36 36 37 36 37 37 38
50
27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 27 28 28 29 28 29 29 30 28 29 29 30 29 30 30 31 28 29 29 30 29 30 30 31 29 30 30 31 30 31 3...

output:

2199023255398
8589934480
137438953385
137438953360
17179869123
68719476679
34359738218
34359738229
2147483515
137438953362
8589934537
34359738262
8589934516
8589934460
68719476565
68719475666
137438953411
4294967245
68719476597
8589934490
1073741764
8589934539
8589934497
4294967130
2199023255404
214...

result:

ok 1000 lines

Test #36:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

61
20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
20
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
20
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
20
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
20
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
20
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 61 lines

Test #37:

score: 0
Accepted
time: 17ms
memory: 7400kb

input:

1
500000
45 46 45 46 46 47 45 46 46 47 46 47 47 48 44 45 45 46 45 46 46 47 45 46 46 47 46 47 47 48 45 46 46 47 46 47 47 48 46 47 47 48 47 48 48 49 44 45 45 46 45 46 46 47 45 46 46 47 46 47 47 48 45 46 46 47 46 47 47 48 46 47 47 48 47 48 48 49 45 46 46 47 46 47 47 48 46 47 47 48 47 48 48 49 46 47 47 ...

output:

576460752302940306

result:

ok single line: '576460752302940306'

Test #38:

score: 0
Accepted
time: 16ms
memory: 7396kb

input:

1
500000
24 25 25 26 25 26 26 27 23 24 24 25 24 25 25 26 24 25 25 26 25 26 26 27 24 25 25 26 25 26 26 27 25 26 26 27 26 27 27 28 23 24 24 25 24 25 25 26 24 25 25 26 25 26 26 27 24 25 25 26 25 26 26 27 25 26 26 27 26 27 27 28 24 25 25 26 25 26 26 27 25 26 26 27 26 27 27 28 25 26 26 27 26 27 27 28 26 ...

output:

34358875928

result:

ok single line: '34358875928'

Test #39:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000
2
0 0
2
0 1
2
0 2
2
0 3
2
0 4
2
0 5
2
0 6
2
0 7
2
0 8
2
0 9
2
0 10
2
0 11
2
0 12
2
0 13
2
0 14
2
0 15
2
0 16
2
0 17
2
0 18
2
0 19
2
0 20
2
0 21
2
0 22
2
0 23
2
0 24
2
0 25
2
0 26
2
0 27
2
0 28
2
0 29
2
0 30
2
0 31
2
0 32
2
0 33
2
0 34
2
0 35
2
0 36
2
0 37
2
0 38
2
0 39
2
0 40
2
0 41
2
0 42
2
0 ...

output:

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

result:

ok 1000 lines

Test #40:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1000
3
0 0 0
3
0 0 1
3
0 0 2
3
0 0 3
3
0 0 4
3
0 0 5
3
0 0 6
3
0 0 7
3
0 0 8
3
0 0 9
3
0 1 0
3
0 1 1
3
0 1 2
3
0 1 3
3
0 1 4
3
0 1 5
3
0 1 6
3
0 1 7
3
0 1 8
3
0 1 9
3
0 2 0
3
0 2 1
3
0 2 2
3
0 2 3
3
0 2 4
3
0 2 5
3
0 2 6
3
0 2 7
3
0 2 8
3
0 2 9
3
0 3 0
3
0 3 1
3
0 3 2
3
0 3 3
3
0 3 4
3
0 3 5
3
0 3 6...

output:

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

result:

ok 1000 lines

Test #41:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1000
50
47 47 48 46 47 47 48 47 48 48 49 44 45 45 46 45 46 46 47 45 46 46 47 46 47 47 48 45 46 46 47 46 47 47 48 46 47 47 48 47 48 48 49 45 46 46 47 46 47 47
50
29 30 30 31 30 31 31 32 30 31 31 32 31 32 32 33 30 31 31 32 31 32 32 33 31 32 32 33 32 33 33 34 30 31 31 32 31 32 32 33 31 32 32 33 32 33 3...

output:

1125899906842549
34359738304
148
69
75
274877906923
33554399
8122
67108815
536870881
71
77
147
8796093022136
147
76
140737488355255
32719
106
78
9007199254740961
562949953421271
68
2199023255480
134217667
66
4075
4294967267
8796093022174
1099511627703
288230376151711714
1073741782
151
137438953444
2...

result:

ok 1000 lines