QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#599438#9432. Permutationucup-team3635#AC ✓302ms3844kbC++2313.4kb2024-09-29 04:48:012024-09-29 04:48:07

Judging History

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

  • [2024-09-29 04:48:07]
  • 评测
  • 测评结果:AC
  • 用时:302ms
  • 内存:3844kb
  • [2024-09-29 04:48:01]
  • 提交

answer

#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA

void solve() {
    int N; cin >> N;
    
#ifdef duipai
    vector<int> ANSWER(N); iota(ALL(ANSWER), 1);
    shuffle(ALL(ANSWER), rng);
#endif
    
    vector<int> pos(N+1, 0), guess(N);
    
    int n_operation = 0;
    auto query = [&](bool answer = false) -> optional<int> {
        ++n_operation;
#ifdef duipai
        int _n_match = 0;
        for (int i = 0; i < N; ++i) _n_match += (guess[i] == ANSWER[i]);
        if (!answer) return _n_match;
        debug(N, _n_match);
#else
        cout << (answer ? 1 : 0) << " ";
        copy(ALL(guess), experimental::make_ostream_joiner(cout, " "));
        cout << "\n" << flush;
        if (!answer) {
            int ret; cin >> ret;
            return ret;
        }
#endif
        debug(n_operation);
        return nullopt;
    };
    
    if (N <= 3) {
        iota(ALL(guess), 1);
        do {
            if (query().value() == N) { query(true); break; }
        } while (next_permutation(ALL(guess)));
        return;
    }
    
    vector<int> perm(N); iota(ALL(perm), 1);
    for (int b = __lg(N-1); b >= 1; --b) {
        shuffle(ALL(perm), rng);
        
        int i = 0, lst = 0;
        while (i+1 < N) {
            for (int j = 0; j < N; ++j) guess[j] = perm[i + (j >> b & 1)];
            int ret = query().value();
            if (ret == 0) {
                for (int p = i+0; p >= lst; --p) {
                    pos[perm[p]] |= (1 << b);
                    // debug("known"s, perm[p]);
                }
                lst = (i += 2);
            }
            if (ret == 2) {
                pos[perm[i+1]] |= (1 << b);
                // debug("known"s, perm[i+1]);
                lst = (i += 2);
            }
            if (ret == 1) {
                ++i;
            }
        }
        if (i == N-1) {
            for (int j = 0; j < N; ++j) guess[j] = perm[((j >> b & 1) ? (N-1) & 1 : N-1)];
            int ret = query().value();
            if (ret == 0) {
                for (int p = N-1; p >= lst; --p) {
                    pos[perm[p]] |= (1 << b);
                    // debug("known"s, perm[p]);
                }
            }
            if (ret == 2) {
                /// nothing
            }
            if (ret == 1) {
                for (int p = N-1; p >= lst; --p) {
                    pos[perm[p]] |= ((pos[perm[(N-1)&1]] >> b & 1) << b);
                    // debug("known"s, perm[p]);
                }
            }
        }
        // debug(pos);
    }
    
    for (int i = 0; i+1 < N; i += 2) {
        vector<int> val;
        for (int p = 0; p < N; ++p) { if (pos[perm[p]] == i) val.eb(p); }
        assert(SZ(val) == 2);
        fill(ALL(guess), perm[val[0]]);
        guess[i+1] = perm[val[1]];
        if (query().value() == 2) ++pos[perm[val[1]]];
        else                      ++pos[perm[val[0]]];
    }
    // debug(pos);
    
    for (int i = 1; i <= N; ++i) guess[pos[i]] = i;
    
    query(true);
}

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>
#include <experimental/iterator>
using namespace std;
// #include <bits/extc++.h>
// #include <tr2/dynamic_bitset>

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) {}
// };

#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

/**
 *                                                                                                                 
 *                                                                                                                 
 *                                                                                                                 
 *                            iiiiii         iiiiiiiiii       iiiiiiiiiiiiii                                       
 *                       iiiiiiiiiiiii   iiiiiii    iiii    iiiiiiiiiiiiiii                          ii   iiii     
 *                    iiiiiiii     iiiiiiiii         iiii       iiii iii              iii          iiiiiiiiii      
 *                 iiiiiii          iiiiii           iiii    iiii   ii           iiiiiiiiii      iiii iiii         
 *               iiiiii            iiiii             iiii iiii        iii      iiii    iiiiiiiiiiiiiiiii  ii       
 *             iiiiii            iiiiiii            iiiiiii       iiiiiiii   iii    iiiiiiiiiiiiii iii  iiii       
 *           iiiiii             iiiiiii            iiiii   ii   iiii       iiiiiiiiiii iiii  iii iiii iiii      iii
 *          iiiii              iiiiiiii       ii        iiiii iiii    iiiiiiiii        iii iii  iii  iii  ii  iiii 
 *        iiiiii              iiiiiiii      iiiii     iiiii iiiiiiiiiiiiiiii         iii  iii  ii  iii  iii iiii   
 *       iiiii                 iiiiii     iiii     iiiiii iiiiiii    iii iii       iiii  ii   i   ii  iii  iii     
 *     iiiiii                            iiii  iiiiiiiiiiiiiii       iii iiii   iiiii  iii  ii  iii  iii  ii       
 *    iiiii                              iiiiiiii iiiiiiiiii       iiii   iiiiiiiii            ii  iii  ii         
 *   iiiii                                     iiiiii  iiii      iiiii              iii      ii   ii  i            
 * iiiiii                                  iiiiiiii   iiiii    iiiii                        ii  ii   ii            
 * iiiii                                iiii  iiii    iiiiiiiiiiii                             ii                  
 *  iii                              iiii   iiii       iiiiiiii                                                    
 *                                iiiii   iiii                                                                     
 *                              iiii     iiii                                                                      
 *                            iiii    iiiii                                                                        
 *                          iii     iiiii                                                                          
 *                        iii     iiiii                                                                            
 *                       iii   iiiiii                                                                              
 *                       iiiiiiiii                                                                                 
 *                       iiiiii                                                                                    
 *                                                                                                                 
 *                                                                                                                 
 *                                                                                                                 
**/

詳細信息

Test #1:

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

input:

5
0
1
1
2
0
2
2
0
0

output:

0 5 5 5 5 4
0 2 2 2 2 1
0 1 1 1 1 3
0 3 3 3 3 5
0 1 1 4 4 1
0 5 5 2 2 5
0 3 3 1 1 3
0 4 3 4 4 4
0 1 1 1 2 1
1 3 4 2 1 5

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 302ms
memory: 3588kb

input:

1000
0
1
1
2
1
2
2
0
0
1
0
2
2
2
1
2
2
0
2
1
2
1
1
1
1
1
1
2
1
1
2
1
2
1
1
0
2
0
1
2
1
0
1
2
1
1
1
0
2
0
1
1
1
2
1
1
2
2
2
0
1
1
2
1
0
0
0
1
1
0
2
1
1
1
1
2
1
1
0
1
1
1
1
1
1
0
1
2
2
1
0
1
2
1
1
0
1
0
0
1
1
0
1
0
1
2
1
0
1
1
1
1
1
2
1
1
1
1
1
0
0
2
0
2
0
2
1
2
2
1
0
1
2
1
1
1
1
1
1
2
0
1
1
0
2
2
2
2...

output:

0 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 404 40...

result:

ok Accepted

Test #3:

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

input:

1
1

output:

0 1
1 1

result:

ok Accepted

Test #4:

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

input:

2
0
2

output:

0 1 2
0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
1
1
0
3

output:

0 1 2 3
0 1 3 2
0 2 1 3
0 2 3 1
0 3 1 2
1 3 1 2

result:

ok Accepted

Test #6:

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

input:

4
1
2
0
0
0

output:

0 4 4 3 3
0 3 3 1 1
0 2 2 3 3
0 4 3 4 4
0 1 1 1 2
1 3 4 2 1

result:

ok Accepted

Test #7:

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

input:

6
2
0
1
2
1
1
1
2
0
2
0
2

output:

0 4 4 4 4 5 5
0 6 6 6 6 1 1
0 2 2 2 2 3 3
0 3 3 3 3 5 5
0 3 3 4 4 3 3
0 4 4 6 6 4 4
0 6 6 5 5 6 6
0 5 5 1 1 5 5
0 2 2 4 4 2 2
0 3 4 3 3 3 3
0 1 1 1 2 1 1
0 6 6 6 6 6 5
1 3 4 2 1 6 5

result:

ok Accepted

Test #8:

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

input:

7
2
2
0
1
2
0
1
2
2
0
0

output:

0 7 7 7 7 6 6 6
0 3 3 3 3 4 4 4
0 5 5 5 5 2 2 2
0 1 1 1 1 7 7 7
0 3 3 1 1 3 3 1
0 2 2 5 5 2 2 5
0 7 7 6 6 7 7 6
0 6 6 4 4 6 6 4
0 3 7 3 3 3 3 3
0 1 1 1 2 1 1 1
0 5 5 5 5 5 6 5
1 3 7 2 1 6 5 4

result:

ok Accepted

Test #9:

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

input:

8
0
0
2
0
1
0
0
0
2
2
2
2
2

output:

0 5 5 5 5 1 1 1 1
0 4 4 4 4 2 2 2 2
0 3 3 3 3 6 6 6 6
0 8 8 8 8 7 7 7 7
0 2 2 1 1 2 2 1 1
0 1 1 3 3 1 1 3 3
0 4 4 6 6 4 4 6 6
0 8 8 5 5 8 8 5 5
0 7 7 1 1 7 7 1 1
0 3 7 3 3 3 3 3 3
0 2 2 2 1 2 2 2 2
0 6 6 6 6 6 5 6 6
0 4 4 4 4 4 4 4 8
1 3 7 2 1 6 5 4 8

result:

ok Accepted

Test #10:

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

input:

9
1
1
1
1
1
1
2
1
2
0
0
0
1
1
2
0
1
0
1
2
2
2
0

output:

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

result:

ok Accepted

Test #11:

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

input:

10
1
1
1
2
0
1
1
1
0
1
2
2
2
1
2
2
2
1
2
2
2
0
2
2
2

output:

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

result:

ok Accepted

Test #12:

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

input:

11
2
0
1
1
2
1
1
1
1
1
2
1
1
2
1
0
1
0
1
0
1
1
1
2
2
2
0
2
0

output:

0 5 5 5 5 5 5 5 5 2 2 2
0 6 6 6 6 6 6 6 6 9 9 9
0 4 4 4 4 4 4 4 4 1 1 1
0 1 1 1 1 1 1 1 1 7 7 7
0 7 7 7 7 7 7 7 7 8 8 8
0 10 10 10 10 10 10 10 10 11 11 11
0 11 11 11 11 11 11 11 11 3 3 3
0 3 3 3 3 3 3 3 3 5 5 5
0 7 7 7 7 6 6 6 6 7 7 7
0 6 6 6 6 10 10 10 10 6 6 6
0 10 10 10 10 9 9 9 9 10 10 10
0 3 3 ...

result:

ok Accepted

Test #13:

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

input:

12
1
1
2
0
2
1
1
2
1
1
1
0
1
1
1
1
1
1
2
0
1
0
1
2
2
2
0
0
2
2
2
0

output:

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

result:

ok Accepted

Test #14:

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

input:

13
2
1
2
2
2
2
1
1
1
2
0
1
1
1
2
0
0
0
2
2
0
0
1
2
0
0
0
2
2
0

output:

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

result:

ok Accepted

Test #15:

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

input:

14
1
1
0
2
1
1
2
1
2
2
1
2
1
1
1
0
1
1
2
1
1
0
1
1
0
1
1
1
1
2
2
0
0
2
0
2
2
2

output:

0 8 8 8 8 8 8 8 8 3 3 3 3 3 3
0 3 3 3 3 3 3 3 3 5 5 5 5 5 5
0 5 5 5 5 5 5 5 5 13 13 13 13 13 13
0 4 4 4 4 4 4 4 4 2 2 2 2 2 2
0 11 11 11 11 11 11 11 11 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 9 9 9 9 9 9
0 9 9 9 9 9 9 9 9 12 12 12 12 12 12
0 7 7 7 7 7 7 7 7 14 14 14 14 14 14
0 14 14 14 14 14 14 14 14 6 6 6 6 ...

result:

ok Accepted

Test #16:

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

input:

15
2
2
0
2
1
0
0
1
1
1
1
0
0
2
1
1
2
1
2
2
2
2
2
1
1
1
2
1
0
2
2
0
0
2
0
0

output:

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

result:

ok Accepted

Test #17:

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

input:

975
0
1
0
1
1
0
1
2
0
0
1
0
0
0
1
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
0
0
1
0
2
2
1
1
2
1
1
1
0
1
0
1
2
0
0
0
1
1
1
2
2
2
1
0
1
0
2
2
1
2
0
0
1
1
0
1
1
2
1
0
2
1
1
1
1
1
2
2
0
1
1
0
1
2
1
1
2
0
0
2
2
1
1
1
2
2
1
1
1
1
1
1
1
0
1
0
0
1
0
2
2
1
0
0
0
2
0
1
2
2
0
1
0
1
1
1
0
2
1
1
0
0
1
2
1
1
0
0
1
1
0
0
1
2
...

output:

0 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 16...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 262ms
memory: 3828kb

input:

976
1
1
1
1
1
0
1
2
2
1
0
0
1
1
2
0
1
0
2
1
0
1
1
1
2
2
1
1
0
0
0
1
1
0
0
1
1
2
0
0
1
1
0
1
1
1
1
2
0
1
1
2
2
1
2
1
1
1
1
0
2
2
1
1
2
1
1
2
0
1
1
2
0
1
1
1
1
0
0
1
2
1
2
1
0
0
1
2
2
0
2
2
1
2
1
2
2
0
1
0
1
2
2
1
1
0
1
1
2
0
2
0
1
1
1
1
0
2
1
2
2
1
1
1
2
0
2
0
1
1
1
0
1
1
1
2
2
1
1
2
2
2
1
1
1
1
2
1
...

output:

0 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 75...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 263ms
memory: 3672kb

input:

977
2
0
1
0
0
0
0
1
2
2
1
0
2
1
2
2
2
2
0
2
1
2
2
0
1
1
2
1
1
1
1
0
1
0
1
1
2
1
2
1
0
0
1
0
0
0
0
2
1
0
0
1
0
2
1
1
1
1
1
1
1
2
1
1
1
1
1
2
0
2
1
0
1
0
1
1
1
1
1
1
1
1
2
2
2
0
1
1
2
2
2
1
2
1
2
1
1
2
0
1
2
1
1
1
2
1
0
1
0
1
2
2
1
2
2
1
0
1
2
1
2
1
0
0
0
1
1
1
1
1
0
0
1
2
1
1
2
0
1
0
1
1
1
0
2
0
1
2
...

output:

0 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 562 56...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 263ms
memory: 3608kb

input:

978
0
2
0
2
1
1
1
2
1
0
1
1
1
2
1
1
2
0
2
0
0
1
2
2
2
1
0
1
2
1
0
0
1
0
1
0
2
1
2
1
1
2
0
2
2
1
1
1
2
2
1
2
0
1
0
2
2
1
1
0
2
1
0
0
1
1
2
0
1
2
0
1
1
1
2
1
1
1
2
1
0
2
0
1
1
2
1
1
2
0
1
1
0
2
1
2
0
1
1
2
1
1
1
1
0
1
2
0
2
1
2
1
2
1
1
1
2
1
1
0
2
1
1
2
0
1
0
0
1
1
2
2
1
0
1
1
1
1
2
2
1
1
2
2
0
0
1
1
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 273ms
memory: 3604kb

input:

979
1
1
1
0
0
0
1
1
0
0
2
0
2
2
1
2
1
1
2
2
2
0
1
1
1
1
2
2
1
0
2
1
2
1
1
0
0
2
2
0
2
1
0
1
0
2
1
1
0
2
0
1
1
0
1
1
1
2
2
1
1
2
1
1
1
1
1
1
2
1
0
2
1
0
1
1
0
0
1
0
0
1
1
1
2
1
1
2
1
1
1
2
0
1
1
2
1
1
0
2
1
2
2
1
0
1
1
2
1
0
1
1
0
0
1
2
1
0
1
0
2
1
1
2
1
2
0
1
2
0
2
1
1
2
2
1
1
1
0
0
0
0
0
2
2
0
2
2
...

