QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396637#4996. Icy ItineraryNetwork_ErrorTL 777ms96992kbC++141.7kb2024-04-22 22:37:532024-04-22 22:37:53

Judging History

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

  • [2024-04-22 22:37:53]
  • 评测
  • 测评结果:TL
  • 用时:777ms
  • 内存:96992kb
  • [2024-04-22 22:37:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define piii tuple<int,int,int>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
#define int long long
int n,m,L[300010],R[300010];
map<int,map<int,bool> > p;
void sol2(){
	memset(L,0,sizeof L);
	memset(R,0,sizeof R);
	vector<int> vec(n);
	iota(vec.begin(),vec.end(),1);
	mt19937 rnd(time(0));
	shuffle(vec.begin(),vec.end(),rnd);
	int mid=1;
	for(auto i:vec){
		if(i==1)continue;
		if(!R[mid])L[R[mid]=i]=mid,mid=!p[mid][i]?i:mid;
//		else if(!L[mid])R[L[mid]=i]=mid,s=i;
		else{
			if(!p[mid][i]){
				int nxt=R[mid];
				L[R[mid]=i]=mid;
				R[L[nxt]=i]=nxt;
				mid=!p[i][nxt]?nxt:i;
			}else{
				int nxt=L[mid];
				if(!nxt){
					sol2();
					exit(0);
				}
				L[R[nxt]=i]=nxt;
				R[L[mid]=i]=mid;
				mid=!p[nxt][i]?i:nxt;
			}
		} 
	}
	for(int i=1;i;i=R[i])cout<<i<<' ';cout<<'\n';
}
void work(){
	cin>>n>>m;
	for(int i=1,u,v;i<=m;i++)cin>>u>>v,p[u][v]=p[v][u]=1;
	vector<int> vec(n);
	iota(vec.begin(),vec.end(),1);
	mt19937 rnd(time(0));
	shuffle(vec.begin(),vec.end(),rnd);
	int mid=1;
	for(auto i:vec){
		if(i==1)continue;
		if(!R[mid])L[R[mid]=i]=mid,mid=p[mid][i]?i:mid;
		else{
			if(p[mid][i]){
				int nxt=R[mid];
				L[R[mid]=i]=mid;
				R[L[nxt]=i]=nxt;
				mid=p[i][nxt]?nxt:i;
			}else{
				int nxt=L[mid];
				if(!nxt){
					sol2();
					exit(0);
				}
				L[R[nxt]=i]=nxt;
				R[L[mid]=i]=mid;
				mid=p[nxt][i]?i:nxt;
			}
		} 
	}
	for(int i=1;i;i=R[i])cout<<i<<' ';cout<<'\n';
}
signed main(){
	ios::sync_with_stdio(0),
	cin.tie(0),cout.tie(0);
	int T=1;while(T--)work();return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5748kb

input:

4 4
1 2
1 3
1 4
3 4

output:

1 4 2 3 

result:

ok qwq

Test #2:

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

input:

5 0

output:

1 5 3 4 2 

result:

ok qwq

Test #3:

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

input:

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

output:

1 2 4 5 3 10 6 7 9 8 

result:

ok qwq

Test #4:

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

input:

2 1
1 2

output:

1 2 

result:

ok qwq

Test #5:

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

input:

2 0

output:

1 2 

result:

ok qwq

Test #6:

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

input:

3 1
1 3

output:

1 3 2 

result:

ok qwq

Test #7:

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

input:

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

output:

1 2 5 4 10 3 7 6 9 8 

result:

ok qwq

Test #8:

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

input:

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

output:

1 2 5 4 10 3 7 6 9 8 

result:

ok qwq

Test #9:

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

input:

15 40
12 11
11 6
5 11
15 14
10 14
15 5
1 11
10 12
4 3
6 4
4 9
2 11
6 12
13 7
7 9
10 9
1 2
9 11
2 6
7 14
2 9
3 13
9 1
2 7
8 11
1 10
13 1
4 15
3 7
2 15
6 5
10 15
4 14
15 6
2 4
3 11
1 14
2 8
1 8
10 7

output:

1 5 2 12 9 8 3 15 11 14 6 13 4 7 10 

result:

ok qwq

Test #10:

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

input:

15 1
13 6

output:

1 5 9 11 2 12 8 3 15 14 6 4 13 7 10 

result:

ok qwq

Test #11:

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

input:

150 150
110 99
80 122
55 67
24 47
73 68
150 13
94 140
146 59
136 28
94 134
131 2
26 105
65 79
57 37
116 102
84 16
110 78
72 5
34 8
8 43
83 57
49 146
43 112
54 139
95 13
11 95
75 29
29 30
52 14
118 56
4 51
18 146
31 113
56 69
44 14
63 123
44 66
101 122
52 10
16 118
71 93
22 113
28 88
5 108
16 48
84 1...

output:

1 103 49 124 146 44 88 89 54 135 122 7 11 37 128 121 6 143 112 51 136 24 32 3 25 91 102 15 75 58 96 30 56 80 62 82 139 111 4 35 144 42 116 68 130 109 39 145 48 150 18 87 84 20 60 14 140 23 74 125 107 40 38 108 78 148 22 101 34 12 67 137 147 46 64 114 110 57 81 86 104 132 120 66 142 134 52 45 83 16 1...

result:

ok qwq

Test #12:

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

input:

1500 1500
370 639
1046 375
1191 907
782 923
1369 196
998 194
640 331
309 631
1053 1076
887 1112
650 1437
2 1133
847 302
647 81
22 691
772 14
1112 62
266 1399
865 980
1302 1146
1007 575
1448 261
1489 1189
1134 1009
7 1175
1369 942
709 365
675 514
1021 1250
1415 2
976 746
564 388
431 326
43 147
385 81...

output:

1 1124 600 198 409 1290 1187 1350 347 375 178 7 955 639 1222 317 1464 250 647 1383 494 1376 1412 1252 1485 601 1005 1216 1316 326 1390 374 1351 1036 1158 892 139 1276 527 381 144 749 1163 655 1400 566 216 410 1235 332 557 211 817 906 1013 359 229 785 1090 1460 1079 1129 722 910 743 488 552 1301 452 ...

result:

ok qwq

Test #13:

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

input:

15000 15000
11602 9990
5492 14226
2633 14599
7956 12544
1258 1198
13788 3283
171 3770
8226 10782
915 6735
7186 14219
12806 1549
8783 5596
3692 9668
370 4654
13811 4032
835 12990
14273 14020
8902 7798
7405 4524
7476 1864
7786 14984
4367 13552
2927 2463
1929 3198
97 5800
14012 5674
6283 827
13860 1139...

output:

1 11860 4097 8729 14611 14349 5091 6191 7002 13199 178 3518 9428 2355 14075 11600 1464 2765 4463 1643 2163 8017 1412 10932 8436 5715 14213 10292 14177 326 5782 7889 7935 2258 3803 6406 9499 14284 14226 9170 11349 12440 4801 655 2340 9531 9749 410 5171 11239 5799 8562 3169 7275 5415 10098 3879 11970 ...

result:

ok qwq

Test #14:

score: 0
Accepted
time: 165ms
memory: 59464kb

input:

300000 0

output:

1 65824 199288 96358 192157 96698 136978 184739 156894 256529 74262 143118 222778 117714 34729 158862 98936 286175 251174 125215 109220 200524 21692 167402 159915 260350 147985 55394 179922 11767 285400 126853 242775 106356 270085 15501 121582 154364 151478 16048 13992 200236 137833 261827 190319 28...

result:

ok qwq

Test #15:

score: 0
Accepted
time: 161ms
memory: 59552kb

input:

300000 1
80856 110687

output:

1 65824 199288 96358 192157 96698 136978 184739 156894 256529 74262 143118 222778 117714 34729 158862 98936 286175 251174 125215 109220 200524 21692 167402 159915 260350 147985 55394 179922 11767 285400 126853 242775 106356 270085 15501 121582 154364 151478 16048 13992 200236 137833 261827 190319 28...

result:

ok qwq

Test #16:

score: 0
Accepted
time: 166ms
memory: 59496kb

input:

300000 100
254473 70041
278954 218026
54339 23948
90766 35432
145294 42945
10824 168971
162204 196321
137959 274421
274330 8901
113606 229638
136217 161945
232685 214848
91296 146678
8764 206628
297190 163150
140047 161791
188167 261504
261443 160497
262029 233857
112139 37654
43010 192683
3697 1727...

output:

1 65824 199288 96358 192157 96698 136978 184739 156894 256529 74262 143118 222778 117714 34729 158862 98936 286175 251174 125215 109220 200524 21692 167402 159915 260350 147985 55394 179922 11767 285400 126853 242775 106356 270085 15501 121582 154364 151478 16048 13992 200236 137833 261827 190319 28...

result:

ok qwq

Test #17:

score: 0
Accepted
time: 269ms
memory: 71924kb

input:

300000 100000
279619 105099
95580 46691
139476 105331
67098 144910
105689 84242
198438 147050
274697 179922
229381 179041
210820 243557
162433 137909
14644 17464
295783 151723
180167 63360
17314 119555
201506 121519
129982 11913
3312 283798
197026 175391
86210 36036
177182 150502
37900 95301
261630 ...

output:

1 16057 288017 28606 69731 251601 209956 79097 58006 111660 207657 249407 99981 33920 125033 253667 171346 59441 171478 239795 113101 230800 8530 90493 277658 126644 227043 31662 211639 227748 159125 215642 5146 124326 76788 120602 85317 298864 98651 68050 133434 235714 62924 112408 47291 105031 134...

result:

ok qwq

Test #18:

score: 0
Accepted
time: 549ms
memory: 96992kb

input:

300000 300000
297121 280398
49505 181149
186167 88552
250816 195719
113345 180891
103968 274040
148345 167433
283785 32444
281156 62491
76167 222701
181130 69399
291957 220950
21996 17907
98113 270806
247895 36687
122761 248769
235623 41248
274601 174896
296046 235115
57460 64170
286130 15089
91951 ...

output:

1 16057 288017 28606 69731 251601 209956 79097 58006 111660 207657 249407 99981 33920 125033 253667 171346 59441 171478 239795 113101 230800 8530 90493 277658 126644 227043 31662 211639 227748 159125 215642 5146 124326 76788 120602 85317 298864 98651 68050 133434 235714 62924 112408 47291 105031 134...

result:

ok qwq

Test #19:

score: 0
Accepted
time: 256ms
memory: 43380kb

input:

1000 300000
794 378
253 365
792 287
235 482
50 807
795 174
786 980
763 645
615 440
364 542
209 856
925 709
965 709
755 592
242 870
960 978
253 404
164 439
931 998
443 318
663 958
560 445
970 245
192 631
321 621
120 472
402 520
939 454
436 893
840 577
112 961
509 9
815 190
357 128
52 433
554 967
384 ...

output:

1 29 493 872 232 61 941 361 549 38 332 413 641 599 775 40 509 424 899 851 782 31 930 949 752 749 256 805 47 153 35 313 552 331 217 689 438 996 819 175 84 821 715 462 874 6 728 967 838 419 957 776 301 286 684 793 779 139 791 263 328 48 788 178 445 46 261 372 233 722 449 621 786 595 794 355 680 994 35...

result:

ok qwq

Test #20:

score: 0
Accepted
time: 777ms
memory: 95984kb

input:

1500 300000
1189 1031
85 1047
1096 1290
1497 193
885 27
603 979
1438 1441
507 1256
1432 803
332 750
536 157
333 1248
1009 943
857 422
849 796
1399 814
911 481
836 36
1360 1175
592 737
277 672
551 331
849 1049
725 343
1312 112
889 544
1154 691
1387 1326
91 481
432 689
1051 248
1069 1499
499 194
748 1...

output:

1 542 1242 213 581 92 610 801 1135 727 1268 384 734 1414 969 815 732 1230 1064 1410 637 536 983 878 1003 880 767 1065 646 1110 1284 240 873 103 458 1459 630 332 997 833 200 1316 1371 862 56 473 158 877 1018 140 903 222 1096 169 808 461 1022 11 1240 1354 503 1253 215 517 1007 1400 21 1077 170 446 915...

result:

ok qwq

Test #21:

score: 0
Accepted
time: 290ms
memory: 47564kb

input:

10000 300000
1236 4556
6003 6937
2217 6717
1150 1520
835 87
6994 6123
4263 8371
6772 4802
7302 3130
6157 4469
9918 3820
1997 5129
9662 7860
5882 9655
4931 8546
4776 1017
3925 6960
8114 6760
7793 3511
2958 3481
7244 3603
8609 4155
1832 2597
1639 6861
6563 8641
7870 3706
3772 4396
7696 6907
8722 1019
...

output:

1 1242 1764 1778 9573 5200 5863 801 6945 2962 4473 3435 1921 1543 5882 3445 969 3690 732 1064 2262 5494 4563 9424 5192 5624 9473 6559 646 3092 6183 7113 873 6464 5038 4535 1459 2615 9244 3848 200 6870 3992 862 5185 2054 6694 2073 4182 7210 9158 6491 3492 1096 7675 5689 4294 7451 2928 2288 6409 9580 ...

result:

ok qwq

Test #22:

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

input:

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

output:

1 3 5 8 4 7 10 6 2 9 

result:

ok qwq

Test #23:

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

input:

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

output:

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

result:

ok qwq

Test #24:

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

input:

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

output:

1 644 612 219 632 107 712 661 519 206 838 999 720 59 79 425 39 257 235 893 299 21 164 159 953 342 193 346 252 139 436 607 672 373 742 623 182 659 559 485 695 655 888 909 143 836 126 544 963 998 783 71 339 228 857 240 835 343 895 520 645 701 60 843 541 441 770 29 7 781 16 728 611 976 314 347 216 50 6...

result:

ok qwq

Test #25:

score: 0
Accepted
time: 93ms
memory: 46408kb

input:

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

output:

1 2596 908 792 402 2277 1615 2688 14 2427 1900 1890 838 712 1016 1161 2426 2636 2857 2129 742 1045 2131 79 425 39 1130 672 252 1365 235 893 2641 2796 164 2382 953 2447 346 139 436 2783 1374 1680 2203 131 559 1886 1197 695 2541 909 1515 2284 1535 46 2110 544 1661 2462 2890 998 2228 2500 190 339 228 2...

result:

ok qwq

Test #26:

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

input:

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

output:

1 2596 4867 792 402 4048 6781 8413 9449 2427 7697 3681 5507 838 3331 5881 1161 8528 2636 6674 8072 8347 1045 3091 79 425 6712 3957 7257 6515 4021 5279 5872 2641 6250 8068 9304 3472 2447 3255 139 5083 7762 1374 6806 8924 131 4386 1886 1197 695 3709 9279 1515 7546 8543 4194 7250 5575 6524 2462 7006 99...

result:

ok qwq

Test #27:

score: 0
Accepted
time: 154ms
memory: 52368kb

input:

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

output:

1 2596 4867 16219 38961 13588 15647 8413 9449 33611 15201 22642 39823 838 18013 37271 30582 27497 20575 17281 23355 39667 17549 33515 12412 29071 10284 3957 7257 39377 4021 24076 23220 14810 12729 8068 9304 3472 31512 36404 21660 37488 21991 11468 35362 32637 16529 38803 16621 25791 695 11227 19731 ...

result:

ok qwq

Test #28:

score: 0
Accepted
time: 233ms
memory: 62568kb

input:

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

output:

1 90021 99041 12908 83705 99553 58574 65889 33912 39311 85131 63015 84612 15767 77274 13563 94459 52459 35979 86601 72640 35245 38383 54455 14079 27618 89776 96762 62752 87025 26080 84793 85339 24564 5384 93403 7567 54306 7757 83769 19466 3334 22452 78370 92161 53704 91217 87300 9964 76698 51419 727...

result:

ok qwq

Test #29:

score: 0
Accepted
time: 396ms
memory: 96896kb

input:

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

output:

1 90021 99041 12908 83705 281324 143048 262559 33912 248749 194973 63015 84612 164470 202551 260129 103500 52459 276304 193820 267551 100241 261426 54455 238368 27618 157952 161904 62752 109532 26080 233052 103944 24564 5384 292926 128201 295293 252550 125356 166236 287334 165174 78370 92161 190041 ...

result:

ok qwq

Test #30:

score: 0
Accepted
time: 95ms
memory: 39688kb

input:

1000 249500
1 702
1 559
1 154
1 284
1 707
1 397
1 281
1 105
1 856
1 712
1 864
1 638
1 640
1 984
1 134
1 819
1 36
1 820
1 146
1 779
1 516
1 420
1 721
1 932
1 426
1 922
1 790
1 167
1 365
1 667
1 690
1 357
1 543
1 778
1 473
1 9
1 239
1 746
1 983
1 141
1 349
1 852
1 826
1 553
1 929
1 628
1 500
1 352
1 6...

output:

1 836 292 178 210 262 500 344 205 934 826 124 539 183 360 336 241 476 203 936 246 256 168 859 108 174 998 977 146 97 496 401 939 884 378 788 36 81 189 753 278 482 164 744 696 688 727 132 248 743 44 581 869 969 504 480 659 46 204 400 878 710 194 722 449 92 63 75 150 848 87 831 465 147 992 830 926 318...

result:

ok qwq

Test #31:

score: 0
Accepted
time: 88ms
memory: 39224kb

input:

750 245875
1 596
1 476
1 375
1 129
1 650
1 604
1 579
1 302
1 574
1 322
1 351
1 206
1 107
1 535
1 597
1 135
1 516
1 330
1 515
1 151
1 357
1 146
1 4
1 150
1 85
1 15
1 655
1 227
1 549
1 311
1 560
1 705
1 273
1 249
1 307
1 191
1 398
1 691
1 621
1 257
1 268
1 729
1 593
1 61
1 139
1 630
1 172
1 740
1 306
...

output:

1 292 268 336 476 446 146 401 597 743 691 465 150 531 227 244 515 419 4 519 398 637 322 181 135 133 61 196 630 670 85 412 357 190 15 165 151 3 574 24 107 369 249 592 306 544 729 680 596 185 516 497 330 186 375 26 139 80 172 82 579 167 311 119 307 587 604 714 621 275 273 558 705 122 302 662 549 333 7...

result:

ok qwq

Test #32:

score: 0
Accepted
time: 99ms
memory: 36616kb

input:

750 245875
1 368
1 278
1 71
1 353
1 405
1 149
1 616
1 153
1 622
1 655
1 105
1 682
1 140
1 668
1 352
1 210
1 257
1 677
1 749
1 612
1 234
1 35
1 400
1 604
1 193
1 505
1 230
1 586
1 358
1 737
1 428
1 346
1 279
1 395
1 584
1 691
1 73
1 435
1 639
1 205
1 320
1 496
1 384
1 295
1 522
1 672
1 309
1 250
1 43...

output:

1 268 292 178 278 164 210 262 189 539 205 500 344 192 690 124 183 360 336 476 36 378 203 281 246 256 168 399 7 674 108 174 446 146 97 496 401 597 442 81 238 482 696 550 365 639 248 743 691 229 44 581 193 659 504 299 362 480 46 204 400 710 54 449 194 722 92 32 149 63 75 465 150 373 87 16 147 577 121 ...

result:

ok qwq

Test #33:

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

input:

750 101324
1 411
1 270
1 170
1 697
1 76
1 64
1 744
1 353
1 109
1 115
1 133
1 560
1 453
1 690
1 297
1 733
1 523
1 479
1 62
1 32
1 80
1 578
1 261
1 682
1 506
1 303
1 646
1 229
1 750
1 421
1 322
1 168
1 543
1 568
1 456
1 138
1 57
1 380
1 534
1 131
1 452
1 614
1 174
1 207
1 617
1 123
1 562
1 69
1 567
1 ...

output:

1 371 543 706 203 35 62 580 368 462 154 182 216 579 721 157 10 611 653 245 722 466 231 423 450 508 23 438 318 275 306 134 649 386 393 599 402 129 478 642 340 251 95 188 390 30 510 147 5 274 250 747 360 632 718 720 143 483 241 314 96 86 537 566 590 214 696 317 18 25 512 563 29 596 470 444 299 674 493...

result:

ok qwq

Test #34:

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

input:

750 45299
1 415
1 743
1 571
1 531
1 419
1 378
1 188
1 454
1 117
1 344
1 362
1 180
1 461
1 228
1 693
1 115
1 275
1 250
1 501
1 618
1 322
1 217
1 42
1 398
1 129
1 88
1 414
1 740
1 90
1 528
1 437
1 124
1 733
1 241
1 487
1 72
1 295
1 366
1 748
1 143
1 55
1 113
1 534
1 479
1 555
1 712
1 349
1 586
1 212
1...

output:

1 371 706 543 203 35 497 62 716 580 462 368 154 514 70 182 579 216 157 721 10 466 611 653 245 722 231 423 450 598 599 508 23 386 438 318 134 393 402 649 341 129 478 275 214 306 642 340 251 95 632 188 390 747 30 274 510 147 5 250 360 718 566 86 314 720 483 96 537 696 87 25 317 18 512 563 29 439 27 59...

result:

ok qwq

Test #35:

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

input:

750 258869
1 124
1 233
1 740
1 493
1 145
1 749
1 142
1 224
1 308
1 572
1 33
1 660
1 246
1 377
1 690
1 105
1 741
1 692
1 497
1 334
1 481
1 450
1 366
1 307
1 739
1 165
1 730
1 430
1 332
52 349
52 424
52 212
52 555
52 531
52 426
52 379
52 637
52 635
52 434
52 40
52 404
52 261
52 190
52 557
52 225
52 52...

output:

1 35 497 423 450 299 493 401 692 404 142 455 690 452 334 608 572 382 660 115 730 644 307 38 224 294 233 551 741 65 740 97 308 414 481 501 332 352 366 424 105 81 377 82 145 9 124 728 165 518 739 291 749 117 33 348 246 486 430 650 52 600 349 266 45 24 602 441 37 517 420 289 689 167 529 628 190 270 465...

result:

ok qwq

Test #36:

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

input:

750 1154
1 433
1 99
1 563
1 370
1 149
1 218
1 477
1 170
1 98
1 299
1 586
1 574
1 51
1 667
1 539
1 659
1 615
1 730
1 12
1 694
1 695
1 662
1 166
1 253
1 84
1 420
1 533
1 231
1 410
433 99
433 563
433 370
433 149
433 218
433 477
433 170
433 98
433 299
433 586
433 574
433 51
433 667
433 539
433 659
433 6...

output:

1 371 706 543 203 35 497 62 716 462 580 368 154 514 70 182 216 579 721 157 10 466 611 653 245 722 231 423 450 598 599 508 23 386 438 318 134 275 306 649 393 402 341 129 478 214 642 340 251 95 632 188 390 747 274 30 510 147 5 250 360 718 566 86 314 720 143 483 241 96 537 590 696 87 25 317 18 512 410 ...

result:

ok qwq

Test #37:

score: -100
Time Limit Exceeded

input:

750 1924
1 211
1 576
1 697
1 175
1 675
1 641
1 301
1 227
1 311
1 669
1 637
1 673
1 245
1 548
1 74
1 740
1 134
1 561
1 90
1 185
1 511
1 57
1 478
1 423
1 310
1 741
1 550
1 7
1 712
1 725
1 293
1 361
1 593
1 558
1 414
1 356
1 94
1 120
1 700
1 60
1 434
1 226
1 647
1 453
1 328
1 221
1 28
1 352
1 11
1 654
...

output:


result: