QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#660394#2143. Railroad sortingSorahISA#AC ✓42ms37400kbC++2310.8kb2024-10-20 10:56:262024-10-20 10:56:27

Judging History

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

  • [2024-10-20 10:56:27]
  • 评测
  • 测评结果:AC
  • 用时:42ms
  • 内存:37400kb
  • [2024-10-20 10:56:26]
  • 提交

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;
    
    vector<string> ops;
    deque<int> stk1, stk2;
    for (int i = 0; i < N; ++i) ops.eb("1"), stk1.ef(A[i]);
    
    for (int num = 1; num <= N; ++num) {
        while (stk1[0] != num) ops.eb("12"), stk2.ef(stk1[0]), stk1.pf();
        ops.eb("-1"), stk1.pf();
        while (SZ(stk2)) ops.eb("21"), stk1.ef(stk2[0]), stk2.pf();
    }
    
    for (string &op : ops) cout << op << "\n";
}

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;
// #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() cin.tie(0)->sync_with_stdio(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>) {
    _color.emplace_back(_color.back()), ++_color.back()[3];
    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) {
    _color.emplace_back(_color.back()), ++_color.back()[3];
    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) {
        _color.emplace_back(_color.back()), ++_color.back()[3];
        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) {
        _color.emplace_back(_color.back()), ++_color.back()[3];
        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: 0ms
memory: 3744kb

input:

5
3 1 5 2 4

output:

1
1
1
1
1
12
12
12
-1
21
21
21
12
-1
21
12
12
-1
21
21
-1
-1

result:

ok 22 steps

Test #2:

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

input:

1
1

output:

1
-1

result:

ok 2 steps

Test #3:

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

input:

2
1 2

output:

1
1
12
-1
21
-1

result:

ok 6 steps

Test #4:

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

input:

2
2 1

output:

1
1
-1
-1

result:

ok 4 steps

Test #5:

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

input:

3
1 2 3

output:

1
1
1
12
12
-1
21
21
12
-1
21
-1

result:

ok 12 steps

Test #6:

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

input:

3
1 3 2

output:

1
1
1
12
12
-1
21
21
-1
-1

result:

ok 10 steps

Test #7:

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

input:

3
2 1 3

output:

1
1
1
12
-1
21
12
-1
21
-1

result:

ok 10 steps

Test #8:

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

input:

3
2 3 1

output:

1
1
1
-1
12
-1
21
-1

result:

ok 8 steps

Test #9:

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

input:

3
3 1 2

output:

1
1
1
12
-1
21
-1
-1

result:

ok 8 steps

Test #10:

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

input:

3
3 2 1

output:

1
1
1
-1
-1
-1

result:

ok 6 steps

Test #11:

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

input:

10
1 2 3 4 5 6 7 8 9 10

output:

1
1
1
1
1
1
1
1
1
1
12
12
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
21
21
12
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
21
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
12
12
12
12
12
12
-1
21
21
21
21
21
21
12
12
12
12
12
-1
21
21
21
21
21
12
12
12
12
-1
21
21
21
21
12
12
12
-1
21
21
21
12
12
-...

result:

ok 110 steps

Test #12:

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

input:

10
10 9 8 7 6 5 4 3 2 1

output:

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

result:

ok 20 steps

Test #13:

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

input:

10
1 10 2 9 3 8 4 7 5 6

output:

1
1
1
1
1
1
1
1
1
1
12
12
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
21
21
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
12
12
12
12
12
-1
21
21
21
21
21
12
12
12
-1
21
21
21
12
-1
21
-1
-1
-1
-1
-1

result:

ok 70 steps

Test #14:

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

input:

10
2 4 6 8 10 9 7 5 3 1

output:

1
1
1
1
1
1
1
1
1
1
-1
12
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
21
-1
12
12
12
12
12
12
-1
21
21
21
21
21
21
-1
12
12
12
12
-1
21
21
21
21
-1
12
12
-1
21
21
-1
-1

result:

ok 60 steps

Test #15:

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

input:

10
3 9 8 5 7 4 1 2 10 6

output:

1
1
1
1
1
1
1
1
1
1
12
12
12
-1
21
21
21
12
12
-1
21
21
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
12
12
-1
21
21
12
12
12
-1
21
21
21
-1
12
-1
21
12
-1
21
12
-1
21
-1

result:

ok 60 steps

Test #16:

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

input:

10
7 8 2 5 9 6 1 10 4 3

output:

1
1
1
1
1
1
1
1
1
1
12
12
12
-1
21
21
21
12
12
12
12
12
12
-1
21
21
21
21
21
21
-1
-1
12
12
12
-1
21
21
21
12
-1
21
12
12
12
-1
21
21
21
12
12
-1
21
21
12
-1
21
-1

result:

ok 58 steps

Test #17:

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

input:

10
3 7 5 8 10 4 6 2 9 1

output:

1
1
1
1
1
1
1
1
1
1
-1
12
-1
21
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
12
12
-1
21
21
12
12
12
12
-1
21
21
21
21
12
-1
21
12
12
12
-1
21
21
21
12
12
-1
21
21
-1
-1

result:

ok 60 steps

Test #18:

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

input:

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

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

result:

ok 5402 steps

Test #19:

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

input:

73
73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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 146 steps

Test #20:

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

input:

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

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

result:

ok 2810 steps

Test #21:

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

input:

73
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
1...

result:

ok 2810 steps

Test #22:

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

input:

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

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

result:

ok 3132 steps

Test #23:

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

input:

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

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

result:

ok 2818 steps

Test #24:

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

input:

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

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
12
12
12
12
12
12
12
12
12
12
12
12
12
-1
21
21
21
21
21
21
21
21
21
21
21
21
21
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
1...

result:

ok 2400 steps

Test #25:

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

input:

239
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 57360 steps

Test #26:

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

input:

239
239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 ...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 478 steps

Test #27:

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

input:

239
1 239 2 238 3 237 4 236 5 235 6 234 7 233 8 232 9 231 10 230 11 229 12 228 13 227 14 226 15 225 16 224 17 223 18 222 19 221 20 220 21 219 22 218 23 217 24 216 25 215 26 214 27 213 28 212 29 211 30 210 31 209 32 208 33 207 34 206 35 205 36 204 37 203 38 202 39 201 40 200 41 199 42 198 43 197 44 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 29038 steps

Test #28:

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

input:

239
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 175...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 29038 steps

Test #29:

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

input:

239
64 85 148 52 182 174 96 100 213 162 2 71 60 201 9 99 184 118 228 49 50 216 208 8 210 38 183 190 204 234 53 21 45 219 124 134 157 180 16 116 101 105 93 176 41 140 221 5 55 48 145 161 164 169 185 70 230 136 165 72 178 236 83 127 166 120 104 160 112 97 163 4 33 87 47 13 232 200 159 154 10 177 212 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 28528 steps

Test #30:

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

input:

239
224 84 121 89 222 105 60 2 122 52 142 221 116 205 88 86 21 34 42 55 158 75 37 171 218 18 19 64 235 124 47 30 10 44 95 225 190 175 162 123 188 220 97 1 149 229 143 172 202 185 46 22 59 56 206 167 27 174 66 41 92 17 39 20 189 114 106 57 112 141 191 208 210 102 51 215 170 74 165 198 16 72 133 233 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 30174 steps

Test #31:

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

input:

239
26 206 53 21 211 223 235 85 205 180 77 22 82 126 81 116 1 194 183 109 63 49 28 86 31 12 13 220 200 76 155 130 99 178 163 237 2 50 150 236 189 56 39 95 9 11 125 166 231 185 146 221 78 225 48 212 160 29 209 135 66 215 175 190 133 219 64 44 153 57 137 121 10 88 91 36 218 43 35 128 87 164 174 234 41...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 28346 steps

Test #32:

score: 0
Accepted
time: 42ms
memory: 37400kb

input:

1000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 1001000 steps

Test #33:

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

input:

1000
1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 92...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 2000 steps

Test #34:

score: 0
Accepted
time: 24ms
memory: 20532kb

input:

1000
1 1000 2 999 3 998 4 997 5 996 6 995 7 994 8 993 9 992 10 991 11 990 12 989 13 988 14 987 15 986 16 985 17 984 18 983 19 982 20 981 21 980 22 979 23 978 24 977 25 976 26 975 27 974 28 973 29 972 30 971 31 970 32 969 33 968 34 967 35 966 36 965 37 964 38 963 39 962 40 961 41 960 42 959 43 958 44...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 502000 steps

Test #35:

score: 0
Accepted
time: 11ms
memory: 19912kb

input:

1000
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 ...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 501000 steps

Test #36:

score: 0
Accepted
time: 20ms
memory: 20088kb

input:

1000
74 199 928 305 878 917 814 165 410 550 767 477 262 807 559 92 406 845 986 934 82 235 281 695 192 622 778 26 53 428 722 108 243 319 646 400 280 249 495 109 881 96 867 758 504 35 887 276 874 466 658 904 512 897 998 312 733 193 739 783 681 716 291 212 626 629 268 811 990 792 394 316 483 14 548 747...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 506378 steps

Test #37:

score: 0
Accepted
time: 22ms
memory: 20216kb

input:

1000
609 925 795 348 776 946 875 990 556 771 107 152 170 238 498 836 222 649 220 390 865 527 681 38 688 164 789 712 11 106 765 965 756 569 561 334 998 453 282 383 535 229 186 738 333 608 201 686 910 613 880 642 975 331 991 904 265 249 525 67 132 467 374 674 995 362 512 460 120 841 713 126 740 156 51...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 488512 steps

Test #38:

score: 0
Accepted
time: 24ms
memory: 20116kb

input:

1000
453 420 824 229 604 588 326 2 242 293 134 990 444 937 614 273 166 767 319 498 840 57 963 522 449 912 217 160 900 796 754 868 139 366 456 850 737 707 96 105 911 203 764 421 814 999 20 644 63 731 253 353 726 839 821 497 556 662 83 51 886 157 359 519 364 325 98 336 676 212 7 928 118 709 383 518 51...

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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 514512 steps