QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#457954#8837. Increasing Incomeucup-team987#AC ✓74ms12192kbC++207.0kb2024-06-29 14:56:432024-06-29 14:56:44

Judging History

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

  • [2024-06-29 14:56:44]
  • 评测
  • 测评结果:AC
  • 用时:74ms
  • 内存:12192kb
  • [2024-06-29 14:56:43]
  • 提交

answer

#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
#include<cassert>

#include <algorithm>
#include <cassert>
#include <vector>


#ifdef _MSC_VER
#include <intrin.h>
#endif

namespace atcoder {

namespace internal {

int ceil_pow2(int n) {
    int x = 0;
    while ((1U << x) < (unsigned int)(n)) x++;
    return x;
}

constexpr int bsf_constexpr(unsigned int n) {
    int x = 0;
    while (!(n & (1 << x))) x++;
    return x;
}

int bsf(unsigned int n) {
#ifdef _MSC_VER
    unsigned long index;
    _BitScanForward(&index, n);
    return index;
#else
    return __builtin_ctz(n);
#endif
}

}  // namespace internal

}  // namespace atcoder


namespace atcoder {

template <class S, S (*op)(S, S), S (*e)()> struct segtree {
  public:
    segtree() : segtree(0) {}
    explicit segtree(int n) : segtree(std::vector<S>(n, e())) {}
    explicit segtree(const std::vector<S>& v) : _n(int(v.size())) {
        log = internal::ceil_pow2(_n);
        size = 1 << log;
        d = std::vector<S>(2 * size, e());
        for (int i = 0; i < _n; i++) d[size + i] = v[i];
        for (int i = size - 1; i >= 1; i--) {
            update(i);
        }
    }

    void set(int p, S x) {
        assert(0 <= p && p < _n);
        p += size;
        d[p] = x;
        for (int i = 1; i <= log; i++) update(p >> i);
    }

    S get(int p) const {
        assert(0 <= p && p < _n);
        return d[p + size];
    }

    S prod(int l, int r) const {
        assert(0 <= l && l <= r && r <= _n);
        S sml = e(), smr = e();
        l += size;
        r += size;

        while (l < r) {
            if (l & 1) sml = op(sml, d[l++]);
            if (r & 1) smr = op(d[--r], smr);
            l >>= 1;
            r >>= 1;
        }
        return op(sml, smr);
    }

    S all_prod() const { return d[1]; }

    template <bool (*f)(S)> int max_right(int l) const {
        return max_right(l, [](S x) { return f(x); });
    }
    template <class F> int max_right(int l, F f) const {
        assert(0 <= l && l <= _n);
        assert(f(e()));
        if (l == _n) return _n;
        l += size;
        S sm = e();
        do {
            while (l % 2 == 0) l >>= 1;
            if (!f(op(sm, d[l]))) {
                while (l < size) {
                    l = (2 * l);
                    if (f(op(sm, d[l]))) {
                        sm = op(sm, d[l]);
                        l++;
                    }
                }
                return l - size;
            }
            sm = op(sm, d[l]);
            l++;
        } while ((l & -l) != l);
        return _n;
    }

    template <bool (*f)(S)> int min_left(int r) const {
        return min_left(r, [](S x) { return f(x); });
    }
    template <class F> int min_left(int r, F f) const {
        assert(0 <= r && r <= _n);
        assert(f(e()));
        if (r == 0) return 0;
        r += size;
        S sm = e();
        do {
            r--;
            while (r > 1 && (r % 2)) r >>= 1;
            if (!f(op(d[r], sm))) {
                while (r < size) {
                    r = (2 * r + 1);
                    if (f(op(d[r], sm))) {
                        sm = op(d[r], sm);
                        r--;
                    }
                }
                return r + 1 - size;
            }
            sm = op(d[r], sm);
        } while ((r & -r) != r);
        return 0;
    }

  private:
    int _n, size, log;
    std::vector<S> d;

    void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
};

}  // namespace atcoder

