QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#261403#4580. Bicycle TourNYCU_gAwr_gurA#TL 104ms20160kbC++171.6kb2023-11-22 20:57:562023-11-22 20:57:57

Judging History

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

  • [2023-11-22 20:57:57]
  • 评测
  • 测评结果:TL
  • 用时:104ms
  • 内存:20160kb
  • [2023-11-22 20:57:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#define fast
#else
#define fast cin.tie(0)->sync_with_stdio(0)
#define endl '\n'
#define cerr if(1);else cerr
#endif
#define _ <<' '<<
#define ALL(v) v.begin(),v.end()
#define ft first
#define sd second

using ll = long long;
using ld = long double;
using pii = pair<int,int>;

int dsu[100001], bcc[100001];

int fnd(int a,int *rr)
{
	return rr[a]=a==rr[a]?a:fnd(rr[a],rr);
}

bool unn(int a,int b,int *rr)
{
	a=fnd(a,rr);
	b=fnd(b,rr);
	if(a==b)
		return 0;
	rr[b]=a;
	return 1;
}

vector<int> G[100001];
int pp[100001], dep[100001];

void dfs(int a,int f)
{
	pp[a]=f;
	dep[a]=dep[f]+1;
	for(int b:G[a])
	{
		if(b==f)
			continue;
		dfs(b,a);
	}
}

int ans[1000001];
int arr[1000001];

signed main() {
	fast;
	
	int n,m;
	cin>>n>>m;
	vector<tuple<int,int,int> > edge;
	for(int i=1;i<=n;i++)
		cin>>arr[i], dsu[i]=bcc[i]=i, ans[i]=-1;
	for(int i=0;i<m;i++)
	{
		int a,b,c;
		cin>>a>>b;
		c=abs(arr[a]-arr[b]);
		edge.emplace_back(c,a,b);
	}
	sort(edge.begin(), edge.end());
	for(auto [c,a,b]:edge)
	{
		if(unn(a,b,dsu))
		{
			G[a].emplace_back(b);
			G[b].emplace_back(a);
		}
	}
	dfs(1,0);
	for(int i=1;i<=n;i++)
		dsu[i]=bcc[i]=i;
	for(auto [c,a,b]:edge)
	{
		cerr _ a _ b _ c _ endl;
		if(!unn(a,b,dsu))
		{
			while(fnd(a,bcc)!=fnd(b,bcc))
			{
				if(dep[a]<dep[b])
					swap(a,b);
				if(ans[a]==-1)
					ans[a]=c;
				if(ans[b]==-1)
					ans[b]=c;
				unn(a,pp[a],bcc);
				a=pp[a];
			}
		}
	}
	for(int i=1;i<=n;i++)
		cout<<ans[i]<<" \n"[i==n];
	
	cerr _ "meow" _ endl;
	
	return 0;
}

详细

Test #1:

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

input:

8 11
5 2 7 0 10 6 6 6
1 2
1 3
2 3
2 4
2 5
2 7
3 5
1 6
6 7
6 8
7 8

output:

4 4 5 -1 8 0 0 0

result:

ok single line: '4 4 5 -1 8 0 0 0'

Test #2:

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

input:

4 5
10 20 30 40
1 2
1 3
1 4
2 3
3 4

output:

20 20 20 30

result:

ok single line: '20 20 20 30'

Test #3:

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

input:

5 4
72 35 22 49 108
1 2
2 3
3 4
4 5

output:

-1 -1 -1 -1 -1

result:

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

Test #4:

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

input:

2 1
10 20
1 2

output:

-1 -1

result:

ok single line: '-1 -1'

Test #5:

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

input:

252 31626
825 5234 3578 4723 2145 4362 1861 2413 7203 1939 3210 7153 2155 4559 4403 1466 887 3786 6529 719 4272 3287 5703 6708 2390 4987 4214 770 3487 6230 3498 6255 4963 1093 3065 2961 1663 4857 3224 4284 4228 106 1614 1010 145 1557 4510 1032 4632 155 5570 154 884 1204 2876 6163 5023 4593 7261 3729...

output:

55 33 46 34 10 33 34 30 22 33 33 46 10 34 26 100 14 62 17 9 13 35 81 45 23 29 23 20 11 32 11 32 29 38 18 13 14 0 28 13 11 42 35 22 9 57 22 22 35 7 52 7 14 45 72 92 14 8 15 62 10 20 21 34 66 9 20 24 29 6 30 16 26 9 6 27 8 40 85 17 12 26 29 17 10 61 35 9 39 15 14 14 31 22 63 66 110 24 16 7 30 22 15 18...

result:

ok single line: '55 33 46 34 10 33 34 30 22 33 ...45 15 71 10 52 18 16 30 10 34 4'

Test #6:

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

input:

30 435
268435456 1024 67108864 16777216 134217728 131072 524288 512 256 8 32 64 33554432 2097152 128 2048 16384 8192 4096 8388608 65536 536870912 4 2 16 1048576 32768 1 262144 4194304
24 28
23 28
10 28
25 28
11 28
12 28
15 28
9 28
8 28
2 28
16 28
19 28
18 28
17 28
27 28
21 28
6 28
28 29
7 28
26 28
1...

output:

201326592 768 50331648 12582912 100663296 98304 393216 384 192 6 24 48 25165824 1572864 96 1536 12288 6144 3072 6291456 49152 402653184 3 3 12 786432 24576 3 196608 3145728

result:

ok single line: '201326592 768 50331648 1258291...2 786432 24576 3 196608 3145728'

Test #7:

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

input:

430 92235
268435456 64 536870912 256 128 134217728 2 64 33554432 524288 1048576 268435456 1048576 512 32 32 8192 8192 8192 268435456 256 1024 16384 8 2097152 1 4 65536 268435456 32768 2048 512 128 32768 268435456 8192 4194304 16384 1024 4194304 128 33554432 67108864 1 512 16 128 16384 536870912 4 16...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'

Test #8:

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

input:

4815 185773
999998072 999997632 999995973 999998063 999999530 999999125 999999430 999998145 999999596 999997846 999999214 999998642 999997013 999995796 999999311 999996273 999996607 999996332 999995768 999996225 999996086 999996362 999997090 999997081 999998960 999996645 999996842 999998514 99999527...

output:

66 57 91 47 76 25 193 80 42 120 47 87 36 50 34 219 43 42 97 227 57 40 28 45 141 46 111 84 164 131 99 60 135 181 88 44 147 58 104 199 60 202 24 46 53 56 116 105 79 48 26 34 59 79 52 31 131 166 29 38 35 25 146 119 275 33 42 119 84 95 32 57 280 106 92 47 309 116 52 310 47 85 100 53 114 35 23 84 79 70 7...

result:

ok single line: '66 57 91 47 76 25 193 80 42 12... 173 79 85 50 80 71 47 22 56 49'

Test #9:

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

input:

98999 135802
999915141 999970725 999970117 999947993 999935245 999995293 999929471 999931920 999920419 999957183 999935027 999960800 999906092 999915777 999965089 999905949 999979021 999933691 999988435 999975097 999960084 999972032 999910145 999932210 999933979 999910318 999926596 999961902 9999664...

output:

67767 26917 -1 -1 38445 72454 29312 51112 -1 27742 53854 40947 73684 57120 58146 34789 53977 -1 33543 -1 26917 -1 29995 40427 30208 44827 41060 31384 49362 64479 29692 65900 25703 31337 -1 40560 21511 26288 56255 79786 32090 34373 40241 64207 37436 63306 -1 53100 41333 51042 30032 35731 -1 33762 -1 ...

result:

ok single line: '67767 26917 -1 -1 38445 72454 ...4 77902 30701 65641 47833 85899'

Test #10:

score: 0
Accepted
time: 36ms
memory: 11224kb

input:

4283 182226
262144 268435456 64 64 32 2 536870912 512 536870912 8192 134217728 16 131072 32 2097152 8192 32768 1024 1024 1024 8388608 256 65536 67108864 256 4 16777216 67108864 134217728 8192 8 67108864 134217728 4096 8 268435456 134217728 4096 128 8 4096 32768 8388608 256 262144 524288 536870912 33...

output:

229376 0 32 32 0 0 268435456 0 0 0 0 0 0 16 0 0 31744 0 512 0 4194304 0 32768 0 0 2 8388608 0 0 0 4 33554432 0 2048 0 0 0 0 0 0 0 16384 0 0 0 262144 402653184 16777216 268435456 0 0 0 0 32768 8388608 0 0 0 0 0 67108864 0 4096 0 0 1048576 0 0 0 0 0 512 0 16 0 0 0 32768 8192 1 0 0 0 0 0 0 0 2 4 0 0 0 ...

result:

ok single line: '229376 0 32 32 0 0 268435456 0...0 0 0 0 12 0 0 0 0 50331648 2 0'

Test #11:

score: 0
Accepted
time: 82ms
memory: 14876kb

input:

96917 161085
536870912 524288 131072 262144 128 268435456 1024 32768 33554432 8 4194304 8192 16777216 2048 16777216 2097152 8192 1048576 131072 1 512 1048576 8192 2 134217728 8192 1024 32768 524288 32768 536870912 131072 33554432 2 256 65536 128 8 16384 128 8388608 16 32 2097152 512 8388608 128 2048...

output:

-1 4193792 -1 262142 16256 268435200 2044 30720 33554416 536870904 4194272 4186112 12582912 2047 16777184 2097088 31744 786432 122880 131071 130560 1048575 1048572 4194302 -1 65528 15360 32764 524272 -1 536870911 4063232 33554424 2046 3968 63488 2064384 67108856 2031616 65408 8380416 65520 524256 20...

result:

ok single line: '-1 4193792 -1 262142 16256 268... 8191 16777184 524280 536870848'

Test #12:

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

input:

2276 189315
999997978 999999292 999998174 999999881 999999029 999997762 999998882 999998569 999999722 999999686 999997917 999998501 999997764 999999457 999999256 999999329 999998747 999997838 999998750 999998996 999997958 999999564 999999833 999998592 998940220 999999181 999998669 999998403 99999852...

output:

20 32 10 19 11 38 27 7 36 28 62 7 3 13 19 24 7 9 7 14 24 12 30 8 1057586 23 22 18 11 12 17 22 11 7 7 8 10 11 25 12 12 42 44 10 10 14 11 18 28 18 21 18 21 9 13 23 21 56 30 10 19 22 4 17 22 26 16 44 64 7 10 44 15 27 26 27 12 13 22 22 10 6 34 5 11 14 20 14 15 14 13 32 14 18 18 12 16 18 12 31 6 9 9 18 2...

result:

ok single line: '20 32 10 19 11 38 27 7 36 28 6...32 25 14 11 20 30 32 32 22 9 13'

Test #13:

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

input:

92822 99949
999946646 999971953 999936903 999966043 999997604 999995940 999956577 999979354 999990943 999986032 999988993 999999390 999960794 999969467 999955426 999976112 999952521 999907752 999976247 999954381 999968368 999960021 999940315 999972523 999937486 999959537 999984892 999951681 99997891...

output:

-1 -1 -1 53275 45818 -1 48136 -1 55997 -1 45877 -1 -1 -1 -1 -1 43292 -1 61178 39212 -1 -1 -1 -1 -1 -1 -1 -1 71358 -1 -1 -1 -1 -1 51386 33011 -1 -1 -1 64729 89212 -1 71795 -1 -1 58797 -1 -1 -1 50767 -1 -1 66186 -1 88191 -1 -1 -1 -1 54061 57729 -1 -1 66785 62112 79833 -1 38845 -1 79137 88722 57106 -1 ...

result:

ok single line: '-1 -1 -1 53275 45818 -1 48136 ...1 -1 -1 39634 -1 47207 -1 -1 -1'

Test #14:

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

input:

1898 176595
33554432 8192 2097152 16777216 16777216 16384 4194304 536870912 16777216 536870912 128 2097152 524288 1024 4194304 2048 16777216 32 2 8192 64 134217728 65536 262144 524288 16777216 8192 1 2048 8388608 8192 524288 4 128 67108864 16777216 512 4096 262144 8388608 32 1048576 128 67108864 102...

output:

0 0 0 0 0 0 0 0 0 0 0 1048576 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 65536 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 1048576 ...0 0 0 0 0 0 0 0 0 0 0 8 512 0 0'

Test #15:

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

input:

3 3
30 20 10
1 3
2 3
1 2

output:

20 20 20

result:

ok single line: '20 20 20'

Test #16:

score: 0
Accepted
time: 53ms
memory: 16840kb

input:

90733 119755
1024 536870912 131072 262144 4194304 64 65536 4194304 536870912 4194304 2 2097152 32768 512 2097152 262144 536870912 16384 4 268435456 8388608 16777216 4194304 65536 1024 2 4096 4 131072 8 2048 134217728 8192 67108864 512 1048576 16777216 16 1024 256 262144 33554432 524288 512 2048 2097...

output:

32760 536346624 -1 -1 4194176 491520 -1 -1 536739840 -1 134217726 2080768 -1 122880 2080768 536608768 -1 16769024 536870908 -1 58720256 16777214 4186112 33488896 134216704 -1 -1 262143 -1 268435454 32512 134216704 2096640 -1 32767 134217726 14680064 2064384 16777214 -1 -1 -1 133693440 523776 65280 1...

result:

ok single line: '32760 536346624 -1 -1 4194176 ...54400 268435452 260046848 65504'

Test #17:

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

input:

1136 105665
999999847 999999319 999999467 999999562 999999034 999999858 999999716 999999892 999999579 999999506 999999714 999999013 999999313 999999349 999999924 999999686 999999404 999999932 999999629 999998975 999999287 999999469 999999695 999999075 999999956 999998959 999999550 999999575 99999988...

output:

10 11 11 10 2 3 7 6 4 8 17 12 9 3 17 6 7 7 9 6 4 6 8 10 13 5 5 4 8 8 4 5 18 14 8 19 16 7 11 6 8 3 8 7 4 8 13 4 11 7 3 9 17 7 7 6 6 30 5 1825632 8 3 3 14 5 10 8 3 26 8 10 8 7 5 12 4 4 4 12 7 5 21 7 8 7 6 3 6 4 3 8 5 9 14 3 15 9 9 10 7 4 8 15 17 10 4 13 8 3 6 9 6 7 9 14 12 27 10 7 12 9 7 7 24 8 20 5 5...

result:

ok single line: '10 11 11 10 2 3 7 6 4 8 17 12 ... 8 7 5 7 8 7 9 6 5 3 3 19 6 3 5'

Test #18:

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

input:

94990 136180
999973983 999982826 999980853 999938836 999967770 999965770 999941129 999915204 999976045 999920385 999958274 999990147 999910492 999982595 999918907 999925659 999975482 999972917 999907885 999950160 999972694 999922674 999956135 999941366 999927742 999911824 999909804 999994395 9999379...

output:

-1 49024 23374 41131 60747 22924 -1 24913 26324 24913 -1 49666 81625 -1 64027 41273 34764 24977 56108 -1 59038 -1 29107 63237 21887 -1 89246 -1 43366 45569 63370 59252 44135 -1 44112 29494 70707 -1 61190 33299 55281 53231 40337 87225 22388 31262 32601 47518 31221 37560 -1 75611 73879 81775 49890 219...

result:

ok single line: '-1 49024 23374 41131 60747 229...9297 24428 -1 68961 44312 27340'

Test #19:

score: 0
Accepted
time: 27ms
memory: 10960kb

input:

2547 104496
1024 32768 16384 16384 128 16384 16384 512 128 134217728 8192 524288 33554432 1024 2097152 512 67108864 4 8 8 16 4 536870912 4096 16 8192 32 134217728 64 16 33554432 1048576 2 536870912 8388608 64 32 256 536870912 64 32768 8 4 8388608 536870912 32768 16384 8 256 524288 2048 1 2097152 8 1...

output:

0 0 0 8192 96 12288 0 0 64 67108864 0 0 16777216 512 0 0 0 0 0 56 0 0 402653184 0 0 0 0 67108864 32 0 0 524288 1 268435456 4194304 0 0 0 0 32 0 0 0 0 0 16384 8192 4 0 0 0 0 1572864 0 0 0 0 0 4096 0 0 262144 1536 0 0 0 0 32 0 32768 32768 512 25165824 4096 4 0 512 0 0 16384 0 0 12 0 0 1 0 196608 0 2 2...

result:

ok single line: '0 0 0 8192 96 12288 0 0 64 671... 134217728 0 0 0 0 0 0 0 0 8192'

Test #20:

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

input:

94990 102420
8192 131072 4096 262144 524288 262144 512 4194304 2048 32 33554432 16384 2097152 524288 2 16 16 16 262144 131072 128 33554432 32 134217728 2 1 65536 16 4194304 8388608 268435456 4194304 8 268435456 16 16777216 131072 268435456 1 1 2048 512 8192 4096 1024 536870912 64 1 4 512 262144 6710...

output:

67100672 524284 -1 -1 -1 -1 -1 -1 -1 2031616 33553920 -1 -1 -1 -1 -1 -1 -1 -1 -1 8323072 -1 8380416 -1 33554430 -1 2095104 -1 -1 -1 -1 267386880 -1 -1 -1 -1 -1 268402688 -1 -1 268435455 524286 -1 134217724 2097120 536805376 134213632 -1 262128 -1 -1 -1 8388592 66584576 -1 134217727 2097144 8388480 -...

result:

ok single line: '67100672 524284 -1 -1 -1 -1 -1...34217472 -1 -1 -1 -1 1048448 -1'

Test #21:

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

input:

93504 140254
252571116 474658570 497208431 243826610 12884391 412407613 797944191 872580102 496583302 661594577 606155886 573336212 409153391 20035879 338180890 313771031 958966673 211196165 820182360 900824261 944666698 169166067 904437481 83006698 793232851 92440436 917809518 324053456 452975528 2...

output:

379245564 434019031 369760018 343071715 845777735 209572509 433544081 404612758 451932524 344246994 334080969 522814018 403426646 573857544 561496591 499953892 385909754 529124941 725233301 377833370 687652359 599053304 297331750 225049060 205585295 602678701 502329444 310735514 330414181 358218597 ...

result:

ok single line: '379245564 434019031 369760018 ...5 492061555 292498254 320548015'

Test #22:

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

input:

92708 139060
29492862 11687217 858267302 103888622 654270198 757049373 702153551 397308221 298066413 205128932 350580011 127258333 376423539 170656085 883996400 990630238 581375021 545299112 992953840 683334419 390608964 545890631 77809482 651794030 263378765 797892705 885095320 908162407 964818309 ...

output:

7528 11231 18915 10726 15435 18621 9944 5976 6399 27920 25248 6635 17210 32772 34547 11512 17788 14057 1158 11936 24370 20572 19299 46520 10656 18439 19886 14885 20168 26427 10753 15064 17248 22418 8840 27699 7828 7339 41575 42680 14294 29942 11251 16925 8908 14197 17798 13433 10665 17335 11924 2181...

result:

ok single line: '7528 11231 18915 10726 15435 1...75 10463 35475 29949 8755 39422'

Test #23:

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

input:

90656 131444
340113100 458881838 233820102 981524094 978131814 340754776 928273232 588614007 287250079 917831417 588954466 188116386 469995342 168914144 370960055 813017920 916589164 771794602 550025586 170037726 389764527 117808463 821663883 208823731 572467324 308303638 469827856 979296245 6291402...

output:

500835138 193045769 419503448 604832139 513965490 391429713 600293958 676719382 586039680 557879250 256745138 568704305 698190031 498027260 328591766 637571100 556750674 480083186 396350726 613174120 369675334 774063314 364708899 227565056 256333940 664319427 140289310 259111395 434443767 540839201 ...

result:

ok single line: '500835138 193045769 419503448 ...1 331635646 278307831 589772093'

Test #24:

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

input:

93726 117249
855064465 739161961 714101350 824165076 453787042 289608569 377708552 251017467 518083695 298164346 104676701 137482213 531051537 260094024 511047694 453019967 273293742 400806807 205146707 98871782 473189049 833882576 872350570 901329227 21869978 520218896 855944108 365796469 193407102...

output:

776748803 620689292 765354541 787203171 860994209 484652408 759854930 680114726 581979542 680282679 775700584 764992067 686645381 477966509 384296750 477053230 306752857 627414033 347253160 629676716 530246634 494908066 561878068 147084416 536249807 902789009 810042416 525795140 425201572 541422587 ...

result:

ok single line: '776748803 620689292 765354541 ...8 721417080 750160936 409530364'

Test #25:

score: 0
Accepted
time: 40ms
memory: 15708kb

input:

90950 93259
447011512 249434675 818313499 837811295 549907854 251720472 978738540 401324424 353562251 567825033 214897835 631053693 462089346 80526286 972696406 837760074 641587936 661665261 521106995 337730067 875182892 763179478 546737934 11488675 500332740 251060470 29354033 684632836 912462437 1...

output:

697081382 875405508 906683285 810153167 952623557 820774249 855132269 926780077 932434684 801457926 918908905 822429118 911412736 716576398 970951814 945541226 939130017 912194069 956449650 799370716 875533618 843814112 672183372 971169165 936994157 882019982 936499862 967619360 899166024 826523302 ...

result:

ok single line: '697081382 875405508 906683285 ...3 902014112 629615225 956089812'

Test #26:

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

input:

3 3
1000000000 1000000000 1000000000
1 2
1 3
2 3

output:

0 0 0

result:

ok single line: '0 0 0'

Test #27:

score: 0
Accepted
time: 48ms
memory: 16092kb

input:

99018 101504
839840120 229104548 247998906 859226114 443449351 698467647 758933937 891076216 960336934 566338643 168384088 449146787 354633591 18748929 38609467 748890147 362636445 124330094 951895089 161844720 624162787 957480563 185910386 203804927 575631805 43942130 357917481 516787299 268887534 ...

output:

81076 43413 63954 63360 69668 88352 66587 85009 82789 40404 35990 62452 49178 37050 59800 62330 88217 55055 50888 52115 71207 68928 76375 72167 51503 67196 63411 39671 60081 71367 73641 68218 41332 38130 39450 66185 48304 87838 62963 62725 46976 64200 83158 48682 54211 46299 59567 62636 93496 63056 ...

result:

ok single line: '81076 43413 63954 63360 69668 ...2 72053 76302 69163 86582 59925'

Test #28:

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

input:

95076 95075
999334049 845203489 829064587 117149900 250257051 348165966 522588105 633863670 621854269 750498046 796621117 129111454 516874841 822747709 497600437 467360231 812249354 376558527 795709536 48199641 481418333 91922103 487455846 966424611 710073070 552204640 812009735 163443717 121376331 ...

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 -1'

Test #29:

score: 0
Accepted
time: 36ms
memory: 16604kb

input:

94101 94100
349657857 781670068 162670138 68723767 852748209 832893076 823840804 984296057 920025618 471866029 971696248 141787402 37943514 855019160 925989123 63788383 904134683 793769973 597770817 970097859 944593056 437877343 92176841 935225600 536934837 785684002 258290370 205720377 385630306 40...

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 -1'

Test #30:

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

input:

98692 98691
922289605 761443166 341213076 256931982 255787533 317239190 262027125 410782044 696169678 195261901 956988505 187283747 370191629 923089854 6652470 155560057 592551191 926826544 667206033 59506587 936582028 606084535 847124907 664518901 32799907 757847669 752774657 431989813 329079086 23...

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 -1'

Test #31:

score: 0
Accepted
time: 40ms
memory: 15252kb

input:

98852 98851
34723148 310670108 484193924 583893661 720967713 83441800 234834858 91394285 453405115 169755326 573142510 528617 391042650 736306706 427691753 344423883 189094871 457133205 428126895 142707738 159620431 524346392 59308167 987739801 941106224 456777804 509157351 337508612 853707441 95342...

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 -1'

Test #32:

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

input:

90943 200000
609706135 58122286 374876015 618784019 256774332 639707652 238286761 183661256 87609199 98282180 43577784 199586795 565634762 228961725 23168460 225128102 53220522 34466881 605010180 141400126 261807328 889020341 537165510 48070934 252699410 205764098 736194770 164969201 257436055 72635...

output:

-1 129298345 -1 343506356 195408372 612632110 36990902 91616407 187668464 -1 635157183 -1 290357099 427317843 801354982 426083728 116830240 240810782 505306224 776431441 106578457 578642112 179197795 160934127 710206454 129050941 460917107 110308462 162126875 567902133 -1 551188887 427744549 -1 2136...

result:

ok single line: '-1 129298345 -1 343506356 1954...71 37177677 100796545 140019918'

Test #33:

score: 0
Accepted
time: 104ms
memory: 16308kb

input:

98088 200000
557426653 944770717 724264842 585263238 868565452 539961199 655253135 888604032 260958866 310898581 172704172 448356518 856707975 965977027 80865591 404505902 26800426 42229727 211897013 759617363 53271195 567206124 928353260 681564479 939240394 81121098 973582028 232010168 781948214 95...

output:

109854382 397149860 373664105 204799277 320944595 10075120 286063065 175010481 327614048 454761768 708503359 130105779 309087118 418356170 466755266 312410544 454270803 -1 481791370 211996506 -1 264365318 906551500 133943622 363462035 466499759 396270135 315610689 179570714 348132103 -1 164055135 85...

result:

ok single line: '109854382 397149860 373664105 ...1 239453049 266019601 568045423'

Test #34:

score: 0
Accepted
time: 55ms
memory: 17444kb

input:

95998 191993
221324820 302165997 197518448 215275018 79268840 609672659 116365125 542475706 356834834 503113271 8406671 36599788 731231718 49296126 71333561 121134227 90739624 54947451 91422071 71637971 518769397 101725445 384673847 172002146 593978670 74689948 441476670 113190848 24208875 59388217 ...

output:

135906138 267396050 155183585 107284444 139684766 511161142 513531629 532081835 288643269 419979799 432919420 436474603 614931165 361378405 394703145 577542455 703971710 491948184 278854056 77637241 403668857 487814986 290163101 142810270 510460670 460465005 314591307 88572882 494731057 274609610 40...

result:

ok single line: '135906138 267396050 155183585 ...8 552524112 774362581 514051373'

Test #35:

score: 0
Accepted
time: 53ms
memory: 16560kb

input:

100000 100000
386476757 191748921 593516089 321934164 829833057 38461855 826653887 351919980 327920084 282968094 219097145 132254146 532479679 488738764 945642359 401126775 196563011 256528133 370754478 947907900 171182372 497947277 647839744 302182525 751255562 585439858 537091549 761604704 4351362...

output:

999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 999966734 ...

result:

ok single line: '999966734 999966734 999966734 ...4 999966734 999966734 999966734'

Test #36:

score: -100
Time Limit Exceeded

input:

100000 199997
24624 43011 4563 66303 41067 30099 10631 62022 84718 76143 90418 18032 47477 73050 75524 91122 68568 83177 57962 56710 40377 11002 10937 37866 23318 68969 72589 2283 44969 74941 50406 94543 13182 84200 52622 90667 47590 71567 87715 71719 24914 82127 92218 79627 83229 54887 76737 99359 ...

output:


result: