QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#80245#2378. Tree PermutationspigstdAC ✓132ms22844kbC++142.1kb2023-02-23 11:04:292023-02-23 11:04:31

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-23 11:04:31]
  • 评测
  • 测评结果:AC
  • 用时:132ms
  • 内存:22844kb
  • [2023-02-23 11:04:29]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int,int>
#define x first
#define y second
#define vi vector<int>
#define vpi vector<pii>
#define all(x) (x).begin(),(x).end()
#define WT int TT=read();while(TT--)
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;
}
inline void ckmax(int &a,int b){a=(a>b?a:b);}
inline void ckmin(int &a,int b){a=(a<b?a:b);}

const int M=2e5+10;
int n,a[M],S,deg[M],c[M],t[M];

signed main()
{
	n=read();
	for (int i=1;i<=2*n-2;i++)a[i]=read(),S+=a[i],deg[a[i]]++,t[a[i]]++;
	sort(a+1,a+2*n-1);
//	for (int i=1;i<=2*n-2;i++)cout<<a[i]<<(i==2*n-2?'\n':' ');
	for (int i=1;i<n;i++)c[i]--;
	for (int i=1;i<=2*n-2;i++)c[a[i]]++;
	for (int i=1;i<=n;i++)
		c[i]+=c[i-1];
	int cnt=0;
	set<int>qwq;
	for (int i=1;i<n;i++)
		if (c[i]<0)
		{
			for (int i=1;i<n;i++)cout<<"-1 ";
			cout<<'\n';return 0;
		}
		else if (c[i]==0)
		{
//			cerr<<"no:"<<i<<'\n';
			cnt++;
			if (deg[i+1]==0&&i!=n-1)
			{
				for (int i=1;i<n;i++)cout<<"-1 ";
				cout<<'\n';return 0;
			}
			t[i+1]--;
		}
		else if (t[i+1]!=0) qwq.insert(i+1);
	qwq.erase(1),t[1]--;cnt++;int f=0;
	for (int i=1;i<cnt;i++)cout<<"-1 ";
//	for (int i=1;i<=n;i++)cerr<<t[i]<<(i==n?'\n':' ');
	multiset<int>s1,s2;
	int nans=0;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=t[i];j++)s1.insert(i);
	for (int i=1;i<=cnt;i++)
	{
		auto p=s1.end();p--;
		int x=*p;s1.erase(s1.find(x)),s2.insert(x),nans+=x;
	}
	for (int i=cnt;i<n;i++)
	{
		if (f){cout<<"-1 ";continue;}
		cout<<nans<<' ';
//		if (i==8)
//		{
//			cerr<<'\n';
//			for (auto x:s2)cerr<<x<<' ';
//			cerr<<'\n';
//		}
		if (qwq.size()==0)
		{
			f=1;continue;
		}
		int x=*qwq.begin();t[x]--,qwq.erase(x);
		if (s2.find(x)!=s2.end())
		{
			s2.erase(s2.find(x)),nans-=x;
			auto p=s1.end();p--;int y=*p;
			s1.erase(p),s2.insert(y),nans+=y;
		}
		else
			s1.erase(s1.find(x));
		auto p=s1.end();p--;int y=*p;
		s1.erase(p),s2.insert(y),nans+=y;
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 7432kb

input:

3
1 1 2 2

output:

2 3 

result:

ok single line: '2 3 '

Test #2:

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

input:

3
2 2 2 2

output:

-1 -1 

result:

ok single line: '-1 -1 '

Test #3:

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

input:

6
1 4 5 4 4 4 3 4 4 2

output:

-1 -1 -1 17 20 

result:

ok single line: '-1 -1 -1 17 20 '

Test #4:

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

input:

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

output:

9 18 26 34 42 48 51 48 -1 

result:

ok single line: '9 18 26 34 42 48 51 48 -1 '

Test #5:

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

input:

10
9 8 8 6 8 8 4 5 8 6 9 9 8 9 8 2 9 4

output:

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

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #6:

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

input:

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

output:

-1 -1 -1 -1 -1 -1 -1 -1 81 

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 81 '

Test #7:

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

input:

10
7 4 3 2 4 2 2 4 2 7 8 7 2 2 6 2 4 4

output:

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

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #8:

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

input:

10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

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

result:

ok single line: '1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #9:

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

input:

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

output:

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

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #10:

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

input:

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

output:

-1 -1 -1 -1 -1 -1 -1 72 -1 

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 72 -1 '

Test #11:

score: 0
Accepted
time: 3ms
memory: 5412kb

input:

20
4 7 7 6 2 7 1 2 4 10 2 6 10 11 1 14 1 2 4 16 19 15 5 1 7 3 11 9 4 17 11 7 9 11 16 15 6 7

output:

19 36 52 68 83 98 112 123 134 145 150 149 147 143 134 -1 -1 -1 -1 

result:

ok single line: '19 36 52 68 83 98 112 123 134 ...50 149 147 143 134 -1 -1 -1 -1 '

Test #12:

score: 0
Accepted
time: 3ms
memory: 7444kb

input:

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

output:

-1 -1 56 74 92 109 126 142 158 174 190 205 218 225 228 228 224 217 -1 

result:

ok single line: '-1 -1 56 74 92 109 126 142 158...205 218 225 228 228 224 217 -1 '

Test #13:

score: 0
Accepted
time: 3ms
memory: 7536kb

input:

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

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 361 

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 361 '

Test #14:

score: 0
Accepted
time: 3ms
memory: 5484kb

input:

100
57 84 68 75 26 79 77 92 18 12 17 48 95 8 77 14 19 57 16 33 63 94 13 20 17 14 74 7 84 23 23 1 24 83 1 83 85 9 72 91 61 73 6 35 45 62 19 39 18 39 4 7 24 21 49 37 6 84 73 52 12 93 52 7 24 25 75 18 85 19 91 23 48 31 39 32 53 4 42 52 1 8 2 3 1 77 23 10 2 1 20 3 23 26 29 26 18 28 9 69 19 33 9 44 1 5 2...

output:

98 193 288 382 476 569 662 755 847 938 1029 1119 1204 1289 1373 1457 1541 1625 1708 1791 1871 1950 2029 2107 2184 2261 2338 2415 2490 2565 2640 2714 2787 2860 2933 3005 3075 3144 3212 3280 3345 3410 3473 3536 3598 3659 3720 3780 3839 3896 3953 4005 4048 4084 4113 4129 4140 4146 4145 4136 4118 4097 4...

result:

ok single line: '98 193 288 382 476 569 662 755... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #15:

score: 0
Accepted
time: 3ms
memory: 7608kb

input:

100
24 84 68 75 32 74 77 92 51 12 17 97 95 71 77 14 88 57 16 77 63 94 85 92 71 54 74 7 48 2 23 53 95 83 1 83 85 9 72 91 61 73 18 62 45 62 10 39 32 61 4 7 13 21 49 91 34 84 73 19 20 93 52 7 13 35 94 54 33 12 91 23 79 95 39 32 19 4 9 52 28 87 64 22 4 77 23 52 45 75 20 84 23 61 29 26 18 28 28 69 19 33 ...

output:

98 196 293 388 483 578 673 768 863 957 1051 1145 1238 1331 1424 1516 1608 1699 1790 1881 1972 2063 2153 2241 2329 2417 2504 2589 2674 2759 2843 2927 3011 3094 3177 3260 3342 3421 3500 3578 3655 3732 3809 3886 3963 4038 4113 4188 4263 4337 4411 4484 4557 4630 4702 4774 4845 4916 4987 5058 5128 5196 5...

result:

ok single line: '98 196 293 388 483 578 673 768... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #16:

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

input:

100
99 99 99 99 99 84 99 94 99 99 99 23 68 99 99 36 99 81 41 99 99 99 99 99 7 47 99 97 71 48 99 11 28 66 99 43 99 88 45 59 99 44 22 30 99 80 52 95 33 91 99 76 99 3 99 25 99 99 17 5 82 78 99 99 14 99 99 99 99 99 77 99 29 99 99 99 31 75 99 99 62 99 42 99 92 54 99 55 83 99 99 19 99 72 27 63 99 99 99 51...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 9801 

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...1 -1 -1 -1 -1 -1 -1 -1 -1 9801 '

Test #17:

score: 0
Accepted
time: 14ms
memory: 9000kb

input:

10000
9615 3860 2978 1639 3337 4182 5055 627 9911 4011 7036 5718 9555 199 1729 1580 169 148 280 964 230 7095 759 7519 737 3973 3903 4654 2372 8325 5586 7617 7275 6740 5625 4060 3104 4996 6496 7149 259 4436 1788 2482 1396 3271 7636 2704 6505 4167 1941 8180 8168 375 7868 3030 3992 4539 2449 1901 387 9...

output:

9999 19996 29992 39985 49978 59968 69957 79945 89933 99919 109904 119888 129872 139856 149839 159820 169801 179781 189760 199738 209716 219694 229670 239645 249620 259594 269567 279539 289511 299483 309455 319426 329395 339364 349330 359294 369257 379218 389179 399139 409099 419059 429018 438977 448...

result:

ok single line: '9999 19996 29992 39985 49978 5... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #18:

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

input:

10000
9615 3860 2978 548 8144 4182 2516 8838 9911 4011 7036 5718 969 8396 1729 8715 169 2755 9317 964 7695 7095 6363 2966 4778 3973 3903 4654 2372 8325 5586 7617 7275 6412 5625 4060 3104 4996 5636 7149 5907 7600 1843 2482 6441 3271 7636 2704 6505 6608 8151 8180 8168 8678 7868 2895 1846 4539 9831 348...

output:

-1 19998 29997 39995 49992 59989 69986 79982 89977 99972 109966 119959 129952 139945 149937 159928 169918 179908 189897 199886 209874 219862 229848 239834 249820 259805 269790 279775 289760 299745 309729 319713 329697 339681 349664 359647 369630 379612 389594 399575 409556 419536 429515 439494 44947...

result:

ok single line: '-1 19998 29997 39995 49992 599... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #19:

score: 0
Accepted
time: 3ms
memory: 6032kb

input:

10000
8792 7114 9574 3097 9999 7540 7943 9999 3359 2120 3265 9999 9999 2207 4792 4427 9999 2867 9947 9999 9999 2664 9999 9999 9999 9999 8198 8605 9999 2838 2685 7225 9999 9999 9999 4644 8541 9999 9999 7326 9999 9999 6897 6527 9999 9999 9999 9999 7281 7557 6507 9999 7145 5438 2229 5857 9999 2777 6848...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 99980001 '

Test #20:

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

input:

10000
706 545 915 9604 6266 2900 6204 1973 8962 1179 4898 1215 653 9348 204 836 1400 3033 427 5985 4144 9412 1284 1328 3813 2838 45 1418 3546 1384 6571 859 5206 7562 3239 7700 5444 8099 400 2041 3681 6 6213 5369 6396 9459 2350 8864 206 3367 3302 1457 8445 15 5766 545 3836 70 2860 4137 9788 3468 1733...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #21:

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

input:

10000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #22:

score: 0
Accepted
time: 132ms
memory: 22844kb

input:

100000
73258 50928 64874 58694 5922 60897 69304 5217 11523 31873 8186 87869 20156 37592 36551 86061 23207 16892 6271 7889 21796 28856 35500 59819 10617 95552 2128 64423 35852 72871 35521 85555 1120 73818 51322 61192 41442 62861 31314 75503 39833 72457 30613 2638 37109 44157 6749 6813 14373 76045 522...

output:

99999 199996 299993 399990 499985 599978 699970 799962 899954 999945 1099934 1199922 1299909 1399896 1499882 1599867 1699850 1799831 1899811 1999788 2099765 2199741 2299717 2399692 2499666 2599640 2699612 2799583 2899553 2999519 3099482 3199444 3299406 3399365 3499324 3599279 3699233 3799186 3899138...

result:

ok single line: '99999 199996 299993 399990 499... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #23:

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

input:

100000
73258 26104 87547 8556 5922 60897 69304 6651 59824 31873 22628 87869 20156 84534 29768 86061 35344 18357 3751 28078 21796 5840 36826 49089 10617 95552 48188 64423 35852 72871 51847 85555 65962 73818 47154 26167 96780 62861 31314 75503 76745 72457 37407 2638 37109 44157 58289 5121 12725 76045 ...

output:

99999 199998 299996 399993 499990 599987 699984 799981 899977 999972 1099966 1199959 1299952 1399945 1499937 1599929 1699921 1799913 1899904 1999894 2099883 2199871 2299859 2399847 2499834 2599821 2699808 2799795 2899781 2999766 3099751 3199735 3299719 3399703 3499686 3599669 3699652 3799634 3899615...

result:

ok single line: '99999 199998 299996 399993 499... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #24:

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

input:

100000
28225 99999 37459 99999 18094 99999 99999 76533 99999 51696 99999 91577 25723 99999 13615 18580 99999 8346 99999 14968 99999 99999 99999 99999 54227 76685 99999 66767 99999 99999 54718 99999 75838 5117 99548 99999 99999 99999 99999 19440 58520 99999 99999 99999 18649 99999 60915 82549 99999 9...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...1 -1 -1 -1 -1 -1 -1 9999800001 '

Test #25:

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

input:

100000
20271 50732 55145 34514 95045 35957 47753 4658 64946 24429 12466 49650 16721 1267 12215 25488 18114 34090 61757 74313 25992 76526 35235 10226 55180 93852 98026 30239 362 46081 48896 1660 49827 87472 69296 32667 81131 73909 6185 52248 25693 57404 68804 564 22242 36572 60367 311 64029 3294 7067...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #26:

score: 0
Accepted
time: 47ms
memory: 17440kb

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:

1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...

result:

ok single line: '1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #27:

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

input:

100000
7199 24831 53267 28800 24796 14837 22805 82513 95041 99797 2729 76125 28621 90326 61522 21391 909 54502 31989 26733 7401 11815 30351 90402 47836 80942 1567 4430 10373 2398 5488 77729 39348 79553 14731 1856 26322 28095 49112 44655 23805 34023 13129 3224 1964 4921 69875 4728 7100 54617 87105 33...

output:

99999 199998 299997 399996 499995 599993 699989 799984 899979 999973 1099967 1199961 1299954 1399945 1499933 1599921 1699908 1799895 1899881 1999867 2099853 2199838 2299823 2399807 2499790 2599773 2699755 2799737 2899719 2999700 3099678 3199655 3299631 3399605 3499578 3599551 3699523 3799494 3899465...

result:

ok single line: '99999 199998 299997 399996 499... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #28:

score: 0
Accepted
time: 119ms
memory: 21468kb

input:

100000
58447 16459 22305 69544 89791 30427 92265 30192 17011 27122 53488 4288 9050 93071 23827 2952 7790 98328 3379 25936 13112 87417 8157 11767 301 6802 95319 22531 2839 23284 5843 32549 41353 91840 47902 5384 17241 27874 1623 46149 88392 62220 67127 90598 87653 24490 28794 75229 15478 96416 35322 ...

output:

99999 199997 299994 399990 499984 599978 699972 799965 899956 999945 1099932 1199917 1299901 1399885 1499865 1599843 1699820 1799796 1899771 1999745 2099719 2199692 2299665 2399637 2499609 2599577 2699543 2799509 2899475 2999440 3099404 3199367 3299330 3399292 3499251 3599210 3699169 3799127 3899083...

result:

ok single line: '99999 199997 299994 399990 499... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #29:

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

input:

100000
89292 65678 45372 5737 96514 28432 20058 21610 1966 5943 68841 2511 32605 93575 85418 64447 31910 20114 63733 5902 31829 22150 56787 2720 8987 9232 40685 31261 42045 5244 352 63553 18771 18129 51084 77316 96469 39937 819 92798 19937 2377 9868 12451 85971 34025 29403 52958 15874 35012 3490 354...

output:

99998 199994 299989 399983 499976 599968 699960 799949 899936 999916 1099896 1199875 1299854 1399833 1499811 1599789 1699763 1799735 1899706 1999677 2099647 2199616 2299584 2399551 2499518 2599484 2699449 2799414 2899379 2999344 3099308 3199270 3299231 3399191 3499151 3599110 3699069 3799028 3898986...

result:

ok single line: '99998 199994 299989 399983 499... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #30:

score: 0
Accepted
time: 122ms
memory: 22152kb

input:

100000
28305 39679 14804 28546 23591 72780 9666 96940 95325 53037 78416 8459 61444 80310 48558 11047 49881 50558 18663 93542 2322 82990 3749 3383 4504 4373 31641 36780 36679 20757 23869 18151 76581 31503 21882 57529 1022 54307 8146 47993 86591 70389 41002 20863 1050 22300 32703 62253 18041 58056 600...

output:

99998 199996 299994 399991 499987 599978 699965 799951 899937 999921 1099905 1199887 1299868 1399848 1499826 1599802 1699775 1799748 1899720 1999692 2099663 2199634 2299605 2399575 2499544 2599513 2699481 2799448 2899414 2999380 3099345 3199309 3299272 3399235 3499196 3599156 3699115 3799074 3899030...

result:

ok single line: '99998 199996 299994 399991 499... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #31:

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

input:

100000
99999 99999 61732 99999 99999 37080 99999 99999 99999 50659 60174 99999 60022 92172 14022 99999 47267 52087 5288 99999 99999 26720 99134 99999 21250 99999 99999 99999 46559 99999 99999 99999 99999 99999 99999 96589 99999 99999 99999 99999 99999 99999 9742 99999 99999 99999 89262 34513 99999 9...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #32:

score: 0
Accepted
time: 15ms
memory: 8820kb

input:

100000
21131 54343 37132 99999 34528 22863 99999 36472 99999 99999 99999 43757 99999 74518 99999 26406 99999 19005 56719 99999 99999 87827 40065 99999 71820 15872 99999 56899 90545 99999 99999 27054 86812 22733 99999 5375 19089 61897 99999 99999 99999 68207 99999 55095 99999 99999 89924 99999 99999 ...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '

Test #33:

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

input:

100000
55737 31737 99999 99999 99999 40222 11841 99999 30629 99999 99999 10567 99999 99999 99999 99999 99999 54524 99999 99999 99999 99999 94728 99999 99999 44684 99999 615 99999 99999 99999 88415 99999 96730 99999 99999 74950 99999 57509 99999 44251 5519 99999 26900 99999 99999 99999 99999 99999 99...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...1 -1 -1 -1 -1 -1 -1 9999800001 '

Test #34:

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

input:

100000
97246 99710 71664 98870 99613 98826 93681 95773 99821 95307 64514 2737 6275 2921 12316 94874 95652 93662 52452 96960 93822 98488 90217 85871 95905 27121 96722 94971 93100 67795 99524 96521 12032 48623 69248 47553 43530 93080 98398 14324 97682 49823 95995 8728 7102 95100 63608 97757 96679 9586...

output:

-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...

result:

ok single line: '-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ... -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 '