using namespace std;
int naive(vector<int>P)
{
	auto f=[&](const vector<int>&Q){
		int ret=0;
		int qm=-1,pm=-1;
		for(int q:Q)
		{
			if(qm<q)qm=q,ret++;
			if(pm<P[q])pm=P[q],ret++;
		}
		return ret;
	};
	vector<int>Q(P.size());
	for(int i=0;i<P.size();i++)Q[i]=i;
	vector<vector<int> >CAN;
	int mx=0;
	do{
		int t=f(Q);
		if(mx<t)mx=t,CAN.clear();
		if(mx==t)CAN.push_back(Q);
	}while(next_permutation(Q.begin(),Q.end()));
	/*
	bool fn=false;
	for(vector<int>Q:CAN)
	{
		bool qo=true,po=true;
		for(int i=0;i<Q.size();i++)
		{
			if(Q[i]!=i)qo=false;
			if(P[Q[i]]!=i)po=false;
		}
		if(qo||po)fn=true;
	}
	if(!fn)
	{
		for(int p:P)cout<<p<<" ";cout<<endl;
		cout<<"ans = "<<mx<<endl;
		cout<<"CAN :"<<endl;
		for(vector<int>Q:CAN)
		{
			for(int q:Q)cout<<q<<" ";cout<<endl;
		}
		assert(fn);
	}
	*/
	return mx;
}
template <typename T>
vector<int> longest_increasing_sequence(const vector<T>& a) {
  int N = a.size();
  vector<pair<T, int>> dp;
  vector<int> p(N, -1);

  for (int i = 0; i < N; i++) {
    auto it = lower_bound(begin(dp), end(dp), make_pair(a[i], -i));
    if (it != begin(dp)) p[i] = -prev(it)->second;
    if (it == end(dp)) {
      dp.emplace_back(a[i], -i);
    } else {
      *it = make_pair(a[i], -i);
    }
  }

  vector<int> res;
  for (int i = -dp.back().second; i != -1; i = p[i]) res.push_back(i);
  reverse(begin(res), end(res));
  return res;
}
using dat=pair<int,int>;
dat op(dat a,dat b){return max(a,b);}
dat e(){return make_pair(-1,-1);}
int solve(const vector<int>&P)
{
	atcoder::segtree<dat,op,e>seg(P.size()+1);
	seg.set(0,make_pair(0,0));
	vector<int>pr(P.size()+1,-1);
	vector<int>inv(P.size()+1,-1);
	for(int i=1;i<=P.size();i++)
	{
		int v=P[i-1];
		inv[v]=i;
		dat t=seg.prod(0,v);
		pr[v]=t.second;
		seg.set(v,make_pair(t.first+1,v));
	}
	dat t=seg.all_prod();
	int ans=P.size()+t.first;
	vector<int>Q;
	Q.push_back(t.second);
	while(true)
	{
		int i=pr[Q.back()];
		if(i==0)break;
		Q.push_back(i);
	}
	reverse(Q.begin(),Q.end());
	for(int&q:Q)q=inv[q];
	vector<int>ret;
	int prv=0;
	priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >pq;
	auto add=[&](int i){
		while(!pq.empty()&&pq.top().first<P[i-1])
		{
			ret.push_back(pq.top().second);
			pq.pop();
		}
		ret.push_back(i);
	};
	for(int q:Q)
	{
		for(int i=prv+1;i<q;i++)
		{
			if(P[i-1]<P[q-1])add(i);
			else pq.push(make_pair(P[i-1],i));
		}
		add(q);
		prv=q;
	}
	for(int i=prv+1;i<=P.size();i++)add(i);
	while(!pq.empty())
	{
		ret.push_back(pq.top().second);
		pq.pop();
	}
	auto f=[&](const vector<int>&Q){
		int ret=0;
		int qm=-1,pm=-1;
		for(int q:Q)
		{
			if(qm<q)qm=q,ret++;
			if(pm<P[q-1])pm=P[q-1],ret++;
		}
		return ret;
	};
	assert(ret.size()==P.size());
	assert(f(ret)==ans);
	for(int i=0;i<ret.size();i++)cout<<ret[i]<<(i+1==ret.size()?"\n":" ");
	return ans;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	for(int N=1;false;N++)
	{
		cout<<"N = "<<N<<endl;
		vector<int>P(N);
		for(int i=0;i<N;i++)P[i]=i+1;
		do{
			//int ans=naive(P);
			int slv=solve(P);
			/*
			if(ans!=slv)
			{
				for(int p:P)cout<<p<<" ";cout<<endl;
				cout<<"ans = "<<ans<<" but slv = "<<slv<<endl;
				assert(false);
			}
			*/
		}while(next_permutation(P.begin(),P.end()));
	}
	int T;cin>>T;
	for(;T--;)
	{
		int N;cin>>N;
		vector<int>P(N);
		for(int i=0;i<N;i++)cin>>P[i];
		solve(P);
	}
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Correct (3 test cases)

Test #2:

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

input:

153
4
2 4 3 1
4
1 4 2 3
5
2 1 4 5 3
5
1 4 5 3 2
4
1 3 2 4
5
1 5 2 4 3
5
5 3 1 2 4
5
4 1 2 5 3
5
1 2 5 3 4
5
3 1 4 2 5
5
5 4 2 3 1
5
2 1 5 4 3
5
3 4 1 5 2
5
1 4 3 5 2
5
5 1 3 4 2
5
5 3 2 4 1
5
1 5 3 2 4
5
2 4 3 1 5
5
1 5 4 3 2
5
1 2 4 5 3
5
4 2 5 3 1
5
1 3 5 2 4
5
3 1 4 5 2
3
2 1 3
5
1 2 4 3 5
5
5 1 ...

output:

1 2 3 4
1 3 4 2
1 2 3 4 5
1 2 3 4 5
1 2 3 4
1 3 4 5 2
3 4 2 5 1
2 3 1 4 5
1 2 4 5 3
1 2 3 4 5
3 4 5 2 1
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
2 3 4 5 1
2 3 4 5 1
1 3 4 5 2
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3
1 2 3 4 5
2 3 4 5 1
3 4 1 5 2
3 4 5 2 1
1 2 3
1 2 3 4
1 2 3 4
1 2 3 4
...

result:

ok Correct (153 test cases)

Test #3:

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

input:

873
6
1 5 2 4 6 3
6
5 1 6 4 3 2
4
1 4 3 2
6
2 1 6 5 4 3
6
4 5 1 3 6 2
6
6 2 1 5 4 3
5
1 5 4 3 2
6
1 2 6 3 5 4
4
2 1 3 4
6
1 6 4 2 3 5
6
6 1 3 5 2 4
6
2 1 4 5 3 6
6
3 4 1 5 2 6
6
4 1 5 2 6 3
6
5 2 1 4 6 3
6
4 1 6 2 3 5
6
5 1 3 4 6 2
6
6 2 5 4 1 3
6
6 2 5 1 4 3
6
5 2 3 6 4 1
6
6 1 2 5 4 3
6
2 3 4 6 1 ...

output:

1 3 4 2 5 6
1 2 3 4 5 6
1 2 3 4
1 2 3 4 5 6
1 2 3 4 5 6
2 3 4 5 6 1
1 2 3 4 5
1 2 4 5 6 3
1 2 3 4
1 4 5 3 6 2
2 3 4 5 6 1
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
2 3 4 1 5 6
2 4 5 1 6 3
2 3 4 1 5 6
2 3 4 5 6 1
2 3 4 5 6 1
2 3 1 4 5 6
2 3 4 5 6 1
1 2 3 4 5 6
1 2 3 4 5 6
2 4 5 1 6 3
1 2 3 4 5 6
1 2 3 5 6 ...

result:

ok Correct (873 test cases)

Test #4:

score: 0
Accepted
time: 7ms
memory: 3860kb

input:

5913
7
2 6 3 4 5 1 7
7
6 2 1 5 7 3 4
7
6 5 3 7 2 4 1
7
5 2 1 7 3 6 4
7
6 3 1 4 5 2 7
6
4 1 5 3 2 6
7
1 7 5 3 4 6 2
7
7 3 2 5 6 4 1
7
4 5 7 3 2 6 1
7
5 3 4 2 6 1 7
6
4 6 1 2 5 3
7
5 3 4 1 2 7 6
3
1 3 2
6
6 1 2 3 5 4
7
5 7 4 6 1 3 2
7
2 3 6 4 7 1 5
7
3 5 6 7 1 4 2
6
2 1 6 5 4 3
7
7 2 1 3 6 5 4
7
4 6 5...

output:

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

result:

ok Correct (5913 test cases)

Test #5:

score: 0
Accepted
time: 52ms
memory: 12144kb

input:

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

output:

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

result:

ok Correct (1 test case)

Test #6:

score: 0
Accepted
time: 74ms
memory: 11912kb

input:

1
199998
159356 10750 153350 164169 60898 196950 131049 134811 60561 70652 176518 102541 105130 65353 149432 130188 173045 164607 163412 153724 32758 147227 182545 85204 57248 16735 82120 111602 57653 159065 22964 103722 109260 9336 171010 86014 69411 157929 59663 125254 16608 189879 107804 171722 6...

output:

64 110 338 782 848 878 985 1012 1071 1329 1346 1694 1704 1763 2032 2442 2447 2460 519 2480 2518 2743 2781 2440 1903 2852 2918 3166 107 2468 3284 1470 1356 1286 1729 3340 3341 3372 3397 3499 528 2803 1434 2429 3560 3817 3861 3953 3964 3969 3999 4304 1365 3092 4328 1221 3534 4384 4467 4527 4569 4591 4...

result:

ok Correct (1 test case)

Test #7:

score: 0
Accepted
time: 68ms
memory: 12000kb

input:

1
199996
156367 73915 97649 141585 131431 35194 94499 149597 90231 68402 176577 126196 34713 113693 83310 180924 120175 156193 133140 4561 70990 99456 103240 121210 81210 107743 55697 132797 23544 154453 157350 125727 196386 110178 192898 57871 51021 38601 73157 32030 40397 73787 113854 194095 83934...

output:

385 1210 1716 1725 1804 1953 2016 2915 3104 3156 3169 3432 3884 4141 4159 4187 4198 4199 4229 4507 4624 4684 872 3869 2139 937 3622 2034 81 4895 4941 4959 4991 5349 5450 5557 4109 1068 908 5617 5659 5806 6056 4603 5229 2614 3306 4920 4501 4612 3972 901 6102 919 2687 6108 6221 1459 811 4646 6230 6249...

result:

ok Correct (1 test case)

Test #8:

score: 0
Accepted
time: 73ms
memory: 11840kb

input:

1
199998
98505 79151 87039 2 8 70517 9 158359 171019 186783 152554 4317 101323 16 21 7500 22 26 41 63419 178156 42 41526 43466 72590 51657 174757 157400 48 49 51 66204 129927 175402 35852 54 56 197638 107370 32158 58498 127659 89402 65 104664 129513 187594 72 191798 149749 8858 157141 192786 73 1462...

output:

4 5 7 14 15 17 18 19 22 29 30 31 36 37 44 48 54 58 64 68 69 71 72 75 81 83 85 86 98 101 107 108 111 112 116 118 119 120 127 128 132 135 137 138 139 142 145 146 149 150 153 158 161 165 166 167 169 174 176 177 178 182 184 185 186 189 191 193 205 207 212 213 214 219 224 227 228 231 232 234 235 237 241 ...

result:

ok Correct (1 test case)

Test #9:

score: 0
Accepted
time: 71ms
memory: 11916kb

input:

1
199998
73517 194602 5 111588 68425 192815 25134 92278 84469 33841 158795 71227 8 120655 190420 187346 192801 183788 95375 90457 70190 81113 9 9389 118156 10 66216 106656 65445 149875 12 19 163255 94699 167297 144213 17999 29143 75988 21 106202 12996 193475 104553 1402 60665 84193 174139 174714 120...

output:

3 13 23 26 31 32 40 54 66 77 79 93 95 96 105 107 120 129 130 136 137 147 148 149 157 160 167 168 170 175 186 190 196 202 205 212 230 233 234 240 243 246 247 249 250 258 259 260 262 282 287 294 304 311 312 313 315 321 322 332 342 347 361 363 373 374 380 384 387 389 400 401 403 412 420 425 426 427 429...

result:

ok Correct (1 test case)

Test #10:

score: 0
Accepted
time: 52ms
memory: 12108kb

input:

1
200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 79724 17 18 19 20 21 22 23 24 137155 25 26 27 28 29 30 31 32 33 34 35 155516 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 24879 65 66 67 69 70 71 72 74 75 77 78 79 80 81 132399 82 83 84 85 86 56535 87 88 89 90 91 ...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 34 35 36 37 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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 10...

result:

ok Correct (1 test case)

Test #11:

score: 0
Accepted
time: 56ms
memory: 12144kb

input:

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

output:

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

result:

ok Correct (1 test case)

Test #12:

score: 0
Accepted
time: 52ms
memory: 12156kb

input:

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

output:

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

result:

ok Correct (1 test case)

Test #13:

score: 0
Accepted
time: 68ms
memory: 11896kb

input:

1
200000
30974 121063 167953 12100 50579 164098 148209 124533 884 159163 76691 24130 103098 191960 142802 164511 196543 42000 145348 7612 136181 77714 111474 111270 159227 171383 101731 181697 190181 168357 54977 118274 110665 111243 20989 47455 139664 126116 149561 118233 32712 188535 188401 21923 ...

output:

202 960 1065 648 1242 1267 1396 549 9 1613 1697 1050 2042 1381 1199 905 2171 2193 2250 2406 2529 401 2747 2784 1872 1393 676 365 421 2857 2044 2608 1703 649 1376 1973 2607 1673 275 809 778 314 1990 722 1900 2998 3043 3127 3199 3249 1133 952 510 504 1529 2613 3262 3348 3363 3520 3540 3546 3558 3576 3...

result:

ok Correct (1 test case)

Test #14:

score: 0
Accepted
time: 57ms
memory: 12192kb

input:

1
199997
118022 2 87562 3 19823 105259 61919 4 6 111584 7 8 11 100287 12 13 111157 112063 98915 14 19 168521 20 21 24 25 17951 159194 26 28 29 120902 32 33 38 39 41 190563 95904 111192 119677 57550 42 43 42336 51 129733 144409 148266 54 2150 55 58 149147 66 67 68 70509 70 72 8068 185456 73 74 132091...

output:

2 4 8 9 11 12 13 15 16 20 21 23 24 25 26 29 30 31 33 34 35 36 37 43 44 46 50 52 53 55 56 57 59 60 63 64 66 67 69 71 72 74 76 77 78 80 84 89 90 91 93 94 95 96 98 99 101 102 104 105 106 108 111 112 114 115 116 118 119 120 121 122 124 127 130 134 136 137 138 142 143 144 146 147 148 149 151 153 155 156 ...

result:

ok Correct (1 test case)

Test #15:

score: 0
Accepted
time: 72ms
memory: 11092kb

input:

2
53064
2 3 5 6 8 12079 40252 24881 9 9068 10 11 40481 9588 12 42587 19 46902 35223 10513 27953 20 897 33128 22 23 24 26 28 31 321 29136 32 23363 34 41837 29496 35 49952 8874 36 45434 39 6124 42 45 50819 8334 46 39948 6396 448 40510 18250 45656 48 49 32201 4775 51 52 53 22249 33414 54 32961 56 58 62...

output:

1 2 3 4 5 9 11 12 15 17 22 25 26 27 28 29 30 33 35 38 41 43 45 46 49 56 57 60 61 62 65 67 68 69 70 72 73 78 79 81 83 87 93 94 95 96 97 99 100 102 104 106 107 108 109 110 111 112 113 115 117 118 119 121 122 126 127 131 133 134 138 142 143 146 152 153 155 157 159 160 162 163 164 166 167 168 169 170 17...

result:

ok Correct (2 test cases)

Test #16:

score: 0
Accepted
time: 50ms
memory: 8092kb

input:

2
86135
86135 86134 86133 86132 86131 86130 86129 86128 86127 86126 86125 86124 86123 86122 86121 86120 86119 86118 86117 86116 86115 86114 86113 86112 86111 86110 86109 86108 86107 86106 86105 86104 86103 86102 86101 86100 86099 86098 86097 86096 86095 86094 86093 86092 86091 86090 86089 86088 8608...

output:

8393 27067 47591 47592 47593 47594 47595 47596 47597 47598 47599 47600 47601 47602 47603 47604 47605 47606 47607 47608 47609 47610 47611 47612 47613 47614 47615 47616 47617 47618 47619 47620 47621 47622 47623 47624 47625 47626 47627 47628 47629 47630 47631 47632 47633 47634 47635 47636 47637 47638 4...

result:

ok Correct (2 test cases)

Test #17:

score: 0
Accepted
time: 64ms
memory: 8036kb

input:

2
114819
47642 61038 22397 92750 16235 33773 60172 108370 74901 4486 5301 37119 80308 33979 76639 57751 65494 24159 24383 52273 109212 102076 10634 94818 12177 87060 89859 48179 94154 26702 3395 100096 34474 5173 30593 88815 30980 107578 108820 30868 29642 38547 10453 71690 65321 70841 7733 22394 10...

output:

88 111 274 428 444 479 493 604 408 610 644 649 715 756 903 966 1069 1124 1174 1225 1230 1292 1299 1338 495 1476 1542 1691 1715 1741 1752 1168 1804 1198 1164 503 220 830 1057 944 1195 1976 90 1104 1979 2016 2094 2240 2295 2309 2314 2341 2378 1636 2388 2397 2428 803 2440 2456 2502 2514 2599 2605 2610 ...

result:

ok Correct (2 test cases)

Test #18:

score: 0
Accepted
time: 61ms
memory: 11252kb

input:

2
51745
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 46595 89 90 91 92 93 94 95 96 97 98 99 1...

output:

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103...

result:

ok Correct (2 test cases)

Test #19:

score: 0
Accepted
time: 52ms
memory: 12160kb

input:

2
190655
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...

output:

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

result:

ok Correct (2 test cases)

Test #20:

score: 0
Accepted
time: 52ms
memory: 11032kb

input:

2
50532
50532 50531 50530 4582 50528 50527 50526 50525 50524 50523 50522 50521 50520 50519 50518 50517 50516 50515 50514 50513 50512 50511 50510 50509 50508 50507 50506 50505 50504 50503 50502 50501 50500 50499 50498 50497 50496 50495 50494 50493 50492 50491 50490 50489 50488 50487 50486 50485 50484...

output:

4 77 7161 15150 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18...

result:

ok Correct (2 test cases)

Test #21:

score: 0
Accepted
time: 67ms
memory: 11712kb

input:

2
48027
48027 48026 48025 48024 48023 48022 48021 48020 48019 48018 48017 48016 48015 48014 48013 48012 48011 48010 48009 48008 48007 48006 48005 48004 48003 48002 48001 48000 47999 47998 47997 47996 47995 47994 47993 47992 47991 47990 47989 47988 47987 47986 47985 47984 47983 47982 47981 47980 4797...

output:

5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 ...

result:

ok Correct (2 test cases)

Test #22:

score: 0
Accepted
time: 68ms
memory: 11064kb

input:

2
49149
45766 44322 13524 49120 34313 14453 22762 45456 41101 33066 37810 6641 41698 20814 13880 43329 11181 45323 32254 23011 45806 45872 40933 31796 19164 38537 42260 43496 38735 36980 37199 46512 40784 2549 39978 15892 15157 33270 28109 42921 1752 3868 18354 5145 7481 29180 32231 4790 42843 28705...

output:

62 283 467 54 557 158 581 635 321 80 636 115 653 596 456 696 735 750 769 301 780 824 831 832 841 853 864 866 873 933 946 1001 1071 1102 541 825 449 279 81 630 1121 1144 1208 1335 1340 1382 1388 1390 1408 1416 1437 1438 1499 1505 1549 1598 1599 1605 90 779 1253 1607 1710 1725 1753 1755 1777 1787 1816...

result:

ok Correct (2 test cases)

Test #23:

score: 0
Accepted
time: 50ms
memory: 7852kb

input:

2
105395
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 61609 23 24 25 26 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49 50 51 52 53 55 56 44318 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 93 94 31882 95 96 97 98 ...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 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 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 94 95 96 97 98 99 100 101 102 103 104 1...

result:

ok Correct (2 test cases)

Test #24:

score: 0
Accepted
time: 54ms
memory: 7860kb

input:

2
114532
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...

output:

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

result:

ok Correct (2 test cases)

Test #25:

score: 0
Accepted
time: 69ms
memory: 11276kb

input:

3
509
509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 218 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 423 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 43...

output:

28 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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 1...

result:

ok Correct (3 test cases)

Test #26:

score: 0
Accepted
time: 62ms
memory: 7748kb

input:

4
25729
20211 20067 14578 18311 17364 8977 10955 7789 20973 12765 10672 17087 2155 11717 13581 2775 14625 19352 3147 15942 13111 4876 15266 5564 19286 21127 18956 11282 9474 3384 14545 12111 14039 9216 211 21798 12568 7663 19844 23275 15780 24373 24393 4460 11442 1025 16311 16345 8513 7746 3458 3671...

output:

35 99 130 133 160 129 249 290 299 337 374 378 273 46 389 392 60 394 398 405 427 437 445 317 473 480 574 620 622 246 632 637 648 653 672 680 191 71 341 353 691 295 710 403 586 722 761 285 647 484 772 790 810 826 828 836 851 860 881 902 905 921 959 983 986 1012 1018 1036 114 684 1056 1093 1094 1125 11...

result:

ok Correct (4 test cases)

Test #27:

score: 0
Accepted
time: 65ms
memory: 7436kb

input:

5
7824
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 1...

output:

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

result:

ok Correct (5 test cases)

Test #28:

score: 0
Accepted
time: 62ms
memory: 7096kb

input:

6
7149
1 6 3300 108 5212 4381 2962 7132 9 14 15 2713 2358 18 97 19 1438 1621 25 26 4487 6123 28 33 6200 137 3898 38 3629 4354 4560 39 40 3621 44 1803 6036 4036 1747 45 2716 1197 46 3062 48 791 49 6131 4035 52 2442 53 219 56 60 61 65 5119 68 1215 70 72 74 75 76 79 80 81 83 2678 3406 85 1734 86 87 189...

output:

1 2 9 10 11 14 16 19 20 23 24 28 32 33 35 40 43 45 47 50 52 54 55 56 57 59 61 62 63 64 65 66 67 68 69 72 74 75 77 80 81 15 82 83 4 85 86 90 92 93 95 96 99 101 108 110 114 119 120 26 124 126 127 128 130 135 138 141 143 146 148 152 155 156 159 160 161 163 164 165 168 170 171 173 174 175 177 178 180 18...

result:

ok Correct (6 test cases)

Test #29:

score: 0
Accepted
time: 60ms
memory: 7992kb

input:

7
16819
16819 16818 16817 16816 16815 16814 16813 16812 16811 16810 16809 16808 16807 16806 16805 16804 16803 16802 16801 16800 16799 16798 16797 16796 16795 16794 16793 16792 16791 16790 16789 16788 16787 16786 16785 16784 16783 16782 16781 16780 16779 16778 16777 16776 16775 16774 16773 16772 1677...

output:

366 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2...

result:

ok Correct (7 test cases)

Test #30:

score: 0
Accepted
time: 60ms
memory: 7416kb

input:

8
29021
10222 11342 22280 369 11843 9665 3980 8073 2610 18065 18445 16127 13357 22715 12601 985 6693 14535 9819 3527 28638 11358 19593 16379 23694 11672 6310 26298 1682 6919 24373 24923 25103 14059 9413 21658 3996 6139 13267 10845 19838 5125 28643 7211 8305 10766 13203 16405 26653 23720 28866 22039 ...

output:

4 54 63 67 82 115 126 159 16 173 193 207 65 213 234 267 128 29 273 276 287 291 296 313 317 338 348 377 392 394 413 414 441 81 298 451 457 461 470 472 475 476 489 490 518 533 201 92 380 553 565 580 589 590 598 610 613 620 623 627 628 631 648 188 415 656 657 659 328 330 9 453 660 662 663 677 688 693 7...

result:

ok Correct (8 test cases)

Test #31:

score: 0
Accepted
time: 61ms
memory: 5556kb

input:

9
37136
37136 37135 37134 37133 37132 37131 37130 37129 37128 37127 37126 37125 37124 37123 37122 37121 37120 37119 37118 37117 37116 37115 37114 37113 37112 37111 37110 37109 37108 37107 37106 37105 37104 37103 37102 37101 37100 37099 37098 37097 37096 37095 37094 37093 37092 37091 37090 37089 3708...

output:

2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 ...

result:

ok Correct (9 test cases)

Test #32:

score: 0
Accepted
time: 58ms
memory: 5732kb

input:

10
5543
4867 587 1 2 5 4153 7 8 9 10 3205 2299 13 2501 3733 4939 14 1921 15 577 4169 16 2794 20 24 25 28 30 2508 1346 32 3535 36 2642 38 4209 40 5044 2983 440 45 2522 3560 1769 47 50 51 53 54 56 4498 3939 57 3701 58 63 3893 3222 64 3285 66 3226 67 68 69 70 71 72 453 73 4493 76 77 3521 4075 78 79 121...

output:

3 4 5 7 8 9 10 13 17 19 22 24 25 26 27 28 31 33 35 37 41 45 46 47 48 49 50 53 55 56 59 61 63 64 65 66 67 68 70 72 73 76 77 80 83 85 87 88 90 93 96 97 99 100 101 102 103 104 106 107 110 111 114 115 119 121 122 125 126 127 130 131 133 134 135 139 142 143 144 145 147 152 153 156 158 160 161 162 163 164...

result:

ok Correct (10 test cases)

Test #33:

score: 0
Accepted
time: 54ms
memory: 5172kb

input:

11
13188
3211 4858 1756 11101 7924 3 7258 6541 9725 4436 1705 13094 5325 4336 1837 13034 621 6463 6292 10855 5617 8390 10267 10347 7086 1503 10273 6741 256 3883 1819 8243 6908 9189 4 7 1571 9 5143 6716 10 8547 12119 4535 6815 12782 9155 12 5080 9550 8496 4432 11660 12321 10927 12071 345 12774 8890 4...

output:

6 35 36 38 41 48 61 67 70 97 101 102 105 111 120 122 134 139 147 167 181 182 183 194 195 197 176 199 200 203 211 216 222 225 232 236 238 247 249 252 255 263 272 29 274 277 278 281 286 287 288 291 301 305 315 89 319 327 344 346 347 57 356 366 373 375 376 377 237 382 386 391 408 434 435 437 438 455 45...

result:

ok Correct (11 test cases)

Test #34:

score: 0
Accepted
time: 60ms
memory: 5580kb

input:

12
14387
2032 2092 7297 5303 9380 6643 1162 8743 13244 10344 7779 8685 4162 6630 13229 9206 13492 3549 1646 6533 12121 7138 425 4605 6117 4656 14074 7015 11462 12023 12147 12647 8475 5979 12365 4217 12160 12753 13137 6811 7606 8037 11753 7339 13498 5059 9144 10048 340 1598 7238 1061 10786 3374 13104...

output:

140 152 106 167 198 218 64 266 267 49 295 23 110 349 375 243 211 162 85 209 76 112 141 408 433 313 191 436 455 476 493 497 291 351 290 499 524 146 557 376 456 108 131 52 145 377 559 568 569 571 580 585 587 595 315 540 7 116 205 352 447 618 644 661 662 664 673 683 687 702 707 709 712 718 730 732 737 ...

result:

ok Correct (12 test cases)

Test #35:

score: 0
Accepted
time: 58ms
memory: 5104kb

input:

13
31585
25526 23165 15629 16745 22764 15380 17226 175 21983 4024 18503 7138 13386 29184 14458 20426 13711 5129 27026 1014 29177 13497 6929 1511 29414 227 1665 11904 25568 13620 24853 30180 17753 17190 14470 13883 31127 20692 22539 18320 11973 29075 17299 20722 8431 14274 2211 31142 17570 8120 11017...

output:

8 26 70 103 122 141 148 155 173 205 267 307 382 398 426 20 104 176 128 164 438 442 463 331 118 501 508 525 83 221 529 530 541 24 390 406 65 27 239 485 554 560 578 588 603 626 660 662 671 685 714 723 727 524 737 763 764 767 769 387 229 414 423 375 450 399 773 799 191 822 830 834 836 381 507 47 345 68...

result:

ok Correct (13 test cases)

Test #36:

score: 0
Accepted
time: 58ms
memory: 7248kb

input:

14
5319
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 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 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 ...

result:

ok Correct (14 test cases)

Test #37:

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

input:

15
5328
1 2 4 5 6 3529 7 8 9 11 12 3777 13 14 15 997 16 4447 19 5048 20 23 24 25 2918 26 27 28 2202 31 32 33 3143 569 34 4812 2403 35 36 38 39 2088 40 42 43 4041 44 370 4824 3639 2720 4401 45 46 48 49 50 51 53 54 55 56 2024 57 59 2586 3395 60 62 63 65 66 69 1156 71 72 73 74 75 76 77 78 79 80 933 677...

output:

1 2 3 4 5 7 8 9 10 11 13 14 15 17 19 21 22 23 24 26 27 28 30 31 32 35 38 39 40 41 43 44 45 47 53 54 55 56 57 58 59 60 61 62 64 65 68 69 70 71 72 73 75 76 77 78 79 80 81 82 83 84 88 89 91 92 93 94 95 96 97 99 101 102 103 105 107 109 111 112 113 114 115 116 117 118 119 120 121 123 124 125 127 128 130 ...

result:

ok Correct (15 test cases)

Test #38:

score: 0
Accepted
time: 49ms
memory: 4020kb

input:

100
2336
1793 2295 1529 43 168 1116 1484 1521 2242 2028 1733 1104 543 586 667 822 2254 391 1981 857 348 493 1948 1790 1834 1726 1800 1112 1416 425 193 995 971 1098 247 1477 1261 1962 1827 803 1503 1308 1345 1490 218 2260 1310 621 347 1320 228 2078 166 1108 1973 1397 2174 1619 1075 1941 289 843 665 8...

output:

4 5 31 45 51 53 35 61 65 74 76 87 90 49 21 18 92 95 30 105 22 110 111 118 119 121 122 129 131 134 145 146 13 89 14 153 156 158 166 176 177 179 193 196 197 199 202 207 209 48 127 75 212 214 221 224 227 233 242 243 244 250 251 253 254 263 267 268 270 271 272 275 63 15 277 279 287 289 290 291 292 296 3...

result:

ok Correct (100 test cases)

Test #39:

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

input:

101
92
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 89 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 84 65 66 67 68 69 70 71 72 75 74 73 76 77 78 79 80 38 82 83 64 85 86 87 88 81 90 91 92
2647
1 2 3 4 5 6 7 8 9 10 ...

output:

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 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 64 85 86 87 88 89 38 90 91 92
1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...

result:

ok Correct (101 test cases)

Test #40:

score: 0
Accepted
time: 49ms
memory: 4056kb

input:

102
8381
1 4352 3358 4986 3 5 6 1414 10 18 19 3394 2419 2109 6485 5679 5207 20 21 22 24 577 1288 803 25 28 29 7663 34 36 37 1285 40 264 4636 41 7646 5678 44 3431 3393 1768 45 4655 500 7162 7025 3214 46 47 7361 6879 50 3013 7816 51 2940 3412 820 276 1408 52 14 3151 8140 54 4708 56 4215 64 65 66 4887 ...

output:

1 5 6 7 9 10 11 18 19 20 21 25 26 27 29 30 31 33 36 39 43 49 50 53 56 62 63 66 68 70 71 72 75 76 78 80 84 86 87 91 92 93 98 100 102 103 104 110 113 114 116 117 118 119 120 121 123 126 127 129 130 132 135 137 139 141 143 145 147 150 156 160 161 162 165 166 167 168 171 172 173 177 178 124 180 181 182 ...

result:

ok Correct (102 test cases)

Test #41:

score: 0
Accepted
time: 50ms
memory: 3784kb

input:

103
1976
917 2 4 551 8 10 11 131 12 13 1309 15 681 16 18 1762 19 20 1972 21 1072 22 23 25 29 124 31 32 33 454 34 35 39 40 41 42 43 45 46 47 48 1716 1593 1560 1362 50 1932 51 1138 52 53 54 58 633 60 36 61 62 63 64 65 283 671 1094 1037 66 1039 67 68 70 1844 71 1700 387 72 74 110 75 76 30 1220 77 78 79...

output:

2 3 5 6 7 9 10 12 14 15 17 18 20 22 23 24 25 27 28 29 31 32 33 34 35 36 37 38 39 40 41 46 48 50 51 52 53 55 56 57 58 59 60 61 66 68 69 70 72 75 76 78 79 80 82 83 84 85 88 91 92 94 95 96 97 98 99 101 102 103 105 106 107 109 111 113 114 115 116 118 119 77 121 122 125 126 90 127 128 129 130 26 131 132 ...

result:

ok Correct (103 test cases)

Test #42:

score: 0
Accepted
time: 45ms
memory: 4000kb

input:

104
3135
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...

output:

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

result:

ok Correct (104 test cases)

Test #43:

score: 0
Accepted
time: 44ms
memory: 3768kb

input:

105
1344
1188 1079 853 842 1311 994 127 322 970 1289 1274 871 727 1005 647 1195 656 1329 849 1266 1006 345 874 1175 101 968 934 387 129 979 776 1106 917 771 773 441 759 392 1343 954 1165 50 1164 1330 83 113 75 858 430 953 98 351 1178 287 616 139 344 539 1333 384 950 1231 611 601 1249 269 813 671 112...

output:

85 109 118 121 42 138 143 154 132 47 45 166 174 86 89 51 25 183 184 46 145 196 231 148 7 29 56 234 236 159 76 156 251 252 253 260 265 274 281 287 291 294 296 157 99 87 303 308 314 315 334 105 257 75 250 337 339 340 348 361 365 369 201 387 392 288 347 170 256 246 323 360 282 66 83 165 84 332 203 254 ...

result:

ok Correct (105 test cases)

Test #44:

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

input:

1000
1284
241 188 967 1220 11 1230 586 1170 427 128 978 1185 765 1103 125 191 915 80 815 1091 137 803 543 1236 278 650 253 1041 307 1074 1245 1239 664 548 953 788 713 1129 863 205 614 293 452 386 152 933 718 259 911 698 323 261 33 63 937 757 1254 32 405 922 1223 626 473 549 1168 606 320 554 277 401 ...

output:

5 53 54 58 81 119 120 124 18 149 116 95 82 170 15 198 10 101 21 99 199 211 147 45 169 114 217 218 219 244 249 252 255 269 271 153 148 2 16 40 284 303 310 313 320 130 78 92 1 278 321 322 325 328 27 48 52 132 229 209 330 333 334 105 245 69 25 163 195 115 340 341 347 42 213 164 210 299 305 29 185 222 3...

result:

ok Correct (1000 test cases)

Test #45:

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

input:

1001
151
151 150 149 148 147 146 145 144 143 142 141 140 60 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 97 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 116 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 ...

output:

13 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 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109...

result:

ok Correct (1001 test cases)

Test #46:

score: 0
Accepted
time: 43ms
memory: 4024kb

input:

1002
182
166 43 93 41 106 127 57 135 170 73 182 92 119 22 46 55 66 130 117 49 21 30 138 151 47 88 131 25 171 112 132 108 174 10 167 142 62 125 175 146 34 156 71 120 32 86 61 128 35 159 96 72 59 45 102 9 7 65 107 94 91 20 121 77 5 3 82 139 56 176 80 155 104 4 180 95 44 116 145 69 158 111 12 78 38 165...

output:

14 21 22 28 34 41 45 49 56 57 62 65 66 74 83 85 4 88 2 77 54 15 25 20 90 92 93 16 69 7 96 53 97 99 47 37 58 17 80 43 52 10 100 101 102 105 64 84 91 71 89 67 108 111 46 26 114 115 61 12 3 60 76 51 117 55 73 106 5 59 32 118 119 120 82 30 103 109 78 19 13 44 63 112 121 123 125 126 38 6 48 18 27 31 94 8...

result:

ok Correct (1002 test cases)

Test #47:

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

input:

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

output:

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

result:

ok Correct (1003 test cases)

Test #48:

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

input:

1004
322
89 11 228 2 212 162 244 287 8 5 220 261 227 126 151 12 14 16 21 32 22 41 122 233 142 23 31 27 34 43 225 94 198 47 48 146 49 190 298 61 51 76 53 55 110 81 56 221 37 138 58 107 64 66 158 67 3 68 69 91 70 71 117 77 239 86 165 176 19 251 83 109 78 80 82 33 10 15 102 85 87 273 196 28 93 52 97 99...

output:

4 9 10 2 16 17 18 19 21 26 27 28 20 29 22 30 34 35 37 41 43 44 47 49 51 40 53 54 56 57 58 59 61 62 42 64 69 73 74 46 75 76 77 78 71 80 66 81 84 1 60 85 86 32 87 88 79 89 52 90 92 72 45 93 94 95 96 97 63 98 23 99 100 101 102 14 103 104 105 106 107 109 111 113 50 115 116 117 25 120 121 123 124 36 125 ...

result:

ok Correct (1004 test cases)

Test #49:

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

input:

1005
508
132 76 426 29 334 493 502 458 205 35 80 307 14 358 339 146 440 171 233 508 124 445 498 118 257 104 116 125 112 77 184 211 40 96 99 456 13 155 122 366 24 342 399 200 4 293 210 484 338 239 164 273 179 454 270 66 78 61 49 496 315 421 160 86 303 223 91 499 170 457 253 79 246 143 506 20 310 175 ...

output:

4 10 13 33 37 41 45 56 2 30 57 58 59 11 64 67 72 76 80 85 88 34 35 26 95 100 104 29 106 27 24 39 21 28 112 113 115 1 74 16 38 63 51 110 118 119 121 123 126 69 18 107 78 53 31 44 9 97 47 32 66 87 19 50 73 128 129 130 71 25 131 55 52 114 120 98 133 134 135 138 139 46 116 111 86 65 12 105 140 143 144 1...

result:

ok Correct (1005 test cases)

Test #50:

score: 0
Accepted
time: 37ms
memory: 3692kb

input:

10000
15
15 14 6 8 11 12 9 7 10 13 5 3 4 2 1
3
1 2 3
34
13 28 32 2 33 29 7 4 16 11 20 14 25 3 17 15 27 6 9 19 22 31 23 5 8 10 26 30 34 21 1 12 18 24
3
3 1 2
25
1 18 12 14 10 17 20 5 8 15 9 21 22 11 4 19 24 13 2 16 3 7 6 25 23
11
5 2 1 7 3 11 6 9 10 4 8
29
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18...

output:

3 4 5 6 7 8 9 10 11 12 13 14 15 2 1
1 2 3
4 7 8 10 1 12 14 9 15 16 18 19 20 11 21 23 24 25 26 13 27 17 2 6 28 22 3 5 29 30 31 32 33 34
2 3 1
1 3 4 5 6 2 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
2 3 5 1 7 4 8 9 10 11 6
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 ...

result:

ok Correct (10000 test cases)

Test #51:

score: 0
Accepted
time: 37ms
memory: 3720kb

input:

10001
19
1 2 6 4 5 3 7 9 8 10 13 18 11 12 15 16 17 14 19
7
4 3 1 7 5 2 6
4
3 4 1 2
19
17 3 4 10 19 7 12 2 18 1 11 13 15 14 5 6 16 8 9
11
4 9 10 3 8 2 5 1 6 11 7
14
7 5 9 3 14 11 1 8 4 10 2 12 13 6
7
1 2 7 6 3 4 5
1
1
18
17 10 8 13 16 6 3 1 15 2 9 14 7 18 12 11 5 4
48
1 21 3 27 5 20 7 8 9 10 39 12 14...

output:

1 2 4 5 6 3 7 8 9 10 13 14 11 15 16 17 18 12 19
1 2 3 5 6 7 4
1 2 3 4
2 3 4 6 7 8 10 11 12 13 14 15 16 17 18 19 1 9 5
1 2 3 4 5 6 7 8 9 10 11
1 2 3 4 6 7 8 9 10 11 12 13 14 5
1 2 5 6 7 4 3
1
8 10 7 6 3 11 2 4 12 13 9 5 1 14 15 16 17 18
1 3 5 7 8 9 10 12 13 14 16 17 18 19 20 21 22 6 2 15 23 24 25 26 ...

result:

ok Correct (10001 test cases)

Test #52:

score: 0
Accepted
time: 38ms
memory: 3692kb

input:

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

output:

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

result:

ok Correct (10002 test cases)

Test #53:

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

input:

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

output:

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

result:

ok Correct (10003 test cases)

Test #54:

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

input:

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

output:

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

result:

ok Correct (10004 test cases)

Test #55:

score: 0
Accepted
time: 37ms
memory: 3760kb

input:

10005
1
1
6
1 5 3 6 4 2
14
8 14 12 5 7 13 9 4 6 11 3 10 1 2
5
1 2 3 4 5
8
8 7 6 5 4 3 2 1
16
8 1 4 3 5 7 11 9 13 10 2 12 6 14 15 16
11
5 11 9 4 6 3 7 10 1 8 2
35
16 11 13 33 12 30 21 9 20 22 19 7 4 34 28 23 5 8 14 3 6 1 2 17 10 24 31 26 18 35 29 32 25 27 15
35
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...

output:

1
1 2 3 4 5 6
4 5 1 7 8 9 10 11 12 13 14 3 6 2
1 2 3 4 5
1 2 3 4 5 6 7 8
2 3 4 5 6 1 8 10 11 7 12 13 9 14 15 16
1 4 5 6 7 3 8 9 10 11 2
2 3 5 1 7 8 9 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 28 29 15 31 6 27 32 33 34 35 4 14 30
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...

result:

ok Correct (10005 test cases)

Test #56:

score: 0
Accepted
time: 39ms
memory: 3860kb

input:

99995
1
1
3
2 1 3
2
1 2
3
3 1 2
1
1
1
1
2
2 1
2
1 2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2 1
5
1 5 3 4 2
1
1
1
1
1
1
1
1
1
1
5
1 2 3 4 5
2
1 2
1
1
1
1
2
1 2
2
1 2
4
3 1 2 4
2
1 2
5
2 5 3 1 4
2
2 1
1
1
4
1 2 3 4
4
1 2 3 4
3
3 2 1
2
1 2
2
2 1
1
1
3
3 1 2
1
1
3
2 3 1
5
3 1 5 2 4
2
1 2
1
1
6
4 1 3 5 2 6
1
...

output:

1
1 2 3
1 2
2 3 1
1
1
1 2
1 2
1
1
1
1
1
1
1
1
1 2
1 3 4 5 2
1
1
1
1
1
1 2 3 4 5
1 2
1
1
1 2
1 2
2 3 1 4
1 2
1 3 4 5 2
1 2
1
1 2 3 4
1 2 3 4
1 2 3
1 2
1 2
1
2 3 1
1
1 2 3
2 4 1 5 3
1 2
1
2 3 1 4 5 6
1
1
1
1
1 2
1 2
1 2 3
1 2
1 2
1 2 3 4
1
1 2
1
1
1
1 2
1
1
1 2 3
1 2
1 2
1 2
1
1 2 3
1
1
1 2
1 2 3 4
1
...

result:

ok Correct (99995 test cases)

Test #57:

score: 0
Accepted
time: 38ms
memory: 3592kb

input:

99996
2
1 2
1
1
1
1
1
1
1
1
1
1
1
1
2
2 1
1
1
1
1
1
1
4
3 4 2 1
2
1 2
2
1 2
1
1
1
1
2
1 2
2
1 2
1
1
1
1
2
2 1
2
1 2
1
1
3
2 3 1
2
1 2
1
1
1
1
1
1
1
1
1
1
2
1 2
4
1 2 3 4
1
1
3
2 3 1
1
1
2
1 2
1
1
2
1 2
4
1 2 3 4
1
1
2
2 1
5
5 4 3 2 1
1
1
3
1 2 3
1
1
1
1
4
1 2 3 4
4
1 4 3 2
2
1 2
2
1 2
1
1
2
1 2
4
1 ...

output:

1 2
1
1
1
1
1
1
1 2
1
1
1
1 2 3 4
1 2
1 2
1
1
1 2
1 2
1
1
1 2
1 2
1
1 2 3
1 2
1
1
1
1
1
1 2
1 2 3 4
1
1 2 3
1
1 2
1
1 2
1 2 3 4
1
1 2
1 2 3 4 5
1
1 2 3
1
1
1 2 3 4
1 2 3 4
1 2
1 2
1
1 2
1 2 3 4
1
1
1 2 3 4
1
1 2 3 4
1
1 2
1 2 3
1 2
1
1 2
1 2
1
1 2 3
1 2
1
1
1 2
1
1 2 3
1 2 3 4
1 2 3 4
1
1 2
2 3 1 4
...

result:

ok Correct (99996 test cases)

Test #58:

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

input:

99997
1
1
2
1 2
1
1
1
1
1
1
1
1
2
1 2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2 1
1
1
3
1 2 3
4
4 2 3 1
4
4 2 3 1
8
8 5 7 2 1 3 6 4
2
2 1
1
1
1
1
1
1
2
1 2
3
1 2 3
3
1 3 2
2
1 2
1
1
3
1 2 3
2
1 2
4
3 1 2 4
2
1 2
2
1 2
1
1
2
2 1
1
1
7
1 2 3 4 5 6 7
1
1
1
1
1
1
1
1
2
1 2
2
2 1
1
1
2
1 2
2
1 2
1
1
1
1
1
1
1
1
3
...

output:

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

result:

ok Correct (99997 test cases)

Test #59:

score: 0
Accepted
time: 38ms
memory: 3592kb

input:

99998
2
1 2
4
2 1 4 3
3
3 2 1
1
1
2
1 2
1
1
2
1 2
1
1
4
2 1 3 4
2
1 2
3
3 1 2
3
1 2 3
1
1
1
1
1
1
2
1 2
6
2 1 3 4 5 6
1
1
1
1
2
1 2
1
1
4
1 3 2 4
1
1
2
1 2
1
1
1
1
1
1
4
4 3 2 1
6
2 1 4 3 5 6
1
1
1
1
3
1 2 3
1
1
1
1
1
1
5
1 4 5 3 2
1
1
1
1
6
5 1 2 6 3 4
1
1
2
1 2
1
1
6
1 2 3 4 5 6
1
1
5
1 2 3 4 5
1
...

output:

1 2
1 2 3 4
1 2 3
1
1 2
1
1 2
1
1 2 3 4
1 2
2 3 1
1 2 3
1
1
1
1 2
1 2 3 4 5 6
1
1
1 2
1
1 2 3 4
1
1 2
1
1
1
1 2 3 4
1 2 3 4 5 6
1
1
1 2 3
1
1
1
1 2 3 4 5
1
1
2 3 5 6 1 4
1
1 2
1
1 2 3 4 5 6
1
1 2 3 4 5
1
1
1
1 2 3
1 2
1 2
1
1
1
1 2
1
1 2 3
1
1 2
1 2 3 4
1 2
1 2
1 2 3
1 2
1
1 2
1
1
1
1 2 3 4
1
1 2 3 ...

result:

ok Correct (99998 test cases)

Test #60:

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

input:

99999
1
1
1
1
5
1 2 3 4 5
1
1
3
3 1 2
2
1 2
1
1
7
7 5 1 3 2 4 6
2
2 1
5
1 2 4 3 5
1
1
5
1 2 3 4 5
2
1 2
3
3 2 1
2
2 1
2
1 2
2
2 1
3
2 3 1
1
1
1
1
1
1
2
1 2
1
1
1
1
1
1
1
1
4
2 4 1 3
1
1
1
1
1
1
1
1
1
1
2
1 2
1
1
1
1
1
1
1
1
1
1
5
2 5 3 4 1
3
1 2 3
2
2 1
1
1
1
1
1
1
2
2 1
1
1
1
1
2
1 2
2
1 2
3
1 2 3
...

output:

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

result:

ok Correct (99999 test cases)

Test #61:

score: 0
Accepted
time: 34ms
memory: 3888kb

input:

100000
3
1 2 3
4
4 3 2 1
5
5 1 2 4 3
2
1 2
2
1 2
3
3 2 1
1
1
1
1
3
3 2 1
4
2 3 4 1
1
1
1
1
2
2 1
1
1
1
1
7
7 2 3 1 4 5 6
5
1 2 3 4 5
1
1
2
1 2
1
1
3
1 2 3
1
1
1
1
1
1
1
1
1
1
3
1 3 2
1
1
2
1 2
3
1 2 3
4
3 2 1 4
2
1 2
1
1
4
1 2 3 4
1
1
1
1
3
1 3 2
1
1
1
1
1
1
2
1 2
1
1
1
1
3
1 2 3
2
1 2
1
1
1
1
1
1
1...

output:

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

result:

ok Correct (100000 test cases)

Extra Test:

score: 0
Extra Test Passed