output:

0 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 538 53...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 262ms
memory: 3648kb

input:

980
1
2
2
1
0
1
0
1
1
1
2
0
1
2
1
2
0
2
1
2
0
0
1
1
2
2
1
0
1
1
1
2
2
1
2
1
1
1
1
1
1
2
2
0
0
2
2
2
0
1
2
1
2
1
1
0
1
1
2
2
0
0
1
1
2
0
1
2
0
1
2
1
2
1
1
1
0
2
0
0
1
1
1
2
0
1
1
0
1
1
1
1
1
1
2
2
1
1
1
0
2
0
1
1
1
2
1
2
2
1
1
2
0
0
2
0
2
1
1
1
0
2
2
2
0
0
1
1
1
0
2
1
1
0
0
1
2
2
2
1
1
2
1
1
0
1
2
1
...

output:

0 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 25...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 257ms
memory: 3552kb

input:

981
2
2
2
2
1
0
0
0
1
0
0
1
0
1
1
1
1
1
1
0
1
2
2
2
1
2
0
1
1
1
1
1
2
1
1
1
1
0
0
1
1
0
0
2
1
1
2
0
2
0
2
1
1
2
1
1
1
2
2
0
1
1
2
0
2
1
1
1
1
1
0
1
1
1
2
2
2
1
1
1
0
1
1
1
1
0
1
2
1
1
2
0
1
0
0
1
1
1
0
1
1
1
2
1
2
1
2
1
0
1
0
0
1
1
1
0
2
1
1
2
1
1
2
0
0
2
1
1
1
0
2
1
1
1
2
2
1
1
0
1
1
1
2
1
1
0
2
1
...

output:

0 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 972 97...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 284ms
memory: 3552kb

input:

982
0
0
1
1
2
2
2
2
1
1
2
2
1
1
0
2
0
0
2
0
2
1
1
0
2
2
1
1
1
1
1
1
1
1
2
2
1
1
1
0
1
0
1
1
0
2
1
1
1
1
1
2
2
1
0
2
0
0
1
1
1
1
2
1
1
1
1
2
1
0
0
2
2
1
0
1
2
1
1
1
0
1
2
1
1
2
2
0
1
2
1
0
1
0
1
1
2
0
0
1
0
1
2
2
0
1
1
2
0
0
1
0
1
0
1
2
1
2
1
1
1
1
2
2
0
1
1
0
1
1
1
0
0
1
1
2
1
2
1
0
2
1
0
1
1
2
1
2
...

output:

0 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 537 53...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 299ms
memory: 3808kb

input:

983
1
1
1
1
1
0
0
2
2
1
1
2
1
1
2
1
1
1
1
2
1
0
2
1
1
0
1
0
1
1
2
0
2
1
1
1
2
1
1
0
1
1
0
2
1
1
0
1
0
0
1
1
1
0
1
0
1
1
1
2
1
1
1
1
1
2
2
0
1
0
2
1
2
1
1
1
0
1
0
0
1
2
1
0
1
2
2
1
0
0
0
1
1
0
0
1
1
2
0
1
0
1
0
1
0
1
2
1
1
1
0
1
1
1
2
2
0
0
1
1
1
0
0
0
2
1
1
0
0
2
2
1
1
1
1
0
2
1
1
2
0
0
2
2
1
1
1
2
...

output:

0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 255ms
memory: 3664kb

input:

984
2
1
1
2
1
1
0
2
1
0
0
2
1
2
1
1
1
1
0
0
0
1
2
2
2
1
0
1
1
1
1
1
1
1
1
1
0
1
1
2
0
0
1
0
0
0
0
2
1
0
0
1
1
1
1
1
1
1
1
1
2
0
1
1
1
1
2
2
1
0
1
0
1
2
2
1
1
2
1
1
0
2
1
0
1
0
1
1
1
2
1
2
0
1
1
2
2
0
1
0
1
1
1
0
2
1
0
1
1
1
1
2
0
0
0
0
1
0
0
1
1
1
1
1
1
0
1
1
2
1
2
2
0
1
0
0
0
1
1
0
0
1
0
1
0
1
1
0
...

