QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140335#3321. Sixth SenseSorahISAAC ✓150ms3932kbC++204.0kb2023-08-15 18:42:292023-08-15 18:42:32

Judging History

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

  • [2023-08-15 18:42:32]
  • 评测
  • 测评结果:AC
  • 用时:150ms
  • 内存:3932kb
  • [2023-08-15 18:42:29]
  • 提交

answer

#ifndef Yamada
#define Yamada
#include Yamada __FILE__ Yamada

void solve() {
    int N; cin >> N;
    
    vector<int> P(N), F(N);
    for (int i = 0; i < N; ++i) cin >> P[i]; //, P[i] = 2 * P[i] * N + (N - i - 1);
    for (int i = 0; i < N; ++i) cin >> F[i]; //, F[i] = 2 * F[i] * N - N + i;
    
    auto sP = P, sF = F;
    sort(ALL(sP)), sort(ALL(sF));
    
    int max_ans = 0;
    for (int i = 0; i < N; ++i) {
        int cnt = 0;
        for (int j = 0; j < N; ++j) cnt += (sF[(i+j)%N] > sP[j]);
        chmax(max_ans, cnt);
    }
    // debug(max_ans);
    
    vector<int> ans;
    auto left_P = sP, left_F = sF;
    for (int i = 0, n = N, k = max_ans; i < N; ++i, --n) {
        int pos_P = lower_bound(ALL(left_P), P[i]) - begin(left_P);
        left_P.erase(begin(left_P) + pos_P);
        
        // cerr << "\u001b[34m";
        // for (int p : left_P) cerr << p << " "; cerr << "\n";
        // cerr << "\u001b[35m";
        // for (int f : left_F) cerr << f << " "; cerr << "\n";
        // cerr << "\u001b[0m";
        
        int pos_F, cnt = 0;
        for (pos_F = n-1; pos_F >= 0; --pos_F) {
            // debug(pos_F, cnt);
            if (pos_F == n-1 or (P[i] >= left_F[pos_F] and P[i] < left_F[pos_F+1])) {
                cnt = (P[i] < left_F[pos_F]);
                for (int p = k-cnt-1, f = n-1; p >= 0; --p, --f) {
                    // debug(p, f);
                    cnt += (left_P[p] < left_F[f - (f <= pos_F)]);
                }
            }
            else if (P[i] < left_F[pos_F]) {
                // debug("<"s, pos_F-n+k);
                cnt += (left_P[pos_F-n+k] < left_F[pos_F+1]);
                cnt -= (left_P[pos_F-n+k] < left_F[pos_F]);
            }
            else if (P[i] >= left_F[pos_F]) {
                // debug(">="s, pos_F+1-n+k);
                cnt += (left_P[pos_F+1-n+k] < left_F[pos_F+1]);
                cnt -= (left_P[pos_F+1-n+k] < left_F[pos_F]);
            }
            
            // debug(cnt);
            if (cnt == k) break;
        }
        
        k -= (left_F[pos_F] > P[i]);
        ans.eb(left_F[pos_F]);
        left_F.erase(begin(left_F) + pos_F);
    }
    
    for (int i = 0; i < N; ++i) cout << ans[i] << " \n"[i == N-1];
}

signed main() {
    IOS();
    int t = 1; // cin >> t;
    for (int i=1;i<=t;++i) solve();
    return 0;
}

#else

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

#define int int64_t
// #define double __float80
using pii = pair<int, int>;
template <typename T> using MaxHeap = priority_queue<T>;
template <typename T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

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

template <size_t D, typename T> struct Vec : vector<Vec<D-1, T>> {
    template <typename... U> Vec(int n = 0, U ... _u) : vector<Vec<D-1, T>>(n, Vec<D-1, T>(_u...)) {}
};
template <typename T> struct Vec<1, T> : vector<T> {
    Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
};

#ifdef local
#define IOS() void()
#define debug(...) \
    fprintf(stderr, "\u001b[33m"), \
    fprintf(stderr, "At [%s], line %d: (%s) = ", __FUNCTION__, __LINE__, #__VA_ARGS__), \
    _do(__VA_ARGS__), \
    fprintf(stderr, "\u001b[0m")
template <typename T> void _do(T &&_t) {cerr << _t << endl;}
template <typename T, typename ...U> void _do(T &&_t, U &&..._u) {cerr << _t << ", ", _do(_u...);}
#else
#define IOS() ios_base::sync_with_stdio(0); cin.tie(0)
#define debug(...) void()
#define endl '\n'
#endif

template <typename U, typename V> bool chmin(U &u, V v) {return u > v ? u = v, 1 : 0;}
template <typename U, typename V> bool chmax(U &u, V v) {return u < v ? u = v, 1 : 0;}

#endif

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3456kb

input:

2
10 10
10 5

output:

10 5

result:

ok single line: '10 5'

Test #2:

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

input:

2
10 10
15 10

output:

15 10

result:

ok single line: '15 10'

Test #3:

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

input:

2
10 10
15 15

output:

15 15

result:

ok single line: '15 15'

Test #4:

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

input:

2
10 20
5 10

output:

10 5

result:

ok single line: '10 5'

Test #5:

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

input:

2
10 20
15 10

output:

15 10

result:

ok single line: '15 10'

Test #6:

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

input:

2
10 20
5 25

output:

25 5

result:

ok single line: '25 5'

Test #7:

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

input:

2
10 20
20 15

output:

20 15

result:

ok single line: '20 15'

Test #8:

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

input:

2
10 20
25 25

output:

25 25

result:

ok single line: '25 25'

Test #9:

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

input:

2
20 10
10 5

output:

10 5

result:

ok single line: '10 5'

Test #10:

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

input:

2
20 10
15 10

output:

10 15

result:

ok single line: '10 15'

Test #11:

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

input:

2
20 10
25 5

output:

25 5

result:

ok single line: '25 5'

Test #12:

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

input:

2
20 10
15 20

output:

20 15

result:

ok single line: '20 15'

Test #13:

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

input:

2
20 10
25 25

output:

25 25

result:

ok single line: '25 25'

Test #14:

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

input:

3
10 10 10
10 5 10

output:

10 10 5

result:

ok single line: '10 10 5'

Test #15:

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

input:

3
10 10 10
10 15 5

output:

15 10 5

result:

ok single line: '15 10 5'

Test #16:

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

input:

3
10 10 10
15 15 10

output:

15 15 10

result:

ok single line: '15 15 10'

Test #17:

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

input:

3
10 10 10
15 15 15

output:

15 15 15

result:

ok single line: '15 15 15'

Test #18:

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

input:

3
10 10 20
10 10 5

output:

10 10 5

result:

ok single line: '10 10 5'

Test #19:

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

input:

3
10 20 10
5 10 15

output:

15 10 5

result:

ok single line: '15 10 5'

Test #20:

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

input:

3
10 20 10
15 10 15

output:

15 10 15

result:

ok single line: '15 10 15'

Test #21:

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

input:

3
10 10 20
15 15 15

output:

15 15 15

result:

ok single line: '15 15 15'

Test #22:

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

input:

3
10 20 10
20 10 5

output:

20 10 5

result:

ok single line: '20 10 5'

Test #23:

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

input:

3
20 10 10
15 20 10

output:

10 20 15

result:

ok single line: '10 20 15'

Test #24:

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

input:

3
10 10 20
25 15 10

output:

25 15 10

result:

ok single line: '25 15 10'

Test #25:

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

input:

3
10 20 10
20 10 20

output:

20 10 20

result:

ok single line: '20 10 20'

Test #26:

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

input:

3
20 10 10
10 25 20

output:

25 20 10

result:

ok single line: '25 20 10'

Test #27:

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

input:

3
10 20 10
10 25 25

output:

25 25 10

result:

ok single line: '25 25 10'

Test #28:

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

input:

3
10 10 20
15 15 20

output:

20 15 15

result:

ok single line: '20 15 15'

Test #29:

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

input:

3
20 10 10
20 25 15

output:

25 20 15

result:

ok single line: '25 20 15'

Test #30:

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

input:

3
10 10 20
15 25 25

output:

25 15 25

result:

ok single line: '25 15 25'

Test #31:

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

input:

3
20 10 10
20 20 20

output:

20 20 20

result:

ok single line: '20 20 20'

Test #32:

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

input:

3
10 20 10
25 20 20

output:

20 25 20

result:

ok single line: '20 25 20'

Test #33:

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

input:

3
20 10 10
25 25 25

output:

25 25 25

result:

ok single line: '25 25 25'

Test #34:

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

input:

3
10 20 30
5 10 10

output:

10 10 5

result:

ok single line: '10 10 5'

Test #35:

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

input:

3
30 20 10
10 15 5

output:

10 5 15

result:

ok single line: '10 5 15'

Test #36:

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

input:

3
30 10 20
15 10 15

output:

15 15 10

result:

ok single line: '15 15 10'

Test #37:

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

input:

3
30 20 10
15 15 15

output:

15 15 15

result:

ok single line: '15 15 15'

Test #38:

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

input:

3
10 30 20
20 5 10

output:

20 10 5

result:

ok single line: '20 10 5'

Test #39:

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

input:

3
20 10 30
15 20 10

output:

20 15 10

result:

ok single line: '20 15 10'

Test #40:

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

input:

3
20 10 30
15 10 25

output:

25 15 10

result:

ok single line: '25 15 10'

Test #41:

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

input:

3
20 30 10
10 20 20

output:

20 10 20

result:

ok single line: '20 10 20'

Test #42:

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

input:

3
10 20 30
25 10 20

output:

20 25 10

result:

ok single line: '20 25 10'

Test #43:

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

input:

3
10 30 20
25 10 25

output:

25 10 25

result:

ok single line: '25 10 25'

Test #44:

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

input:

3
10 20 30
20 15 15

output:

20 15 15

result:

ok single line: '20 15 15'

Test #45:

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

input:

3
30 10 20
15 25 20

output:

20 15 25

result:

ok single line: '20 15 25'

Test #46:

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

input:

3
10 20 30
15 25 25

output:

25 25 15

result:

ok single line: '25 25 15'

Test #47:

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

input:

3
20 10 30
20 20 20

output:

20 20 20

result:

ok single line: '20 20 20'

Test #48:

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

input:

3
30 10 20
20 20 25

output:

20 20 25

result:

ok single line: '20 20 25'

Test #49:

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

input:

3
20 10 30
25 25 25

output:

25 25 25

result:

ok single line: '25 25 25'

Test #50:

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

input:

3
20 10 30
5 10 30

output:

30 10 5

result:

ok single line: '30 10 5'

Test #51:

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

input:

3
30 20 10
10 35 10

output:

35 10 10

result:

ok single line: '35 10 10'

Test #52:

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

input:

3
30 10 20
15 10 30

output:

10 15 30

result:

ok single line: '10 15 30'

Test #53:

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

input:

3
20 10 30
15 10 35

output:

35 15 10

result:

ok single line: '35 15 10'

Test #54:

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

input:

3
20 30 10
10 30 20

output:

30 10 20

result:

ok single line: '30 10 20'

Test #55:

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

input:

3
20 10 30
35 20 10

output:

35 20 10

result:

ok single line: '35 20 10'

Test #56:

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

input:

3
30 20 10
25 30 10

output:

10 30 25

result:

ok single line: '10 30 25'

Test #57:

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

input:

3
10 20 30
10 25 35

output:

35 25 10

result:

ok single line: '35 25 10'

Test #58:

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

input:

3
20 10 30
15 15 35

output:

35 15 15

result:

ok single line: '35 15 15'

Test #59:

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

input:

3
10 30 20
15 30 20

output:

20 15 30

result:

ok single line: '20 15 30'

Test #60:

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

input:

3
20 30 10
25 30 15

output:

30 25 15

result:

ok single line: '30 25 15'

Test #61:

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

input:

3
20 10 30
35 25 15

output:

25 15 35

result:

ok single line: '25 15 35'

Test #62:

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

input:

3
20 30 10
30 25 20

output:

30 25 20

result:

ok single line: '30 25 20'

Test #63:

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

input:

3
30 10 20
30 25 25

output:

30 25 25

result:

ok single line: '30 25 25'

Test #64:

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

input:

3
30 10 20
30 30 30

output:

30 30 30

result:

ok single line: '30 30 30'

Test #65:

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

input:

3
10 30 20
35 30 30

output:

30 35 30

result:

ok single line: '30 35 30'

Test #66:

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

input:

3
10 20 30
35 35 35

output:

35 35 35

result:

ok single line: '35 35 35'

Test #67:

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

input:

137
7524 5093 7163 8916 1080 6268 4212 221 9408 2069 4454 6785 6652 6388 5953 7877 5625 2465 561 5635 1358 2572 3159 5875 4795 4632 2896 2396 5953 4136 4833 1169 2396 7163 647 1836 4441 1188 5093 8626 5875 5042 9134 5093 3801 8200 9765 5093 4491 7125 1920 9968 7877 8626 6143 4356 5953 7759 8565 6762...

output:

10000 9968 9968 9924 4632 7585 4628 4609 9924 4609 4569 7109 7073 6652 6652 9753 6652 4527 2069 5875 1920 3801 3766 6166 5862 4726 3626 2973 6166 4527 5093 1646 2936 7524 1591 1868 4491 1308 5182 9592 5953 5093 9555 5182 4454 9555 1270 5182 4527 7524 2026 1260 9382 8909 6152 4363 6103 8909 8909 6763...

result:

ok single line: '10000 9968 9968 9924 4632 7585...9 3159 1472 6152 3695 9349 6763'

Test #68:

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

input:

127
3485 3288 8883 3150 8710 2932 2865 1226 2773 9640 1226 2458 7607 5627 2747 5699 2747 4973 7450 5156 2647 3636 9748 4985 9965 9772 2747 6005 9236 1881 6005 1091 6549 2458 5226 9581 8710 2728 100 8108 1477 1370 2925 523 3917 8592 5129 6643 3232 7403 5412 825 3577 8883 883 9772 1370 6332 2120 1056 ...

output:

8484 8484 9958 8484 9835 8195 8195 8155 8045 9822 7997 7997 7919 7836 4392 7836 3917 7821 7821 7801 3879 3879 9822 7749 3061 3061 3055 7734 9640 3036 7694 2925 7623 2925 6643 2865 9581 2865 2773 8113 2773 2639 2928 1784 4150 8710 6618 6715 3756 7607 6618 1370 3658 9577 1282 1056 1738 6618 2633 1282 ...

result:

ok single line: '8484 8484 9958 8484 9835 8195 ...77 6466 5412 7651 100 2332 1024'

Test #69:

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

input:

139
7359 9216 6091 1 9250 7673 1545 8937 2525 7724 7715 4952 1793 6212 5576 6486 8564 2501 2948 7673 1453 4337 4143 6170 6420 8419 1009 9564 3391 6592 4143 7625 1440 7065 6492 2225 5290 9526 6773 5239 7532 5417 2612 610 7065 8121 3201 2225 2353 3125 6557 10000 6888 3391 5239 6683 7546 7195 3216 429 ...

output:

10000 9900 9900 1403 9758 9564 2169 9564 3125 9564 9564 9488 2169 9098 9049 9049 9000 3125 3079 8997 2166 8937 8933 8667 8578 8564 1103 1009 6557 8564 6541 8419 2025 8419 6541 2525 5916 1009 8049 5725 8049 5576 3028 963 7546 8375 3216 2459 2459 3146 6592 959 7195 5576 5576 6918 7634 7261 3660 786 53...

result:

ok single line: '10000 9900 9900 1403 9758 9564...3 4143 6492 1103 4141 1398 7326'

Test #70:

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

input:

173
7220 3525 2432 9331 9131 4725 4263 4325 4771 335 7334 1 276 1 713 4650 6345 335 6917 7708 5675 6226 5832 8740 8198 1989 6268 8766 5213 5626 8675 4391 7959 2277 7962 1655 5215 6364 9206 5029 3426 8736 8454 8354 1944 1546 4235 1110 4019 5854 3747 3902 1814 791 3094 7962 887 7684 7214 5225 6203 351...

output:

10000 5626 5605 9932 9884 5567 5567 5567 5567 5567 9884 5546 5546 5490 5003 4974 9750 4916 9652 9469 9422 9331 9213 9206 9166 3707 9166 9139 5490 5696 9139 4916 9131 3544 9054 3115 5490 8416 9213 5459 3525 8955 8955 8416 2847 2277 4879 1904 4725 8416 4472 4472 1904 1904 3108 8354 1814 8152 8062 5459...

result:

ok single line: '10000 5626 5605 9932 9884 5567...55 6757 351 3825 7523 1989 7274'

Test #71:

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

input:

178
767 5948 9897 7734 5328 5224 8093 8020 4994 5885 7444 1656 1437 3446 3230 1036 4416 1765 4298 9203 1557 5077 8020 4149 8618 4774 9955 1513 3852 1437 833 617 6929 6931 3479 5359 8957 8903 5585 1513 2644 2191 9486 2364 2654 5647 576 2191 7922 1765 5363 7517 1765 7406 767 6387 7086 1440 5948 6468 7...

output:

9103 9103 10000 9103 8859 8859 8768 8768 6608 6582 7862 6582 5894 5856 5826 5826 5559 5378 5363 10000 5359 5359 8721 5359 8682 5359 10000 5224 5147 4994 4994 1440 7862 7777 4994 5363 8980 8916 5750 4824 4461 4298 9897 3948 3948 5750 1440 3911 8020 3852 5378 7777 3624 7777 1437 6582 7577 1557 6468 65...

result:

ok single line: '9103 9103 10000 9103 8859 8859...03 4120 613 1889 1440 8093 5885'

Test #72:

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

input:

175
6473 3831 3180 4939 2761 2573 9798 8496 2545 3165 4153 4231 2545 2533 1835 2574 2216 9676 1081 4610 7173 482 7376 2648 2190 9798 2190 6669 8099 7856 1066 1066 6517 1014 2221 1415 5736 2069 1467 9444 1467 9894 8798 9662 8758 3265 5006 5786 9163 1289 1415 2190 1014 4888 9798 3358 7200 5112 4634 32...

output:

9843 9694 9694 9266 9266 9222 1014 8798 8758 8758 7677 7615 7492 7492 7481 7454 7437 1014 6517 6473 7417 1000 7417 6435 6435 1000 6183 7327 8758 8714 6183 6183 7297 6183 6183 6100 5786 4946 4138 9676 2528 859 9018 9676 8798 4055 5613 6003 9165 1747 1747 2410 1661 4946 482 4049 7211 5223 4888 3985 90...

result:

ok single line: '9843 9694 9694 9266 9266 9222 ...2 2221 8419 8551 3780 4055 9280'

Test #73:

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

input:

134
9815 4549 4632 8837 725 1298 8715 7738 8175 2473 66 1 1538 9719 7600 9597 6204 6512 5248 2006 7256 8349 539 7738 6725 9719 2433 6140 1298 858 8232 662 6160 5078 9883 5859 1261 6025 6710 1538 9626 9204 1244 858 9028 6710 2450 9815 3253 7116 6725 62 8872 4549 9597 858 9334 9465 3437 8472 6449 3654...

output:

10000 8626 8128 9204 7860 6937 8872 7777 8595 6926 6310 6204 5695 9883 7777 9868 6310 6926 5657 5657 7777 8595 5375 7741 6926 9815 5248 6204 5115 5078 8472 4077 6204 5115 3147 6192 3034 6192 6841 2450 9654 9253 2450 2404 9204 6841 2473 2404 3437 7667 6818 2370 9028 4757 9654 2311 9654 9597 3500 8595...

result:

ok single line: '10000 8626 8128 9204 7860 6937...106 6725 9405 1261 3253 9334 66'

Test #74:

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

input:

200
5884 5483 1258 5006 3941 9441 9460 9205 933 2832 9205 8928 8947 936 9205 4108 4069 9073 2655 3863 5478 3863 7765 9163 5509 8848 2814 9727 1842 7111 7604 3031 6540 2409 7688 9745 2276 7575 2972 9372 8472 5124 6276 4678 5884 9583 5840 5359 2814 5006 1532 4159 3668 2442 9583 2141 7934 5884 2801 745...

output:

7015 6951 6714 6706 5507 9935 9914 9914 5413 5359 9745 9659 9659 5359 9460 5359 5071 9460 5071 5017 5483 4983 9401 9344 5840 9344 4977 4977 4678 9344 9310 4656 6706 4540 9310 4323 4323 9205 4159 936 9163 5359 6604 4977 5935 936 5908 5413 3987 5017 3031 4188 3934 2737 933 2215 9163 5908 2954 9101 910...

result:

ok single line: '7015 6951 6714 6706 5507 9935 ... 2814 7838 1 933 7369 3868 3444'

Test #75:

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

input:

180
7195 7479 2283 5293 464 2659 172 5847 8098 9520 8145 7418 5678 6478 7680 4157 5687 416 7408 4499 4794 65 3342 8409 7403 3237 2013 3411 938 3959 2283 8864 6028 2537 5070 6665 1782 3191 1133 6980 9491 1187 409 7866 3702 1022 2038 216 3597 4906 1133 9683 1022 2787 8288 7479 3728 343 7527 7197 2728 ...

output:

9707 9707 9476 9469 8017 8017 7403 6980 9233 9683 9153 8017 6980 6910 8017 6851 6604 6529 8009 6529 6529 172 6474 9140 7748 5906 5782 5736 5697 5593 5257 8995 6452 5170 5170 6805 5170 4906 4906 7111 9565 4906 929 7954 4859 4406 4406 917 4406 5165 2659 65 1782 4363 8995 7712 3878 618 7704 7299 3728 1...

result:

ok single line: '9707 9707 9476 9469 8017 8017 ...89 416 4286 1840 9148 4251 7408'

Test #76:

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

input:

151
6184 1906 2226 8060 5985 3471 6398 7262 6064 2279 1929 8326 1781 4307 9469 6064 1781 2279 9947 3313 7134 10000 9757 2226 3018 8465 6151 1212 270 3313 2128 8182 3471 8774 8250 603 5327 3555 3707 7637 5132 2848 5819 4044 7457 5797 5013 7262 9941 9947 6813 3609 480 8958 2697 3859 3768 7457 9 6185 1...

output:

9962 3471 3471 9962 9947 3695 9941 9912 9887 2848 2848 9812 2848 5132 9757 6398 2123 2819 2123 3471 9469 2113 9812 2279 3471 8953 6184 1849 1657 3338 2279 8483 3555 8808 8483 1657 6129 3695 5012 8483 5169 3338 6079 4443 8326 5819 5132 8315 1634 1571 8250 3640 872 9469 2706 4429 3957 8250 728 6398 16...

result:

ok single line: '9962 3471 3471 9962 9947 3695 ...3 2848 5644 6716 4900 7134 5231'

Test #77:

score: 0
Accepted
time: 113ms
memory: 3876kb

input:

5000
3710 92 5527 4275 6997 6134 8269 9075 3666 6149 7539 26 7813 9575 9728 8117 5764 6953 8964 7618 4692 4838 667 2475 8899 2628 8745 1709 5625 3906 355 3209 5050 2441 9477 8990 3965 7260 4606 2710 607 1970 1494 2699 7535 4511 6200 9140 5730 7275 1198 8234 8342 9529 2407 5835 3584 6363 8020 927 618...

output:

9999 432 9996 9995 9995 9982 9981 9981 9979 9979 9977 429 9938 9935 9860 9858 9856 9855 9849 9849 9849 9832 6888 6888 9832 6884 9828 6883 6881 6878 427 6873 6871 6869 9828 9828 6864 9828 6861 6656 6636 6333 6332 6332 9822 6330 6320 9543 6320 7853 6319 9541 9506 9537 6319 6300 6300 6636 9506 2658 264...

result:

ok single line: '9999 432 9996 9995 9995 9982 9... 8643 1447 857 424 606 121 1414'

Test #78:

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

input:

5000
536 1640 5956 5572 2438 6830 1072 3468 8673 4615 3664 1231 4960 3795 6161 9563 612 5502 3222 3821 9806 3095 8629 2647 3572 4837 9137 1468 480 4980 6258 3662 4015 7216 8015 4961 985 1314 8861 7158 8651 5541 6044 3750 496 9500 5241 3631 6400 1550 7045 8069 3483 2684 8604 5166 5664 3167 4238 612 7...

output:

9319 9309 9309 9309 9017 9017 9010 8978 8939 8939 8938 8928 8629 8613 8613 9997 8492 8492 8364 8364 9989 8364 8927 8343 8338 8338 9308 8337 8335 8329 8271 8266 7861 7841 8264 7841 7841 7838 8883 7838 8880 7836 7793 7782 7780 9988 7779 7778 7777 7775 7775 8255 7772 7754 8608 7733 7733 7733 7526 7524 ...

result:

ok single line: '9319 9309 9309 9309 9017 9017 ...8 5046 7567 2844 4140 9410 4502'

Test #79:

score: 0
Accepted
time: 117ms
memory: 3872kb

input:

5000
8223 7792 7286 8190 1592 1973 8300 9632 1537 1719 5765 6182 6496 1536 9302 662 1326 6675 2857 7343 7499 7880 2030 62 9335 3252 2713 4148 2427 3180 3025 1558 704 7349 5256 5652 6142 9625 8742 942 1891 4007 3346 5002 4051 5109 4516 8542 8787 4109 7723 981 4415 6599 7458 8170 1864 6181 8170 6561 3...

output:

9997 9996 9994 9993 3099 3099 9992 9988 3096 3076 9986 9984 9983 3074 9983 3042 3036 9982 3036 9977 9976 9976 2773 2773 9975 9973 2772 9972 2770 9970 3036 2770 2767 9970 9969 9968 9968 9961 9957 2758 2733 9955 9953 9951 9948 9947 9940 9939 9939 9936 9935 2723 9933 9933 9932 9930 2715 9930 9921 9920 ...

result:

ok single line: '9997 9996 9994 9993 3099 3099 ...31 870 6293 2789 3991 5001 8762'

Test #80:

score: 0
Accepted
time: 112ms
memory: 3872kb

input:

5000
6783 1875 5181 1768 4529 7770 587 9157 9503 9193 7303 5270 8999 6834 1968 1485 6344 7448 4420 7767 3929 6592 7938 747 4145 702 3640 8333 9710 9570 6906 2495 7159 2861 2142 329 2086 584 3624 1138 4493 9635 8203 5173 5423 3001 3001 4923 8004 7861 1291 8101 7374 8214 4417 4802 42 124 3569 9668 573...

output:

9084 9082 9080 9068 9067 9059 9058 9999 9997 9992 9050 9050 9046 9045 8958 8945 8942 8937 8921 8921 8920 8878 8875 8874 8873 2062 7834 8870 9990 9989 7830 7830 7582 7580 7568 2060 7568 2059 7565 2058 7555 9986 8867 7534 7534 7531 7529 7523 8828 8827 2057 8826 7521 8825 7521 7428 2013 1990 7411 9985 ...

result:

ok single line: '9084 9082 9080 9068 9067 9059 ...29 2715 786 2175 2094 8742 1058'

Test #81:

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

input:

5000
8641 8760 3066 763 5305 4045 4742 9897 9791 8642 606 7264 1324 2228 898 375 2694 7722 9334 4521 2733 626 4669 2219 3959 6931 9313 3624 787 6829 9617 8184 7666 1660 1139 234 8815 5132 1839 695 2635 4021 7821 8602 3973 387 5311 3352 2190 7965 2242 8675 4045 8159 3498 1799 7241 7155 6624 3373 8758...

output:

9868 9868 9867 9855 9841 9820 9820 9999 9806 9805 9805 9805 9798 9798 9678 9678 9674 9588 9585 9457 9447 9445 7158 7154 4710 7154 9441 4710 4699 7152 9650 9441 8341 4694 4690 4678 9440 7152 4674 4659 4659 4655 8341 9431 4647 4522 7149 4521 4510 8341 4486 9386 4485 8338 4484 4484 8334 7158 7145 4413 ...

result:

ok single line: '9868 9868 9867 9855 9841 9820 ...52 396 6944 4749 2028 2506 7854'

Test #82:

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

input:

5000
2669 608 3643 4746 8921 4547 7862 1102 2275 4282 7174 2449 9428 2861 7765 3635 8515 5446 5952 3620 9361 7616 1421 7373 8216 8398 8144 8519 1635 732 9370 537 6603 2394 5711 9226 2778 405 9682 8705 8276 7422 1685 1361 7213 8700 5063 9771 6637 1531 3193 1528 3127 6276 1688 2790 4933 7812 5206 5100...

output:

3181 3181 9997 9994 9993 9993 9989 3174 3174 9989 9980 3169 9980 3169 9979 9971 9970 9962 9961 9957 9955 9955 3169 9954 9953 9953 9953 9951 3167 3164 9948 3158 9943 3155 9943 9942 3155 3151 9941 9938 9938 9938 3151 3148 9933 9933 9927 9926 9926 3109 9926 3109 3145 9924 2778 3054 9922 9920 9920 9918 ...

result:

ok single line: '3181 3181 9997 9994 9993 9993 ...53 3477 5541 5008 419 5665 8314'

Test #83:

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

input:

5000
3791 636 2476 3141 4577 9654 9355 3129 7840 1209 4993 9600 1149 4492 3805 6354 9842 7982 2054 5234 1176 1308 6270 4432 5378 7811 1083 7549 5537 8027 733 4781 5525 5962 6355 4949 7657 6172 2251 4066 1623 9521 244 5689 9577 6226 6399 3615 4196 2940 4603 7660 7819 8483 7045 8059 6783 604 2268 8788...

output:

9999 3128 3128 9996 9994 9993 9992 9991 9991 3101 9990 9987 3098 9983 9981 9980 9979 9979 3091 9979 2924 2923 9977 9977 6288 9975 2918 9971 6287 9971 2918 6286 6281 6277 9970 6277 9970 6277 2898 6270 2895 9593 2884 6186 9593 6270 9590 6135 6135 3086 6061 9586 9586 9586 9586 9579 9576 2543 2536 9573 ...

result:

ok single line: '9999 3128 3128 9996 9994 9993 ...2 5404 1121 2606 4697 2100 6219'

Test #84:

score: 0
Accepted
time: 117ms
memory: 3876kb

input:

5000
342 3003 516 1015 1628 8674 7859 6256 2062 6119 912 2945 4118 1143 436 6406 5750 2514 4683 7389 1528 2860 522 9768 9795 21 7845 967 8748 6753 342 5772 2243 2641 6867 6160 229 5587 9578 9039 2906 6554 3085 3318 7789 7601 9468 2890 8686 88 6967 5 5230 4270 5313 2236 8282 1498 3803 1771 6326 8252 ...

output:

9878 9875 9871 9866 9809 9808 9762 9687 9686 9591 9590 9586 9131 9130 9127 9120 9092 9091 9091 9090 9087 9087 9024 9807 9807 9023 9023 9019 9018 9012 9011 7419 7419 7417 7209 7185 7179 7176 9586 9068 7175 7169 7164 7163 9005 8807 9585 7163 8806 7161 7157 7155 6922 6703 6699 6699 8805 6666 6659 6652 ...

result:

ok single line: '9878 9875 9871 9866 9809 9808 ...6 7260 7986 6980 6028 6900 6611'

Test #85:

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

input:

5000
9239 2995 9254 1033 243 4952 1673 4755 1688 4435 2785 4824 2344 241 2310 2773 3223 7474 8081 2380 9659 5703 1284 3500 6237 8137 1429 1338 3508 9164 3357 3111 7709 7393 9066 9263 2011 6982 5786 1058 9275 3627 3634 4326 1046 2807 8512 5377 7209 3741 2762 1502 7791 7249 587 8457 1798 8120 3471 833...

output:

9999 4085 9995 4085 4085 9990 4084 9990 3990 9990 3988 9989 3984 3983 3982 3422 3420 9986 9984 3420 9984 9984 3416 3982 9983 9982 3411 3408 3979 9982 3408 3375 9982 9981 9981 9980 3304 9977 9975 3296 9975 3973 3954 9968 3295 3294 9967 9965 9960 3953 3216 3214 9960 9958 3214 9957 3204 9955 3947 9954 ...

result:

ok single line: '9999 4085 9995 4085 4085 9990 ...960 5271 314 2396 283 9236 1203'

Test #86:

score: 0
Accepted
time: 117ms
memory: 3820kb

input:

5000
471 9209 646 2892 1417 9689 7239 4427 6682 6299 5984 2290 4715 1664 4935 4230 9254 4143 9204 8720 2915 80 599 4621 4399 9272 513 9042 5193 5645 9534 1925 5045 3146 621 6740 8533 2008 7268 9155 5605 6650 9907 8721 9668 9040 5726 7911 2317 1249 2019 3443 6590 1062 9839 1225 8426 5688 2374 2242 46...

output:

7838 9998 7470 7470 7469 9995 7463 7462 7460 7082 7079 7078 7077 7077 7062 7060 9991 7060 9984 9982 7058 7044 7043 7042 7040 9975 7039 9975 7011 6993 9973 6991 5966 5963 5953 6980 9970 5953 7441 9969 5943 6977 9968 9964 9958 9957 5942 9925 5934 5933 5927 5926 6977 5912 9921 5911 9789 5894 5886 5840 ...

result:

ok single line: '7838 9998 7470 7470 7469 9995 ...2 3590 1999 9032 8718 4731 4481'

Test #87:

score: 0
Accepted
time: 150ms
memory: 3812kb

input:

5000
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:

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 102 10...

result:

ok single line: '2 3 4 5 6 7 8 9 10 11 12 13 14...4995 4996 4997 4998 4999 5000 1'

Test #88:

score: 0
Accepted
time: 79ms
memory: 3932kb

input:

5000
5000 4999 4998 4997 4996 4995 4994 4993 4992 4991 4990 4989 4988 4987 4986 4985 4984 4983 4982 4981 4980 4979 4978 4977 4976 4975 4974 4973 4972 4971 4970 4969 4968 4967 4966 4965 4964 4963 4962 4961 4960 4959 4958 4957 4956 4955 4954 4953 4952 4951 4950 4949 4948 4947 4946 4945 4944 4943 4942 ...

output:

5001 5000 4999 4998 4997 4996 4995 4994 4993 4992 4991 4990 4989 4988 4987 4986 4985 4984 4983 4982 4981 4980 4979 4978 4977 4976 4975 4974 4973 4972 4971 4970 4969 4968 4967 4966 4965 4964 4963 4962 4961 4960 4959 4958 4957 4956 4955 4954 4953 4952 4951 4950 4949 4948 4947 4946 4945 4944 4943 4942 ...

result:

ok single line: '5001 5000 4999 4998 4997 4996 ... 14 13 12 11 10 9 8 7 6 5 4 3 2'