QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#331620#5199. Amazing TrickKevin5307#AC ✓70ms9868kbC++232.1kb2024-02-18 15:59:032024-02-18 15:59:04

Judging History

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

  • [2024-02-18 15:59:04]
  • 评测
  • 测评结果:AC
  • 用时:70ms
  • 内存:9868kb
  • [2024-02-18 15:59:03]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int pos[100100];
vector<int> gen(vector<int> vec)
{
	int n=sz(vec);
	if(n<=6)
	{
		vector<int> ret;
		for(int i=1;i<=n;i++)
			ret.pb(i);
		do
		{
			bool flag=1;
			for(int i=1;i<=n;i++)
				if(ret[i-1]==i||ret[i-1]==vec[i-1])
					flag=0;
			if(flag)
				return ret;
		}
		while(next_permutation(ALL(ret)));
		return {-1};
	}
	set<int> st;
	st.insert(n-1);
	st.insert(n);
	st.insert(vec[n-1]);
	st.insert(vec[n-2]);
	vector<int> ret(n,-1);
	set<int> st2;
	for(int i=1;i<=n;i++)
		st2.insert(i);
	for(int i=0;i<n;i++)
	{
		for(auto val:st)
			if(val!=i+1&&val!=vec[i])
			{
				ret[i]=val;
				st.erase(val);
				st2.erase(val);
				break;
			}
		if(ret[i]==-1)
		{
			for(auto val:st2)
				if(val!=i+1&&val!=vec[i])
				{
					ret[i]=val;
					st2.erase(val);
					break;
				}
		}
	}
	return ret;
}
int p[100100],q[100100];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		vector<int> vec;
		for(int i=1;i<=n;i++)
		{
			int x;
			cin>>x;
			vec.pb(x);
			pos[x]=i;
		}
		vector<int> ans=gen(vec);
		if(ans[0]==-1)
			cout<<"Impossible\n";
		else
		{
			cout<<"Possible\n";
			for(int i=1;i<=n;i++)
				cout<<(p[i]=pos[ans[i-1]])<<" ";
			cout<<endl;
			for(int i=1;i<=n;i++)
				pos[ans[i-1]]=i;
			for(int i=1;i<=n;i++)
				cout<<(q[i]=pos[i])<<" ";
			cout<<endl;
			for(int i=1;i<=n;i++)
				assert(vec[p[q[i]]-1]==i);
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

Impossible
Possible
2 3 1 
3 1 2 
Possible
4 3 2 1 
3 4 1 2 
Possible
4 5 2 1 3 
3 1 2 5 4 

result:

ok 3/4 are 'Possible' (4 test cases)

Test #2:

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

input:

50
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Imp...

result:

ok 0/50 are 'Possible' (50 test cases)

Test #3:

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

input:

25
2
2 1
2
2 1
2
2 1
2
1 2
2
2 1
2
1 2
2
1 2
2
1 2
2
1 2
2
1 2
2
2 1
2
2 1
2
1 2
2
1 2
2
2 1
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1

output:

Impossible
Impossible
Impossible
Possible
2 1 
2 1 
Impossible
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Impossible
Impossible
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Impossible
Impossible
Impossible
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Possible
2 ...

result:

ok 11/25 are 'Possible' (25 test cases)

Test #4:

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

input:

16
3
3 2 1
3
3 1 2
3
3 1 2
3
2 3 1
3
3 1 2
3
2 1 3
3
2 3 1
3
3 2 1
3
3 1 2
3
2 1 3
3
1 2 3
3
1 3 2
3
3 1 2
3
3 1 2
3
3 2 1
3
2 1 3

output:

Impossible
Possible
3 1 2 
3 1 2 
Possible
3 1 2 
3 1 2 
Possible
2 3 1 
2 3 1 
Possible
3 1 2 
3 1 2 
Impossible
Possible
2 3 1 
2 3 1 
Impossible
Possible
3 1 2 
3 1 2 
Impossible
Possible
2 3 1 
3 1 2 
Impossible
Possible
3 1 2 
3 1 2 
Possible
3 1 2 
3 1 2 
Impossible
Impossible

result:

ok 9/16 are 'Possible' (16 test cases)

Test #5:

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

input:

12
4
2 4 1 3
4
2 4 1 3
4
1 3 2 4
4
2 4 1 3
4
4 1 2 3
4
2 4 3 1
4
1 3 4 2
4
3 4 2 1
4
2 4 3 1
4
1 3 2 4
4
3 4 1 2
4
1 3 4 2

output:

Possible
4 3 2 1 
2 4 1 3 
Possible
4 3 2 1 
2 4 1 3 
Possible
3 1 4 2 
2 1 4 3 
Possible
4 3 2 1 
2 4 1 3 
Possible
3 4 1 2 
4 1 2 3 
Possible
3 4 2 1 
2 4 1 3 
Possible
4 3 1 2 
3 1 4 2 
Possible
3 4 2 1 
2 1 4 3 
Possible
3 4 2 1 
2 4 1 3 
Possible
3 1 4 2 
2 1 4 3 
Possible
4 3 2 1 
2 1 4 3 
Pos...

result:

ok 12/12 are 'Possible' (12 test cases)

Test #6:

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

input:

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

output:

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

result:

ok 10/10 are 'Possible' (10 test cases)

Test #7:

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

input:

8
6
5 4 3 6 2 1
6
2 1 3 4 5 6
6
1 6 4 5 2 3
6
1 2 3 4 5 6
6
3 6 1 2 5 4
6
2 6 3 5 4 1
6
1 2 4 5 3 6
6
5 3 4 2 6 1

output:

Possible
5 6 2 3 4 1 
2 1 4 3 6 5 
Possible
3 4 2 1 6 5 
3 4 1 2 6 5 
Possible
5 1 4 6 2 3 
2 1 4 6 3 5 
Possible
2 1 4 3 6 5 
2 1 4 3 6 5 
Possible
4 3 6 1 2 5 
2 1 4 3 6 5 
Possible
3 6 5 1 2 4 
2 4 1 3 6 5 
Possible
2 1 4 5 6 3 
2 1 4 6 3 5 
Possible
4 6 1 5 2 3 
2 1 5 6 3 4 

result:

ok 8/8 are 'Possible' (8 test cases)

Test #8:

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

input:

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

output:

Possible
7 6 2 3 1 5 4 
2 6 5 1 7 4 3 
Possible
6 7 1 5 2 4 3 
5 6 7 1 2 3 4 
Possible
7 6 4 5 3 1 2 
5 6 1 7 2 3 4 
Possible
6 7 4 5 2 1 3 
3 4 5 6 7 1 2 
Possible
6 7 4 2 1 5 3 
4 6 5 1 7 2 3 
Possible
6 7 4 5 1 2 3 
2 5 6 7 1 3 4 
Possible
7 6 4 1 3 5 2 
2 5 6 7 1 3 4 

result:

ok 7/7 are 'Possible' (7 test cases)

Test #9:

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

input:

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

output:

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

result:

ok 6/6 are 'Possible' (6 test cases)

Test #10:

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

input:

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

output:

Possible
8 9 2 7 1 4 5 3 6 
2 5 6 7 8 9 1 3 4 
Possible
9 8 2 7 3 5 1 4 6 
4 5 1 6 7 8 9 3 2 
Possible
9 8 6 5 3 1 2 4 7 
5 1 2 6 7 8 9 3 4 
Possible
8 9 7 1 6 5 2 4 3 
2 5 1 6 7 8 9 3 4 
Possible
8 9 5 6 3 2 4 7 1 
2 5 6 1 7 8 9 3 4 

result:

ok 5/5 are 'Possible' (5 test cases)

Test #11:

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

input:

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

output:

Possible
10 9 5 1 7 3 2 6 8 4 
5 1 6 2 7 8 9 10 3 4 
Possible
10 9 2 1 6 8 3 5 7 4 
5 1 6 7 2 8 9 10 3 4 
Possible
10 9 6 2 8 4 1 7 5 3 
5 1 6 7 8 9 10 2 3 4 
Possible
9 10 4 2 7 8 6 1 5 3 
4 1 5 6 7 8 9 10 2 3 
Possible
9 10 2 3 4 5 6 7 8 1 
5 6 1 7 2 9 8 10 4 3 

result:

ok 5/5 are 'Possible' (5 test cases)

Test #12:

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

input:

100000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Impossible
Imp...

result:

ok 0/100000 are 'Possible' (100000 test cases)

Test #13:

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

input:

50000
2
1 2
2
1 2
2
1 2
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
1 2
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1
2
2 1
2
1 2
2
1 2
2
2 1
2
2 1
2
1 2
2
2 1
2
1 2
2
2 1
2
2 1
2
2 1
...

output:

Possible
2 1 
2 1 
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Impossible
Possible
2 1 
2 1 
Impossible
Impossible
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Possible
2 1 
2 1 
Impossible
Impossible
Possible
2 1 
2 1 
Impossible
Impossible
Possible
2 1 
2 1 
Impossible
Impossible
Possible
2 ...

result:

ok 25064/50000 are 'Possible' (50000 test cases)

Test #14:

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

input:

33333
3
3 2 1
3
2 3 1
3
2 3 1
3
3 1 2
3
2 1 3
3
2 3 1
3
2 3 1
3
2 3 1
3
2 1 3
3
1 2 3
3
2 1 3
3
2 3 1
3
3 1 2
3
1 3 2
3
2 1 3
3
1 2 3
3
1 3 2
3
2 1 3
3
1 2 3
3
2 3 1
3
1 3 2
3
2 3 1
3
3 2 1
3
1 3 2
3
3 1 2
3
3 1 2
3
2 1 3
3
3 1 2
3
3 1 2
3
3 1 2
3
1 3 2
3
3 2 1
3
3 2 1
3
3 2 1
3
3 1 2
3
2 3 1
3
1 3 ...

output:

Impossible
Possible
2 3 1 
2 3 1 
Possible
2 3 1 
2 3 1 
Possible
3 1 2 
3 1 2 
Impossible
Possible
2 3 1 
2 3 1 
Possible
2 3 1 
2 3 1 
Possible
2 3 1 
2 3 1 
Impossible
Possible
2 3 1 
3 1 2 
Impossible
Possible
2 3 1 
2 3 1 
Possible
3 1 2 
3 1 2 
Impossible
Impossible
Possible
2 3 1 
3 1 2 
Impo...

result:

ok 16621/33333 are 'Possible' (33333 test cases)

Test #15:

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

input:

25000
4
1 4 2 3
4
1 2 4 3
4
4 3 1 2
4
2 3 4 1
4
2 3 1 4
4
4 1 2 3
4
4 3 2 1
4
4 1 2 3
4
4 2 3 1
4
3 4 1 2
4
3 2 1 4
4
1 2 3 4
4
1 2 4 3
4
4 1 3 2
4
3 2 1 4
4
4 2 1 3
4
2 4 3 1
4
3 1 4 2
4
4 2 1 3
4
1 2 4 3
4
4 1 2 3
4
3 4 1 2
4
1 3 2 4
4
2 1 3 4
4
1 3 4 2
4
1 2 4 3
4
4 1 3 2
4
2 4 3 1
4
1 3 2 4
4
4 ...

output:

Possible
3 4 2 1 
4 1 2 3 
Possible
4 3 1 2 
3 4 1 2 
Possible
4 3 1 2 
2 1 4 3 
Possible
2 3 4 1 
3 4 1 2 
Possible
2 3 4 1 
2 4 1 3 
Possible
3 4 1 2 
4 1 2 3 
Possible
3 4 1 2 
2 1 4 3 
Possible
3 4 1 2 
4 1 2 3 
Possible
2 4 1 3 
2 1 4 3 
Possible
4 3 2 1 
2 1 4 3 
Possible
2 3 4 1 
2 1 4 3 
Pos...

result:

ok 25000/25000 are 'Possible' (25000 test cases)

Test #16:

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

input:

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

output:

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

result:

ok 20000/20000 are 'Possible' (20000 test cases)

Test #17:

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

input:

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

output:

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

result:

ok 16666/16666 are 'Possible' (16666 test cases)

Test #18:

score: 0
Accepted
time: 23ms
memory: 3632kb

input:

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

output:

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

result:

ok 14285/14285 are 'Possible' (14285 test cases)

Test #19:

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

input:

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

output:

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

result:

ok 12500/12500 are 'Possible' (12500 test cases)

Test #20:

score: 0
Accepted
time: 30ms
memory: 3896kb

input:

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

output:

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

result:

ok 11111/11111 are 'Possible' (11111 test cases)

Test #21:

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

input:

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

output:

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

result:

ok 10000/10000 are 'Possible' (10000 test cases)

Test #22:

score: 0
Accepted
time: 23ms
memory: 3856kb

input:

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

output:

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

result:

ok 5000/5000 are 'Possible' (5000 test cases)

Test #23:

score: 0
Accepted
time: 23ms
memory: 3704kb

input:

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

output:

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

result:

ok 2000/2000 are 'Possible' (2000 test cases)

Test #24:

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

input:

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

output:

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

result:

ok 1000/1000 are 'Possible' (1000 test cases)

Test #25:

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

input:

200
500
77 436 150 381 283 26 376 479 28 247 432 220 18 468 31 161 278 49 344 121 396 405 360 193 101 211 367 242 397 419 190 326 312 126 288 164 276 97 98 341 133 488 137 16 358 261 93 287 484 196 209 96 212 103 207 450 223 200 117 129 316 85 239 427 213 51 89 62 299 83 27 8 357 218 307 342 36 370 ...

output:

Possible
499 500 103 124 202 234 388 93 422 210 72 258 118 374 96 97 338 312 44 497 13 158 282 315 230 296 199 339 6 71 9 392 283 15 179 129 461 215 77 100 403 310 356 190 445 228 266 128 159 260 191 18 486 66 341 104 331 241 328 465 434 326 155 68 384 225 427 485 419 314 294 319 470 186 106 382 119...

result:

ok 200/200 are 'Possible' (200 test cases)

Test #26:

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

input:

100
999
492 317 271 238 165 666 407 461 861 645 957 35 4 505 40 522 223 816 402 786 766 1 597 978 698 574 246 8 825 159 630 582 904 93 104 837 959 14 393 247 541 961 281 168 826 118 111 67 211 433 284 136 415 31 838 734 520 449 995 203 437 468 976 482 302 578 320 365 877 152 902 47 762 779 32 926 98...

output:

Possible
998 999 557 746 22 262 620 13 607 413 633 28 806 965 920 753 91 38 616 765 590 894 500 941 503 915 985 497 711 751 325 183 163 596 54 75 291 682 12 967 545 794 297 15 284 268 296 287 109 453 72 906 911 354 634 818 519 389 812 699 206 160 434 482 665 924 180 152 432 550 48 578 770 631 481 83...

result:

ok 100/100 are 'Possible' (100 test cases)

Test #27:

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

input:

10
10000
3111 9882 6693 1688 8131 1069 7097 714 8452 9810 3869 1071 729 8854 4427 5384 85 6139 4846 6702 9502 7068 4059 2105 9491 1770 5224 6581 4166 3999 2335 3218 2668 5457 4910 3214 5844 7261 6649 6271 3041 8709 7866 6145 3463 3566 2989 462 7977 9614 981 8807 7698 4206 7411 4177 4847 9099 6432 92...

output:

Possible
10000 9999 5472 5469 7644 2576 3172 7616 9447 982 3931 3900 3385 2208 7681 5108 1175 4530 2299 1635 1237 6525 5323 8497 4072 6554 7396 4194 3719 3996 322 2222 9037 8482 1264 6646 4102 6743 8701 7674 6606 755 2665 7522 4098 1026 2861 1435 218 5910 7193 2417 9504 6918 3003 8810 9632 8726 8393...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #28:

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

input:

4
25000
6613 4159 5077 6416 10853 11758 19627 3323 13008 9184 24741 15029 23038 5888 13877 5159 19819 548 11043 7270 23193 10331 4614 20092 14776 4140 1242 12624 5245 9350 18136 16339 10085 144 10843 22439 1999 17054 8601 5862 4359 23951 17309 19743 17748 11856 16787 12426 15536 15452 8084 3441 1124...

output:

Possible
24999 25000 12512 4294 18569 14011 15930 364 19184 13648 17137 24228 7549 10895 15628 10953 12382 2171 1149 2493 20257 4219 11427 7828 7155 15533 15340 5154 15114 19087 15830 24147 399 20279 18586 24402 22480 19376 19035 14230 1451 21492 8309 18592 15769 22183 13995 18016 11781 22898 24598 ...

result:

ok 4/4 are 'Possible' (4 test cases)

Test #29:

score: 0
Accepted
time: 29ms
memory: 7472kb

input:

2
50000
5329 24260 36130 8263 35267 32974 10730 5906 40902 11705 34044 1969 19662 22885 12991 17360 37276 2776 42315 20422 42407 15540 15343 37918 33817 17008 3819 43482 47574 2295 38031 48887 34560 4433 63 40770 38505 38533 20662 4570 48598 40935 17641 38040 21430 44656 20895 12229 37373 16553 1899...

output:

Possible
49999 50000 31764 12955 28073 44361 31066 45058 14842 30226 45491 31467 11753 46137 3869 20600 9684 22933 7980 32078 13761 46586 36540 14110 11661 8266 3077 10902 3584 49614 31120 41337 2775 15456 25923 30345 37372 12430 48112 41392 49919 23904 45081 46624 8235 48870 2576 6098 44903 26374 2...

result:

ok 2/2 are 'Possible' (2 test cases)

Test #30:

score: 0
Accepted
time: 29ms
memory: 9680kb

input:

1
100000
1456 10467 94596 93046 95142 5409 19197 52637 61524 20378 74780 30541 95011 8643 1935 79348 81628 5730 51030 2312 97930 12785 95868 27975 73166 19014 87353 19042 92944 15402 71296 8034 87026 16769 84343 52312 83816 56882 26772 1677 96185 84098 77869 84708 44840 97529 63101 33635 32991 72941...

output:

Possible
100000 99999 16186 93708 92594 11795 87055 8661 39980 39031 97791 23760 99517 48482 6971 3641 88179 62104 73727 29979 18005 4308 37213 27649 26975 78895 62389 75829 12112 38808 51178 38562 32415 57949 77878 61610 76470 48232 37250 31210 60905 5866 45353 94038 59571 72498 57029 21051 57649 9...

result:

ok 1/1 are 'Possible' (1 test case)

Test #31:

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

input:

10
10000
9496 8510 5460 3882 9615 1884 9371 1347 2879 2204 1543 900 5335 7779 7158 9126 3389 2229 5657 9220 8544 292 7228 7694 6697 8481 4895 5629 2223 1042 747 4220 2587 2589 1797 4720 5129 8687 9083 2076 645 261 6409 4763 3550 8977 9687 6622 1772 6109 8593 9900 1160 5451 580 9252 4132 8214 8831 26...

output:

Possible
9999 10000 8226 816 2828 7796 9526 269 872 2948 274 6585 6923 7651 107 4919 1850 6044 6531 6438 4108 6520 9899 5140 6481 3035 594 4960 986 9493 4533 4520 722 2092 8164 312 5270 4267 3379 3605 1186 7693 3455 9853 6742 1616 2816 5816 5037 9741 5223 1644 7898 8327 1238 6365 9892 5095 9252 2538...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #32:

score: 0
Accepted
time: 19ms
memory: 4628kb

input:

10
10000
2178 9218 7790 6366 8922 8404 4623 6637 3277 1874 915 9957 4033 7453 1816 5053 9847 5965 5715 4415 2216 9210 1761 8601 2444 3984 3709 853 2766 7651 7721 3449 3630 1316 8822 3779 7268 1794 2824 5596 1612 8132 2267 4317 5800 1975 1555 7042 3374 2174 2792 4275 1465 1152 1664 1299 8439 4566 393...

output:

Possible
10000 9999 5142 9925 7209 1717 1800 5763 6958 7517 2492 5092 2038 4028 3567 6243 5488 6140 8840 1986 6614 8734 3576 5383 8706 323 9100 168 2919 2663 7361 4716 638 8583 6598 9580 8641 4475 8181 221 5119 9993 5376 8029 3804 8146 189 8928 9429 1758 7964 896 3887 3324 3539 3360 7975 1870 105 52...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #33:

score: 0
Accepted
time: 19ms
memory: 4320kb

input:

10
10000
1567 6252 6443 7699 5492 1842 5405 7366 5587 3056 823 2622 1657 8753 3495 8410 3647 4249 4082 3119 707 3854 7694 784 7418 4856 839 7692 396 1383 1981 5426 8682 2034 206 7122 1159 6858 7121 9028 2891 685 8678 9171 2704 6389 1691 9932 1059 3896 5603 6714 6524 368 7905 78 1591 8160 9729 754 74...

output:

Possible
10000 9999 3641 9034 1262 1308 2282 1413 8451 3203 2313 8189 1450 5629 2811 2741 8522 7891 9751 9827 6290 9033 8534 8056 457 2645 810 5102 8932 5143 1689 7415 494 3587 7574 9016 2319 9565 8535 9313 7137 9426 8793 1351 933 8344 2698 585 2701 8464 3738 3177 5201 7524 5023 109 261 8633 5137 13...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #34:

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

input:

10
10000
4162 9101 9530 2624 3295 4976 2222 5812 6275 4390 1091 9646 7781 9877 9289 9643 1501 1663 4556 1782 7746 8721 993 9177 3081 3633 7243 8477 9458 2546 996 5746 558 7802 8078 2409 6141 2706 1948 2944 6185 3436 5910 4260 185 5584 6409 8392 5007 3815 1452 7181 8849 7937 9709 4059 9237 6013 5154 ...

output:

Possible
10000 9999 557 8143 1720 4425 9754 7995 8213 9307 3998 3579 8112 6639 367 6116 3886 3977 5452 6348 8475 4867 2214 8585 980 8568 3710 4468 7870 605 3773 2463 4897 5785 9630 5962 5257 3259 3137 6187 8240 7316 5212 9182 1842 7818 3836 8524 1227 1865 7429 2707 6867 9612 781 2656 8536 5349 7933 ...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #35:

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

input:

10
10000
7169 9888 3050 8344 6010 7824 9030 8457 8512 9823 9850 5216 6614 6527 1137 7044 2122 5052 5373 2616 8293 307 3075 7926 774 2501 9717 3719 69 8190 2413 97 5898 7720 1699 9045 1080 6644 5138 752 3353 9457 4587 2101 5997 970 3009 365 6674 8299 1291 241 6725 7421 235 2938 207 6417 8647 4982 515...

output:

Possible
10000 9999 7473 7253 1842 7454 4881 530 9428 486 2507 5678 3234 3991 5070 2053 2687 5625 1849 6548 3411 5198 2801 3294 832 1922 2510 1001 6184 3255 5419 9511 6248 9894 1443 8923 7620 6609 2416 2533 1280 8079 8485 7425 1452 9396 8445 4757 2686 2357 2595 4337 3854 7845 6858 2504 8088 127 5617...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #36:

score: 0
Accepted
time: 23ms
memory: 4556kb

input:

10
10000
4218 344 9453 2250 6540 174 5484 7282 5757 10000 7819 6405 1570 6813 5519 6500 2164 9737 7708 9517 6059 5969 3481 1963 8644 2957 717 5872 1966 3391 8293 3199 7147 6667 6146 5545 7635 6348 818 4785 6291 3478 2677 431 3934 1878 7228 2711 6850 9995 5922 3144 7235 8773 4271 2232 5820 2375 725 7...

output:

Possible
10000 9999 4389 10 8407 5367 4990 4820 4977 9926 7208 3357 7885 4353 4515 6236 5228 6920 4093 1497 9717 3410 572 9083 6312 6089 843 6161 3912 1999 3987 3678 7517 8467 3610 655 7371 1761 3213 5239 1507 6885 7697 7167 6122 2383 6477 9381 1278 5545 6864 4910 654 1269 9710 6716 1349 5853 8672 6...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #37:

score: 0
Accepted
time: 19ms
memory: 4592kb

input:

10
10000
4510 8103 8711 5998 7077 4929 4717 8436 4500 2241 6776 4322 528 7714 7357 1411 8862 3226 7694 9239 4118 9336 5424 3055 4796 1260 2569 4967 6361 6452 7687 8565 3083 6256 9369 963 5140 344 8358 6603 8293 1222 2486 5667 8568 3027 7683 7855 6489 2424 3312 5086 9224 3769 3952 5566 9849 2778 1088...

output:

Possible
9999 10000 2888 9119 9139 4234 2708 4501 5712 4579 6369 9048 995 1799 9620 7646 8089 2825 6827 8053 6811 2671 6365 2718 6283 2476 7089 5971 1469 6132 9681 2398 2916 8998 7148 6469 2426 7726 4344 5071 3620 5849 9742 4340 5436 8574 8947 7468 5680 9899 2464 8213 6903 8814 4409 7277 9543 5982 1...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #38:

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

input:

10
10000
7627 4696 3738 4879 7371 1232 6843 5355 8688 5927 8229 1973 509 5349 4523 1269 9603 1902 8294 9679 3066 5702 6749 168 855 9149 2615 5826 5373 585 4768 8194 5977 4418 6556 2850 9475 5651 5756 293 1993 8637 367 6975 3377 889 4867 3130 8847 2668 2854 5466 9765 1895 230 439 4416 7213 4888 8060 ...

output:

Possible
9999 10000 9803 8228 7625 6792 2693 7343 3253 1456 8540 2712 4960 4422 2571 9399 210 3064 6581 6894 7591 7061 5310 7839 4085 8374 4862 9401 7698 8098 6035 9123 4601 6203 820 5825 5223 7637 3576 2150 7335 5378 8401 3450 2634 6608 3318 4402 2873 5396 9933 3640 6338 8809 8126 7564 4583 6684 20...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #39:

score: 0
Accepted
time: 23ms
memory: 4388kb

input:

10
10000
3717 2786 9484 9828 3759 346 5412 5491 2997 6494 7048 7489 6711 278 9539 619 3780 1167 2457 9173 180 6257 3085 9695 7034 8748 4260 9925 2654 6969 2663 2176 1114 9476 1405 306 6548 9601 4534 5879 7800 4523 3132 8461 796 6364 9689 2345 2496 5862 9478 6605 6306 1964 1846 6623 2502 742 5326 417...

output:

Possible
10000 9999 6720 7337 3248 7944 3081 5427 3180 2866 6904 8425 2230 6725 4375 7179 1022 8265 3288 7939 8174 586 9308 3508 2029 267 5425 4110 8129 6480 6566 3565 9182 9878 1542 1977 4431 9651 4025 5014 6970 5568 3437 9570 5239 2943 6581 102 1882 2234 8133 7328 1377 789 6660 1919 3633 6727 4724...

result:

ok 10/10 are 'Possible' (10 test cases)

Test #40:

score: 0
Accepted
time: 29ms
memory: 9732kb

input:

1
100000
7210 30744 81874 6285 69296 6115 79138 52424 44282 14840 1587 38580 10637 93401 83715 42733 75136 14685 64770 3552 44547 86767 94004 99217 2250 68390 11413 7847 90110 73187 70660 79544 7994 78601 79203 34166 47060 92554 22975 17834 25249 63503 18594 15442 31402 21637 9208 82986 75248 10369 ...

output:

Possible
99999 100000 22390 7017 26560 31669 11383 62417 79297 75288 36179 32578 29689 72455 59858 4395 42551 35310 30602 22071 48483 19625 53879 40940 85538 92960 10243 46797 95368 46750 23614 5703 17722 47192 47748 71209 61078 36701 14290 84637 9405 4121 33703 49376 66342 85261 5350 88559 26408 75...

result:

ok 1/1 are 'Possible' (1 test case)

Test #41:

score: 0
Accepted
time: 28ms
memory: 9736kb

input:

1
100000
70563 7751 11771 31815 69604 71562 95485 40936 31055 25792 34133 2630 27332 48674 7074 88282 46065 36326 48345 45816 81539 98511 5048 72788 49835 88788 59711 45304 22969 61410 68373 78297 93370 19304 22236 23681 48019 17714 30702 18951 22114 57144 73821 92614 16405 23902 53004 36729 29213 9...

output:

Possible
100000 99999 98329 28643 97793 2712 5504 79295 10230 97919 96176 42888 25789 5137 39821 10843 92519 18469 1477 66597 91823 38396 9964 99609 31941 80614 75487 99921 18652 56980 76884 18889 4188 23632 33777 27669 25724 32274 50202 505 85126 18624 11823 68780 88785 69611 55382 55958 96638 3729...

result:

ok 1/1 are 'Possible' (1 test case)

Test #42:

score: 0
Accepted
time: 29ms
memory: 9868kb

input:

1
100000
33413 95902 66707 37171 63717 97678 10879 3614 34432 20249 89228 27610 94980 80741 33412 55214 41220 52034 92244 16703 23322 64378 89911 94268 48792 70327 31398 74518 38251 72313 17385 90894 32244 4118 33031 22074 73597 51522 18274 49387 15317 43002 18849 63998 36602 55730 85751 93866 86271...

output:

Possible
100000 99999 50435 84735 22062 5645 58125 83902 20806 1387 87885 60181 68475 61534 61034 26707 33622 95732 68786 39172 90407 49156 39853 48957 35214 20072 2833 13909 7793 26280 59322 17029 62930 43081 43386 9529 88739 37872 21349 97381 73013 86405 33023 93078 57517 35713 43078 62824 44872 1...

result:

ok 1/1 are 'Possible' (1 test case)

Test #43:

score: 0
Accepted
time: 29ms
memory: 9700kb

input:

1
100000
38939 36462 49236 11864 41866 9135 83157 68975 57929 22445 15930 71622 6685 74844 63484 21437 36291 19858 96434 77081 5526 27871 28539 29249 81884 33811 86021 19329 4667 40618 83290 68312 3253 19686 13848 64686 67676 20614 87922 14493 2686 23288 80722 55653 55053 42533 20505 82814 3906 7159...

output:

Possible
99999 100000 66235 37149 70304 41594 22446 11134 59948 53959 80618 61591 82816 11677 98170 38971 78814 77827 90243 44206 66544 19595 64792 72120 80217 62567 58204 68743 9104 12686 94866 19468 36277 25780 34181 68714 69732 41759 32107 1937 78843 17181 5823 21595 25897 74034 52091 73267 41918...

result:

ok 1/1 are 'Possible' (1 test case)

Test #44:

score: 0
Accepted
time: 33ms
memory: 9740kb

input:

1
100000
56410 55223 89128 10706 65945 98487 8157 37051 23481 13806 5708 53223 41255 72197 4250 33306 82551 92413 78735 24394 33722 62458 49977 19569 15457 97352 68219 60151 33432 36755 29808 18535 91202 559 26286 32530 45839 58284 3132 92142 31443 64432 45232 60417 75658 93565 66480 95677 93242 353...

output:

Possible
100000 99999 31271 60817 88332 86525 75139 60815 11662 22849 97264 61207 28195 58337 51141 96073 15423 76168 54404 97961 91132 6895 62705 14342 39530 84825 91556 74590 41710 91201 21261 80768 44489 25813 24996 66217 96528 42351 30855 11010 44655 50282 64820 49926 60599 39978 22165 74149 163...

result:

ok 1/1 are 'Possible' (1 test case)

Test #45:

score: 0
Accepted
time: 32ms
memory: 9736kb

input:

1
100000
92846 36298 94102 74728 62298 17712 70468 29085 26866 74943 50194 68114 23001 42022 1534 67883 22067 31802 76367 40 10506 5204 6633 47834 14730 42455 57533 57800 69803 85998 87243 39377 14734 4609 14172 68549 15757 44430 47282 66093 37600 6662 80279 54115 61844 39518 2508 88635 30432 16795 ...

output:

Possible
100000 99999 16727 8872 63593 56280 24420 19922 59282 32932 7273 59804 58560 56635 93921 3824 95355 89468 48117 5560 24433 95652 89141 81273 59058 51158 25377 71545 47357 28588 62522 31968 91913 74098 89592 44733 5896 19020 97575 21851 87619 12580 63462 20 78239 74426 55981 98540 36240 2357...

result:

ok 1/1 are 'Possible' (1 test case)

Test #46:

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

input:

1
100000
80249 61559 4136 5015 44391 76486 13189 7497 82608 50643 67643 98730 1372 52259 53113 69217 81937 63901 49868 23522 20692 79953 83998 38103 11847 94930 84641 55771 27259 62537 48000 86586 60900 86524 54701 15031 89203 24691 97682 73417 59806 35351 26783 95563 34915 61247 88409 42983 21153 8...

output:

Possible
100000 99999 83150 4069 84064 68376 94628 45844 49594 48370 19794 88122 19228 97144 90168 32720 16031 68860 91946 94368 624 32613 5170 85454 51297 68882 99302 94497 5229 97245 29150 94206 31303 43664 88161 79995 47584 97463 71825 71872 43406 20346 62753 67232 45860 69166 28341 91207 20321 7...

result:

ok 1/1 are 'Possible' (1 test case)

Test #47:

score: 0
Accepted
time: 32ms
memory: 9780kb

input:

1
100000
47933 91823 8680 38452 98002 50208 28599 87139 73543 26971 73442 64562 24616 52949 43109 48263 71188 90073 98556 71141 35002 1318 47482 55519 52705 70983 13651 91244 53258 35004 5173 13432 8649 2930 60237 98310 56868 28611 2019 3477 57819 51659 892 49301 47016 7551 23697 89821 47998 32736 2...

output:

Possible
99999 100000 64336 74649 34687 83142 83214 9567 98846 80888 19440 85058 16685 27950 45151 7688 75020 91031 19567 84086 33910 14435 28120 38798 8186 17442 90659 89635 86684 46886 42571 23005 44899 69056 32801 67046 12474 96752 14400 79102 35376 64568 27665 35994 11369 41792 20890 60399 25135...

result:

ok 1/1 are 'Possible' (1 test case)

Test #48:

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

input:

1
100000
32591 31819 18269 4992 95481 15309 82223 37862 64829 8548 75956 40622 68213 26870 47574 85646 30288 67079 66288 87221 77650 65875 41974 90346 11987 3782 5691 18237 99521 48974 70063 21886 33587 72262 97090 66592 82785 88943 8082 47016 25506 64005 84545 32684 32875 5661 93415 12006 81882 453...

output:

Possible
99999 100000 88140 49362 48822 72394 34739 85197 38247 83363 76420 7008 51953 8254 25701 82358 40570 29044 32694 38591 70888 96216 23093 7548 11629 94117 52985 56646 31998 96154 18977 16721 10935 88833 85577 4779 44436 7330 47008 50818 93266 88686 89259 17864 54833 78068 700 84036 20110 718...

result:

ok 1/1 are 'Possible' (1 test case)