output:

0 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 31...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 272ms
memory: 3836kb

input:

985
2
2
0
0
1
1
1
2
1
2
1
1
1
2
1
1
0
0
1
0
1
2
0
1
0
1
0
0
2
0
0
1
2
1
1
2
1
1
0
0
1
2
2
1
0
2
0
0
1
1
2
1
2
1
1
0
0
2
0
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
0
0
1
2
1
1
0
1
1
0
1
1
1
1
1
1
1
2
0
1
2
2
0
1
1
1
1
1
2
0
1
1
1
0
1
2
1
1
1
1
0
1
2
1
2
0
1
1
1
1
2
0
1
0
0
1
0
1
1
2
0
1
0
1
1
1
1
0
1
1
2
0
1
0
...

output:

0 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 274 27...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 246ms
memory: 3544kb

input:

986
1
1
2
2
1
0
0
1
2
2
0
0
1
1
0
0
0
1
0
1
1
1
1
1
1
2
2
1
1
1
1
0
1
0
2
2
0
1
1
1
2
2
1
0
1
1
1
2
0
1
1
1
1
2
2
1
0
1
1
2
1
0
1
2
2
1
1
1
1
0
0
1
2
0
1
1
1
0
0
1
2
1
0
0
0
1
2
2
1
1
1
0
2
1
2
1
1
1
2
1
1
1
1
1
1
1
1
2
0
1
1
2
1
2
2
1
0
2
0
2
0
1
2
2
1
1
2
0
1
1
2
1
1
1
1
0
0
1
0
2
0
1
1
1
1
1
0
1
...

output:

0 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 905 90...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 257ms
memory: 3832kb

input:

987
1
1
0
1
2
0
2
1
1
1
1
1
2
0
0
0
2
0
1
2
1
1
1
2
1
0
2
2
1
2
1
0
1
1
0
0
0
1
2
2
1
1
0
0
2
0
2
1
1
0
1
1
1
1
0
1
2
1
1
1
1
0
1
1
0
1
0
2
0
2
0
1
1
2
1
1
0
0
1
1
1
1
0
2
1
0
0
2
1
1
1
1
0
2
1
1
1
0
1
1
2
2
2
1
2
1
1
1
0
0
1
1
1
2
0
0
1
1
0
2
2
0
2
0
0
2
2
1
1
1
2
2
2
2
2
1
2
1
0
0
0
0
0
0
1
1
0
0
...

output:

0 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 9...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 274ms
memory: 3588kb

input:

988
0
2
2
0
1
2
1
1
2
2
0
0
2
1
1
2
0
1
1
1
2
1
2
1
2
0
0
2
1
1
1
0
1
1
2
2
1
1
2
1
1
1
1
2
1
1
1
1
1
1
2
2
0
0
2
0
1
1
2
0
1
1
1
0
0
2
1
2
1
2
0
0
0
1
0
2
1
2
1
2
0
1
2
2
1
1
2
2
1
2
1
1
0
1
1
1
1
2
1
1
1
0
2
1
0
1
2
0
0
1
1
0
0
1
1
1
1
0
1
2
1
2
0
0
2
1
1
0
2
1
1
1
1
1
2
0
1
1
1
2
1
2
1
1
0
2
0
2
...

output:

0 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 18...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 284ms
memory: 3808kb

input:

989
0
2
1
1
1
1
0
1
1
1
1
1
0
1
1
2
0
1
1
1
1
2
0
2
0
1
0
2
1
1
0
1
0
0
2
2
1
0
2
1
1
1
2
1
0
0
1
1
2
2
1
2
2
0
1
1
1
0
1
1
2
0
2
1
1
1
2
0
2
1
2
1
1
1
1
1
1
1
2
2
2
1
2
2
2
2
0
0
2
0
1
1
0
2
1
2
2
0
2
0
1
2
1
1
2
0
0
1
1
0
1
2
2
0
0
1
0
1
1
2
0
1
2
1
0
1
1
1
1
2
1
0
1
1
1
1
1
1
2
0
2
2
0
0
1
1
1
1
...

