QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106020#6108. Permutation ArrangementCrysflyAC ✓29ms8476kbC++172.9kb2023-05-16 10:51:572023-05-16 10:53:36

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-16 10:53:36]
  • 评测
  • 测评结果:AC
  • 用时:29ms
  • 内存:8476kb
  • [2023-05-16 10:51:57]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}
 
#define mod 1000000007
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 200005
#define inf 0x3f3f3f3f

int n,a[maxn],vis[maxn];
set<int>s;

bool chk(int x,int y){
	if(x<-n||y<-n)return 1;
	if(abs(x-y)==1)return 0;
	return 1;
}

int num[maxn],len,p[maxn],pos[maxn],orz;

void work(){
	For(i,1,len){
		a[pos[i]]=num[p[i]];
	}
	For(i,1,len){
		int u=pos[i];
		if(!chk(a[u-1],a[u])||!chk(a[u+1],a[u]))return;
	}
	For(i,1,n){
		cout<<a[i]<<" ";
	}
	exit(0);
}

signed main()
{
	n=read();
	For(i,1,n)a[i]=read();
	For(i,1,n)if(a[i]!=-1)vis[a[i]]=1;
	For(i,1,n)if(!vis[i])s.insert(i);
	a[0]=a[n+1]=-inf;
	For(i,1,n)if(a[i]==-1){
		if(s.size()>6){
			auto it=s.begin();
			while(!chk(a[i-1],*it) || !chk(a[i+1],*it))++it;
			a[i]=*it,s.erase(it);
		}else break;
	}
	while(s.size())num[++len]=(*s.begin()),s.erase(s.begin());
	For(i,1,n)if(a[i]==-1)pos[++orz]=i;
	assert(len==orz);
	For(i,1,len)p[i]=i;
	do{
		work();
	}while(next_permutation(p+1,p+len+1));
	puts("-1");
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 5304kb

input:

10
3 -1 10 -1 8 -1 -1 -1 -1 -1

output:

3 1 10 2 8 4 6 9 5 7 

result:

ok 10 numbers

Test #2:

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

input:

2
-1 -1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

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

input:

10
-1 -1 -1 8 -1 2 10 -1 -1 3

output:

1 4 6 8 5 2 10 7 9 3 

result:

ok 10 numbers

Test #4:

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

input:

10
-1 2 -1 6 -1 1 -1 5 -1 3

output:

4 2 8 6 9 1 7 5 10 3 

result:

ok 10 numbers

Test #5:

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

input:

10
-1 3 -1 -1 5 -1 9 -1 -1 -1

output:

1 3 6 2 5 7 9 4 8 10 

result:

ok 10 numbers

Test #6:

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

input:

10
4 -1 8 -1 -1 3 -1 9 -1 6

output:

4 1 8 5 10 3 7 9 2 6 

result:

ok 10 numbers

Test #7:

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

input:

1000
80 360 454 409 303 639 154 486 365 955 -1 -1 625 488 726 -1 94 348 57 -1 287 472 551 981 106 381 199 877 660 736 762 207 -1 59 437 -1 -1 343 593 -1 151 225 -1 -1 430 854 771 378 785 -1 668 617 404 272 -1 871 305 920 507 101 -1 376 123 959 293 327 286 416 77 677 388 336 53 833 932 633 855 744 25...

output:

80 360 454 409 303 639 154 486 365 955 5 21 625 488 726 27 94 348 57 45 287 472 551 981 106 381 199 877 660 736 762 207 55 59 437 64 66 343 593 70 151 225 71 79 430 854 771 378 785 87 668 617 404 272 97 871 305 920 507 101 103 376 123 959 293 327 286 416 77 677 388 336 53 833 932 633 855 744 257 112...

result:

ok 1000 numbers

Test #8:

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

input:

1000
678 -1 739 723 -1 -1 226 881 -1 923 -1 80 568 648 16 480 114 400 -1 527 221 171 931 783 937 959 192 552 363 -1 -1 874 734 940 393 -1 733 915 327 117 -1 190 637 -1 -1 -1 808 300 350 658 720 437 525 -1 -1 876 699 428 493 314 883 139 833 22 252 274 -1 83 -1 376 950 -1 732 476 706 561 837 174 318 7...

output:

678 3 739 723 5 7 226 881 12 923 13 80 568 648 16 480 114 400 19 527 221 171 931 783 937 959 192 552 363 21 23 874 734 940 393 25 733 915 327 117 28 190 637 32 34 36 808 300 350 658 720 437 525 35 48 876 699 428 493 314 883 139 833 22 252 274 51 83 60 376 950 64 732 476 706 561 837 174 318 772 70 74...

result:

ok 1000 numbers

Test #9:

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

input:

1000
-1 585 392 262 972 807 128 -1 558 -1 -1 678 600 472 -1 -1 -1 233 958 -1 -1 651 -1 622 739 -1 151 -1 93 935 -1 55 120 200 755 -1 674 -1 -1 1 -1 -1 -1 -1 -1 446 -1 -1 -1 605 -1 263 -1 43 491 -1 -1 -1 -1 982 -1 388 556 -1 589 -1 -1 448 -1 -1 -1 607 -1 -1 -1 -1 -1 -1 750 40 -1 -1 555 872 -1 -1 -1 5...

output:

2 585 392 262 972 807 128 3 558 6 9 678 600 472 10 12 15 233 958 13 16 651 17 622 739 19 151 20 93 935 21 55 120 200 755 22 674 24 26 1 25 28 30 32 29 446 31 34 37 605 35 263 41 43 491 44 48 50 58 982 49 388 556 51 589 59 62 448 66 71 74 607 75 78 76 79 83 85 750 40 84 88 555 872 89 92 90 535 94 97 ...

result:

ok 1000 numbers

Test #10:

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

input:

1000
202 -1 -1 -1 -1 377 -1 -1 -1 -1 205 -1 -1 -1 470 -1 -1 -1 -1 151 869 678 72 -1 834 -1 -1 37 626 670 -1 902 178 -1 -1 389 500 732 -1 -1 676 109 533 -1 -1 812 731 618 -1 -1 4 108 513 948 312 -1 388 -1 629 -1 190 316 544 237 53 -1 -1 -1 -1 -1 358 226 -1 -1 783 -1 -1 875 634 772 212 56 -1 839 808 2...

output:

202 1 3 5 8 377 6 9 11 14 205 15 20 16 470 21 23 26 22 151 869 678 72 24 834 27 29 37 626 670 28 902 178 31 34 389 500 732 32 36 676 109 533 38 40 812 731 618 39 41 4 108 513 948 312 42 388 43 629 46 190 316 544 237 53 47 52 54 57 55 358 226 58 62 783 63 68 875 634 772 212 56 69 839 808 254 70 73 37...

result:

ok 1000 numbers

Test #11:

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

input:

1000
-1 -1 -1 -1 -1 -1 -1 209 570 -1 552 -1 -1 -1 611 908 536 -1 663 -1 -1 487 -1 -1 -1 -1 -1 -1 365 -1 -1 -1 -1 918 24 -1 -1 -1 973 -1 -1 286 474 -1 585 349 -1 -1 605 735 367 -1 -1 -1 -1 -1 -1 -1 -1 -1 473 -1 489 -1 -1 662 283 -1 -1 -1 -1 -1 -1 -1 -1 -1 260 -1 987 -1 -1 -1 -1 -1 -1 681 -1 -1 -1 -1 ...

output:

1 4 6 9 5 7 10 209 570 11 552 12 15 17 611 908 536 16 663 18 21 487 19 22 25 23 26 28 365 27 30 32 34 918 24 33 35 37 973 38 40 286 474 39 585 349 41 43 605 735 367 44 46 48 45 47 49 51 53 55 473 54 489 56 58 662 283 57 61 63 69 62 64 70 72 76 260 71 987 73 77 79 81 83 80 681 85 87 89 86 794 460 88 ...

result:

ok 1000 numbers

Test #12:

score: 0
Accepted
time: 13ms
memory: 6668kb

input:

100000
80156 53723 42435 94255 41204 62135 89137 63931 20313 82118 83746 -1 9784 47210 40385 56772 47115 62130 41799 -1 84401 60635 51717 44994 62106 30835 -1 3666 75796 99260 12541 22017 5889 50591 39341 64594 82252 28787 63703 17015 82949 -1 73096 81195 75623 49081 93248 32712 12890 8543 73532 -1 ...

output:

80156 53723 42435 94255 41204 62135 89137 63931 20313 82118 83746 4 9784 47210 40385 56772 47115 62130 41799 7 84401 60635 51717 44994 62106 30835 12 3666 75796 99260 12541 22017 5889 50591 39341 64594 82252 28787 63703 17015 82949 18 73096 81195 75623 49081 93248 32712 12890 8543 73532 24 36 58486 ...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 21ms
memory: 6968kb

input:

100000
39130 -1 11138 84004 29682 84022 26702 68949 34582 45358 37675 5976 12002 -1 23453 26519 17100 82306 -1 47671 77312 24741 -1 87776 35007 -1 97897 10993 32298 63548 -1 57212 -1 64139 -1 35117 32732 83918 24358 48335 43824 60441 77020 1597 7404 -1 93716 43227 24087 -1 -1 64744 83051 29762 67839...

output:

39130 1 11138 84004 29682 84022 26702 68949 34582 45358 37675 5976 12002 7 23453 26519 17100 82306 9 47671 77312 24741 12 87776 35007 13 97897 10993 32298 63548 15 57212 25 64139 27 35117 32732 83918 24358 48335 43824 60441 77020 1597 7404 29 93716 43227 24087 33 36 64744 83051 29762 67839 78964 603...

result:

ok 100000 numbers

Test #14:

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

input:

100000
66918 55074 25554 -1 66110 -1 8972 -1 -1 30932 14523 90341 2556 56158 75463 38730 68035 16608 -1 69056 -1 5052 66098 16105 -1 -1 -1 -1 53014 22541 -1 50316 33746 -1 -1 -1 13215 89809 -1 48636 92023 -1 56017 -1 65969 -1 -1 6416 -1 57469 -1 -1 29120 46136 68421 -1 93185 64883 -1 30896 92631 390...

output:

66918 55074 25554 5 66110 9 8972 10 12 30932 14523 90341 2556 56158 75463 38730 68035 16608 13 69056 16 5052 66098 16105 17 19 21 18 53014 22541 24 50316 33746 26 30 32 13215 89809 31 48636 92023 34 56017 38 65969 41 47 6416 42 57469 51 55 29120 46136 68421 52 93185 64883 56 30896 92631 39004 56714 ...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 21ms
memory: 6512kb

input:

100000
99590 -1 -1 -1 87466 35 -1 -1 61223 -1 99170 -1 -1 537 -1 -1 -1 -1 -1 66657 52066 -1 42749 -1 78144 -1 9520 -1 77022 -1 9997 8588 -1 -1 -1 68476 -1 -1 -1 -1 85365 -1 -1 23509 -1 -1 83937 6253 -1 -1 -1 65429 15170 -1 -1 -1 30500 38057 -1 -1 -1 91924 65445 23389 39518 -1 61488 70586 16274 21358...

output:

99590 3 5 8 87466 35 4 6 61223 10 99170 15 17 537 16 19 22 24 27 66657 52066 23 42749 30 78144 31 9520 32 77022 33 9997 8588 34 36 39 68476 40 46 48 51 85365 47 49 23509 52 55 83937 6253 53 59 62 65429 15170 63 66 64 30500 38057 77 80 82 91924 65445 23389 39518 83 61488 70586 16274 21358 75372 84 86...

result:

ok 100000 numbers

Test #16:

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

input:

100000
-1 27966 81904 9017 55897 -1 22386 28339 78033 75545 -1 -1 -1 -1 -1 -1 -1 -1 40290 -1 -1 4085 -1 -1 -1 54033 -1 83085 7293 33403 63978 57251 23205 21269 -1 69158 91817 32392 -1 40930 29249 -1 -1 90547 -1 61890 2757 -1 -1 25951 2 11955 -1 32843 -1 -1 -1 -1 -1 72553 -1 -1 12153 3456 8766 1337 5...

output:

3 27966 81904 9017 55897 4 22386 28339 78033 75545 5 7 9 6 8 10 16 11 40290 19 21 4085 20 22 28 54033 30 83085 7293 33403 63978 57251 23205 21269 31 69158 91817 32392 33 40930 29249 34 37 90547 39 61890 2757 41 43 25951 2 11955 42 32843 44 46 48 45 51 72553 54 56 12153 3456 8766 1337 56753 59811 782...

result:

ok 100000 numbers

Test #17:

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

input:

100000
68642 42161 58555 -1 -1 56399 -1 -1 -1 46805 -1 99806 -1 -1 50564 89557 -1 71730 10222 -1 57943 22247 20883 41318 -1 87264 87299 81755 30525 -1 17832 80092 96961 13885 -1 -1 -1 -1 81144 24604 41393 -1 7946 55607 21917 -1 -1 -1 88484 -1 28189 -1 17016 -1 80797 -1 69375 73602 -1 -1 66135 -1 541...

output:

68642 42161 58555 1 3 56399 5 8 6 46805 17 99806 19 33 50564 89557 34 71730 10222 35 57943 22247 20883 41318 36 87264 87299 81755 30525 38 17832 80092 96961 13885 40 47 52 54 81144 24604 41393 57 7946 55607 21917 61 66 62 88484 67 28189 69 17016 70 80797 71 69375 73602 72 77 66135 73 54183 82 84 244...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 26ms
memory: 7716kb

input:

100000
21150 -1 -1 63979 -1 26074 -1 -1 18027 7589 -1 -1 -1 -1 -1 76834 -1 -1 -1 -1 43596 -1 69422 -1 -1 -1 -1 58471 -1 -1 20704 64235 -1 -1 18411 35496 10521 -1 19869 73858 33268 -1 -1 67948 -1 95775 2656 -1 63959 1272 -1 31873 83923 1506 -1 35987 19931 -1 91682 -1 38769 41599 38858 -1 9184 88362 4...

output:

21150 3 5 63979 7 26074 8 10 18027 7589 11 18 12 19 23 76834 26 30 27 33 43596 34 69422 35 37 39 36 58471 38 42 20704 64235 44 49 18411 35496 10521 50 19869 73858 33268 51 58 67948 52 95775 2656 63 63959 1272 64 31873 83923 1506 65 35987 19931 66 91682 68 38769 41599 38858 69 9184 88362 49858 71 73 ...

result:

ok 100000 numbers

Test #19:

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

input:

100000
-1 91842 -1 -1 -1 -1 90929 23192 71997 16066 221 -1 -1 -1 -1 -1 3072 -1 -1 -1 -1 -1 -1 1186 70844 -1 37187 -1 22908 57578 30341 36529 -1 -1 -1 51436 -1 -1 23780 -1 84615 -1 23459 -1 -1 -1 65197 -1 -1 99344 -1 -1 78774 88007 -1 -1 -1 -1 78291 47153 7633 -1 14431 -1 -1 -1 53029 -1 95615 73415 2...

output:

2 91842 4 6 10 13 90929 23192 71997 16066 221 17 19 21 25 22 3072 26 29 27 30 33 36 1186 70844 34 37187 37 22908 57578 30341 36529 42 45 43 51436 46 48 23780 50 84615 51 23459 54 59 55 65197 60 62 99344 64 67 78774 88007 65 72 74 76 78291 47153 7633 73 14431 81 84 82 53029 86 95615 73415 20673 88 90...

result:

ok 100000 numbers

Test #20:

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

input:

100000
79679 -1 -1 40321 37599 -1 48462 43851 -1 62731 95129 28592 58526 -1 -1 -1 -1 99421 95174 11621 -1 66767 46564 96130 95435 82401 79166 -1 59852 -1 4774 71513 38650 44108 -1 -1 -1 79454 -1 -1 -1 71955 -1 92239 68129 51421 -1 73095 -1 81006 44505 -1 60808 88994 14959 -1 13978 31639 -1 -1 76479 ...

output:

79679 3 5 40321 37599 4 48462 43851 7 62731 95129 28592 58526 9 13 15 18 99421 95174 11621 14 66767 46564 96130 95435 82401 79166 16 59852 19 4774 71513 38650 44108 20 25 21 79454 27 29 32 71955 28 92239 68129 51421 30 73095 34 81006 44505 35 60808 88994 14959 38 13978 31639 44 46 76479 45 47 49 152...

result:

ok 100000 numbers

Test #21:

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

input:

100000
85474 89807 -1 97245 -1 16919 83074 -1 -1 -1 -1 -1 -1 75224 146 55345 -1 -1 -1 -1 18446 61465 -1 -1 -1 -1 -1 44006 28500 -1 26123 -1 -1 -1 -1 -1 -1 79493 -1 -1 -1 -1 -1 -1 40172 -1 -1 43979 53382 27979 -1 -1 16611 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 5874 -1 -1 -1 -1 -1 -1 -1 -1 66607 -1 -1 -1 -1...

output:

85474 89807 1 97245 2 16919 83074 3 5 9 6 10 13 75224 146 55345 11 14 19 15 18446 61465 20 22 25 21 23 44006 28500 26 26123 27 29 33 28 34 36 79493 38 40 42 39 43 45 40172 44 46 43979 53382 27979 47 49 16611 48 50 52 54 51 53 55 57 59 56 58 5874 60 62 66 61 63 67 69 72 66607 68 73 75 77 74 76 54616 ...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 21ms
memory: 8432kb

input:

100000
-1 -1 -1 6920 -1 -1 -1 -1 -1 -1 -1 -1 33884 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 11505 -1 -1 -1 -1 23425 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 38881 -1 -1 -1 -1 -1 -1 -1 -1 -1 99636 -1 -1 86324 -1 -1 75354 -1 -1 -1 95766 -1 -1 13379 -1 -1 ...

output:

1 3 5 6920 2 4 6 9 7 10 12 14 33884 11 13 15 18 16 19 21 23 20 22 24 26 28 30 27 11505 29 31 33 35 23425 32 36 39 37 40 42 44 41 43 45 47 49 46 48 50 54 51 55 57 59 56 58 60 62 64 61 63 65 38881 66 68 70 67 69 71 73 75 77 99636 74 76 86324 78 80 75354 79 81 83 95766 82 84 13379 85 87 89 86 88 90 606...

result:

ok 100000 numbers

Test #23:

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

input:

100000
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 60726 -1 -1 -1 78708 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35878 -1 -1 -1 -1 -1 -1 -1 85969 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 60431 -1 -1 -1 -1 -1 -1 -1 -1 -1 89913 -1 -1 -1 -1 -1 -1 -1 43797 -1 -1 -1 75319 -1 -1 -1 -1 -1 -1 -1 -1 -1...

output:

1 3 5 2 6 8 11 7 12 14 16 13 15 60726 17 19 21 78708 18 20 22 24 26 23 25 27 29 31 33 30 32 35878 35 37 39 36 38 42 44 85969 45 47 49 46 48 50 52 54 51 53 55 57 59 56 58 61 63 65 60431 62 66 68 70 67 69 72 74 76 89913 75 77 79 81 78 80 82 43797 83 85 87 75319 84 86 88 90 93 89 91 94 96 98 95 97 99 1...

result:

ok 100000 numbers

Test #24:

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

input:

100000
67208 -1 -1 -1 -1 -1 -1 -1 -1 79584 -1 -1 -1 -1 -1 -1 -1 -1 44953 13525 -1 14102 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 98764 15602 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 21228 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 86675 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

output:

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

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 18ms
memory: 8264kb

input:

100000
-1 -1 -1 -1 18438 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 90734 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18298 -1 -1 -1 6472 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 63936 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 59975 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

output:

1 3 5 2 18438 4 6 8 10 7 11 14 16 19 15 17 90734 20 22 24 21 23 25 27 29 26 28 30 32 34 31 33 35 37 39 42 40 43 18298 44 46 48 6472 47 49 51 53 55 57 54 56 58 60 63 59 63936 61 64 66 68 70 67 69 71 73 76 72 74 77 79 81 78 80 59975 82 84 86 83 85 87 89 91 88 90 92 94 96 93 95 97 99 101 103 106 102 10...

result:

ok 100000 numbers

Test #26:

score: 0
Accepted
time: 26ms
memory: 8268kb

input:

100000
-1 -1 -1 -1 -1 21020 -1 -1 21474 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 38014 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 92175 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 47482 -1 -1 -1 -1 -1 -1 -1 75729 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 22843 -1 -1 -1 -1...

output:

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

result:

ok 100000 numbers

Test #27:

score: 0
Accepted
time: 26ms
memory: 8476kb

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

output:

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

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 5ms
memory: 4076kb

input:

100000
69105 32512 25533 16565 67688 84168 19210 14528 35691 99242 40134 9609 73656 94781 5256 31939 95699 87534 86035 17647 75470 63667 9654 90202 97923 51796 24420 34613 69963 74612 43404 26485 25046 24886 36809 91794 16265 9496 11466 31763 57651 6853 7856 9920 16789 25216 77435 67412 8945 46409 4...

output:

-1

result:

ok 1 number(s): "-1"

Test #29:

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

input:

100000
68403 95582 72780 4091 47630 68700 60066 83728 2624 86357 43606 71976 49217 91263 35956 21313 96698 81703 13100 25469 94505 58796 52611 67065 17674 32504 69117 23587 28409 18434 45242 20780 33939 42989 12818 100000 60155 95745 11804 61283 88071 48740 20021 18719 43972 52482 33910 94224 97377 ...

output:

68403 95582 72780 4091 47630 68700 60066 83728 2624 86357 43606 71976 49217 91263 35956 21313 96698 81703 13100 25469 94505 58796 52611 67065 17674 32504 69117 23587 28409 18434 45242 20780 33939 42989 12818 100000 60155 95745 11804 61283 88071 48740 20021 18719 43972 52482 33910 94224 97377 16524 7...

result:

ok 100000 numbers

Test #30:

score: 0
Accepted
time: 8ms
memory: 4044kb

input:

100000
1886 68232 11539 40071 68429 59323 91816 34171 14991 49516 68661 15188 47583 38489 22088 16145 41178 7526 45477 69849 89327 72097 65593 43256 77795 21531 27237 71470 1179 39128 7754 79236 73857 22740 34587 75522 40219 99538 40074 6402 86866 93757 44346 453 9477 80756 75572 84193 68804 28579 8...

output:

-1

result:

ok 1 number(s): "-1"

Test #31:

score: 0
Accepted
time: 6ms
memory: 4108kb

input:

100000
91242 14925 79715 1602 82915 69434 44828 46999 13920 35738 63667 25498 89803 81834 24944 61473 14976 35226 59267 79874 2306 36059 34200 79449 27640 89978 44083 59235 41792 87251 85874 47174 82492 19006 28083 2029 43723 90617 72537 17120 41354 70308 54375 19507 25746 18812 55622 62327 57860 17...

output:

-1

result:

ok 1 number(s): "-1"

Test #32:

score: 0
Accepted
time: 5ms
memory: 4108kb

input:

100000
47821 89482 36838 97926 15868 67541 5918 13721 52762 6155 84419 13875 37874 99550 18162 42463 84657 14613 7399 5184 30896 2164 2108 86501 22747 28294 14105 45680 83309 66038 28628 10622 17068 52764 83537 66347 19346 20953 2612 78095 64113 46976 82024 8337 99874 44538 75289 98264 19574 40584 4...

output:

-1

result:

ok 1 number(s): "-1"

Test #33:

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

input:

1
-1

output:

1 

result:

ok 1 number(s): "1"

Test #34:

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

input:

3
-1 -1 -1

output:

-1

result:

ok 1 number(s): "-1"

Test #35:

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

input:

4
-1 -1 -1 -1

output:

2 4 1 3 

result:

ok 4 number(s): "2 4 1 3"

Test #36:

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

input:

5
-1 -1 -1 -1 -1

output:

1 3 5 2 4 

result:

ok 5 number(s): "1 3 5 2 4"

Test #37:

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

input:

10
4 8 3 7 10 2 9 6 1 5

output:

4 8 3 7 10 2 9 6 1 5 

result:

ok 10 numbers

Test #38:

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

input:

1000
519 49 455 296 716 326 517 650 329 99 112 588 350 260 334 430 309 474 783 617 733 662 281 152 651 644 572 177 127 839 831 353 539 781 653 354 630 79 456 859 61 874 23 406 422 349 387 601 861 786 100 586 991 791 628 721 642 756 997 689 464 218 600 72 415 882 870 961 433 565 551 322 527 83 850 52...

output:

519 49 455 296 716 326 517 650 329 99 112 588 350 260 334 430 309 474 783 617 733 662 281 152 651 644 572 177 127 839 831 353 539 781 653 354 630 79 456 859 61 874 23 406 422 349 387 601 861 786 100 586 991 791 628 721 642 756 997 689 464 218 600 72 415 882 870 961 433 565 551 322 527 83 850 520 987...

result:

ok 1000 numbers

Test #39:

score: 0
Accepted
time: 5ms
memory: 4064kb

input:

100000
96441 10065 51682 67028 58767 25227 33129 75073 74290 14527 31189 47469 32267 77577 66832 56243 88116 88571 83806 33650 17758 39110 4520 24183 70707 60791 21773 7577 86889 97903 14190 48716 50047 79158 43881 9386 65844 41735 8311 85127 93922 76340 24060 50371 90901 19272 97570 29896 92716 470...

output:

96441 10065 51682 67028 58767 25227 33129 75073 74290 14527 31189 47469 32267 77577 66832 56243 88116 88571 83806 33650 17758 39110 4520 24183 70707 60791 21773 7577 86889 97903 14190 48716 50047 79158 43881 9386 65844 41735 8311 85127 93922 76340 24060 50371 90901 19272 97570 29896 92716 47047 2209...

result:

ok 100000 numbers