output:

0 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 185 18...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 282ms
memory: 3608kb

input:

990
1
0
2
0
1
0
2
1
1
2
0
1
2
1
2
2
1
0
0
0
0
0
1
0
2
1
2
0
0
1
2
0
0
1
2
1
0
1
1
1
1
1
1
2
0
1
1
2
0
0
1
0
0
2
0
0
1
1
0
1
1
1
2
1
1
2
1
2
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
0
1
1
0
2
0
2
1
0
1
1
0
0
1
2
1
1
1
1
2
1
2
1
2
0
1
0
1
2
0
0
2
1
0
0
1
1
0
1
2
2
2
0
1
1
1
0
2
0
2
2
1
1
1
1
1
2
1
0
1
1
0
2
1
1
...

output:

0 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 71...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 289ms
memory: 3836kb

input:

991
0
0
0
1
0
1
0
2
2
1
1
1
1
1
0
2
1
1
2
1
1
1
2
1
0
1
1
2
2
0
1
0
0
1
0
1
2
0
1
2
1
2
0
0
2
1
1
1
1
0
2
0
1
1
0
1
1
1
2
1
1
1
0
0
2
0
0
1
1
1
0
2
1
2
1
0
0
0
1
0
1
1
2
1
1
1
1
1
1
0
1
1
1
0
2
1
2
2
1
2
1
1
1
0
2
0
2
1
0
1
2
1
0
2
0
1
1
0
0
1
1
0
0
1
1
0
1
1
0
1
2
1
0
2
1
0
2
1
0
0
1
1
1
0
0
0
1
1
...

output:

0 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 530 53...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 282ms
memory: 3612kb

input:

992
1
0
2
1
2
2
1
1
2
1
1
2
1
2
1
2
1
0
0
1
2
2
1
1
2
1
1
1
1
2
1
1
2
2
1
2
0
0
2
0
1
1
1
0
1
0
0
1
2
1
1
0
1
1
0
0
1
1
2
0
1
1
1
1
1
2
1
0
2
1
0
0
0
2
0
2
1
0
2
0
2
1
2
2
2
2
2
2
0
1
0
2
2
2
0
2
2
0
1
2
1
1
1
0
0
1
2
0
1
1
1
2
2
1
1
1
0
1
1
0
0
0
1
1
1
1
1
2
1
2
2
1
1
1
1
1
2
0
0
1
1
1
1
0
1
0
1
2
...

output:

0 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 316 31...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 265ms
memory: 3804kb

input:

993
1
1
0
1
0
0
1
2
2
0
2
1
2
1
2
1
0
2
1
1
1
1
1
0
1
1
1
2
0
1
1
1
1
1
0
1
1
2
2
2
1
1
2
1
1
0
2
0
1
1
2
2
0
0
1
1
1
1
1
2
1
1
0
2
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
2
2
2
1
2
1
1
2
2
1
1
1
1
0
0
1
1
2
2
1
1
0
1
1
1
1
1
0
1
2
2
2
1
2
2
1
2
1
0
1
0
2
0
2
1
2
1
2
1
1
0
1
1
0
2
1
0
1
2
1
2
1
1
1
0
1
2
0
0
...

output:

0 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 880 88...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 267ms
memory: 3608kb

input:

994
1
0
0
1
0
1
0
1
1
0
1
1
1
0
1
2
1
1
2
0
2
1
1
2
1
1
1
1
1
2
1
0
2
0
1
1
0
1
0
1
0
1
1
0
2
1
0
2
2
1
0
2
1
2
0
2
1
0
2
0
1
1
2
0
2
2
2
1
0
2
0
0
1
1
0
2
1
2
1
0
0
1
2
2
2
1
1
1
1
1
1
1
0
2
0
0
1
2
0
1
0
1
1
2
2
0
1
2
1
2
2
0
1
1
0
1
0
0
0
0
2
1
1
0
1
0
1
2
1
1
2
0
2
1
2
1
0
0
1
1
1
1
1
1
1
2
1
1
...

output:

0 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 259 25...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 294ms
memory: 3844kb

input:

995
2
1
0
1
2
1
0
1
1
1
2
1
1
1
0
1
0
0
1
2
1
0
0
2
2
0
1
2
1
2
1
2
0
1
0
1
2
0
1
1
1
0
1
1
0
1
0
0
1
1
1
1
0
1
2
1
2
0
2
2
0
0
0
1
1
2
1
1
2
2
1
1
2
2
2
1
1
0
0
2
1
1
2
0
2
1
0
0
2
0
1
1
1
1
2
0
1
1
1
2
1
2
0
0
1
0
1
1
2
1
1
1
2
1
0
2
0
1
0
0
1
1
1
2
1
1
1
1
1
2
2
0
0
0
2
2
2
2
2
0
0
2
1
0
2
0
1
2
...

output:

0 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 650 65...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 291ms
memory: 3616kb

input:

996
1
1
1
1
1
0
1
1
1
2
2
2
1
1
2
1
0
1
2
1
2
2
1
1
0
0
1
0
1
2
2
1
0
0
1
2
0
1
0
0
1
2
1
1
0
1
2
1
1
1
1
2
1
2
1
2
1
1
2
0
2
1
0
0
2
2
0
0
2
2
0
1
2
1
0
2
1
1
1
0
2
1
2
1
1
2
1
1
2
1
1
2
2
2
1
1
2
2
1
1
1
1
0
0
0
1
0
0
1
2
1
1
1
2
0
1
1
2
0
2
1
1
1
1
1
1
0
1
2
1
0
1
2
0
0
1
2
0
1
1
2
1
1
0
0
1
2
2
...

output:

0 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 53 5...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 270ms
memory: 3776kb

input:

997
2
1
1
1
0
1
2
1
2
1
1
2
1
2
1
0
2
2
1
0
2
1
1
0
0
0
1
1
2
0
1
0
1
2
1
2
1
1
1
1
2
2
1
2
1
2
0
1
2
2
2
1
1
1
1
1
0
0
1
1
1
0
0
1
0
1
1
1
0
2
1
2
1
1
2
0
0
1
0
1
2
0
0
0
2
1
1
0
0
1
1
2
1
2
1
1
2
1
1
1
0
1
2
0
2
0
0
2
2
2
2
1
2
2
1
2
1
2
2
1
0
0
0
0
1
1
1
1
1
2
1
1
2
2
1
1
2
2
1
2
1
0
1
0
1
1
2
2
...

output:

0 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 545 54...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 297ms
memory: 3552kb

input:

998
1
2
0
2
2
1
0
2
1
1
1
2
2
2
1
2
2
0
1
1
2
1
1
0
2
2
0
1
1
2
0
2
0
2
2
0
2
1
1
0
2
1
1
0
2
0
1
1
1
0
2
1
1
0
1
2
1
1
1
2
1
2
1
2
2
2
2
2
1
2
1
1
2
2
2
1
2
1
2
1
0
0
1
0
1
1
0
1
2
1
2
0
1
0
0
1
1
2
2
2
0
1
1
1
1
0
2
0
0
2
1
2
2
1
1
0
0
2
2
1
2
1
0
2
1
2
1
1
0
0
1
1
1
0
1
1
1
0
1
0
0
0
2
1
1
1
0
0
...

output:

0 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 934 93...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 284ms
memory: 3544kb

input:

999
1
0
1
2
0
1
0
1
2
1
1
0
1
2
0
0
1
2
0
1
2
1
1
2
1
0
0
0
2
2
2
1
0
2
1
0
0
1
2
1
1
1
0
2
1
1
2
2
2
2
1
1
1
0
0
0
0
2
2
2
0
1
0
1
0
1
1
0
1
0
1
0
2
0
0
1
0
1
2
1
0
0
2
1
2
1
0
2
1
2
1
0
0
2
1
1
2
1
2
1
2
0
1
1
2
0
1
0
1
1
1
2
1
1
1
1
0
0
2
1
2
1
2
1
2
0
1
2
0
1
1
1
2
0
1
2
1
0
1
0
1
1
1
0
1
1
1
2
...

output:

0 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 862 86...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed