QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#292666#5706. VillageA_programmer100 ✓46ms26636kbC++202.1kb2023-12-28 10:50:062023-12-28 10:50:06

Judging History

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

  • [2023-12-28 10:50:06]
  • 评测
  • 测评结果:100
  • 用时:46ms
  • 内存:26636kb
  • [2023-12-28 10:50:06]
  • 提交

answer

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

typedef long long ll;
const int maxn = 1e5 + 5;

vector<int> g[maxn];
int n, f[maxn][2], siz[maxn], son[maxn], pos[maxn], mnd, rt;

void dfs(int u, int fu)
{
	siz[u] = 1;
	int mx = -2e9 + 7;
	for (int v : g[u])
	{
		if (v == fu) continue;
		dfs(v, u);
		siz[u] += siz[v];
		if (siz[v] > siz[son[u]]) son[u] = v;
		f[u][0] += max(f[v][0], f[v][1]);
		if (mx < f[v][0] - max(f[v][0], f[v][1]))
		{
			mx = f[v][0] - max(f[v][0], f[v][1]);
			pos[u] = v;
		}
	}
	if (mnd > max(siz[son[u]], n - siz[u]))
	{
		mnd = max(siz[son[u]], n - siz[u]);
		rt = u;
	}
	f[u][1] = f[u][0] + mx + 1;
}

int a[maxn];
bool ins[maxn];

void redfs(int u, int fu, int op)
{
	if (!op)
	{
		for (int v : g[u])
		{
			if (v == fu) continue;
			redfs(v, u, f[v][0] < f[v][1]);
		}
		return;
	}
	else
	{
		swap(a[u], a[pos[u]]);
		ins[u] = ins[pos[u]] = 1;
		for (int v : g[u])
		{
			if (v == fu) continue;
			if (v == pos[u]) redfs(v, u, 0);
			else redfs(v, u, f[v][0] < f[v][1]);
		}
	}
}

int res[maxn], b[maxn], cnt;
void dfs2(int u, int fu)
{
	res[++cnt] = u;
	for (int v : g[u])
	{
		if (v == fu) continue;
		dfs2(v, u);
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	for (int i = 1; i <= n; i++) a[i] = i;
	for (int i = 1; i < n; i++)
	{
		int u, v;
		cin >> u >> v;
		g[u].emplace_back(v);
		g[v].emplace_back(u); 
	}
	mnd = 2e9 + 7;
	dfs(1, 0);
	int ans1 = max(f[1][0], f[1][1]);
	
	ll ans = 0;
	for (int i = 1; i <= n; i++) ans += min(siz[i], n - siz[i]) * 2;
	cout << 2 * (n - ans1) << " " << ans << "\n";
	bool op = (f[1][0] < f[1][1]);
	redfs(1, 0, op);
	for (int i = 1; i <= n; i++)
		if (!ins[i])
		{
			int poss = 0;
			for (int v : g[i]) poss = v;
			swap(a[i], a[poss]);
		}
	for (int i = 1; i <= n; i++) cout << a[i] << " ";
	cout << "\n";
	
	dfs2(rt, 0);
	for (int i = 1; i <= n; i++) b[i] = i;
	for (int i = 1; i <= n / 2; i++) swap(b[res[i]], b[res[i + n / 2]]);
	if (n & 1) swap(b[res[n]], b[res[1]]);
	for (int i = 1; i <= n; i++) cout << b[i] << " ";
	return 0;
}

詳細信息

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 1ms
memory: 7968kb

input:

4
1 2
2 3
3 4

output:

4 8
2 1 4 3 
3 4 1 2 

result:

points 1.0 correct answer = 4; correct answer = 8;

Test #2:

score: 12
Accepted
time: 1ms
memory: 8700kb

input:

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

output:

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

result:

points 1.0 correct answer = 8; correct answer = 18;

Test #3:

score: 12
Accepted
time: 0ms
memory: 7992kb

input:

2
1 2

output:

2 2
2 1 
2 1 

result:

points 1.0 correct answer = 2; correct answer = 2;

Test #4:

score: 12
Accepted
time: 1ms
memory: 7164kb

input:

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

output:

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

result:

points 1.0 correct answer = 8; correct answer = 20;

Test #5:

score: 12
Accepted
time: 0ms
memory: 7256kb

input:

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

output:

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

result:

points 1.0 correct answer = 8; correct answer = 24;

Test #6:

score: 12
Accepted
time: 1ms
memory: 8884kb

input:

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

output:

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

result:

points 1.0 correct answer = 8; correct answer = 18;

Test #7:

score: 12
Accepted
time: 1ms
memory: 8252kb

input:

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

output:

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

result:

points 1.0 correct answer = 12; correct answer = 12;

Test #8:

score: 12
Accepted
time: 0ms
memory: 8416kb

input:

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

output:

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

result:

points 1.0 correct answer = 10; correct answer = 22;

Test #9:

score: 12
Accepted
time: 1ms
memory: 8804kb

input:

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

output:

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

result:

points 1.0 correct answer = 14; correct answer = 22;

Test #10:

score: 12
Accepted
time: 0ms
memory: 9024kb

input:

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

output:

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

result:

points 1.0 correct answer = 10; correct answer = 30;

Test #11:

score: 12
Accepted
time: 1ms
memory: 7996kb

input:

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

output:

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

result:

points 1.0 correct answer = 10; correct answer = 50;

Test #12:

score: 12
Accepted
time: 1ms
memory: 8784kb

input:

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

output:

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

result:

points 1.0 correct answer = 10; correct answer = 42;

Test #13:

score: 12
Accepted
time: 1ms
memory: 7228kb

input:

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

output:

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

result:

points 1.0 correct answer = 14; correct answer = 28;

Test #14:

score: 12
Accepted
time: 1ms
memory: 8800kb

input:

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

output:

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

result:

points 1.0 correct answer = 18; correct answer = 18;

Test #15:

score: 12
Accepted
time: 1ms
memory: 8516kb

input:

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

output:

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

result:

points 1.0 correct answer = 14; correct answer = 28;

Test #16:

score: 12
Accepted
time: 1ms
memory: 8480kb

input:

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

output:

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

result:

points 1.0 correct answer = 16; correct answer = 22;

Test #17:

score: 12
Accepted
time: 1ms
memory: 8156kb

input:

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

output:

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

result:

points 1.0 correct answer = 12; correct answer = 34;

Subtask #2:

score: 38
Accepted

Dependency #1:

100%
Accepted

Test #18:

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

input:

256
229 81
255 131
55 23
79 6
37 152
3 58
173 242
17 131
116 72
109 201
92 187
215 83
101 253
224 23
101 157
219 236
214 61
41 78
190 232
184 215
39 145
215 94
21 255
59 178
255 215
25 63
46 41
77 203
164 206
28 147
195 134
204 155
215 256
107 167
202 95
206 69
57 222
87 25
52 63
69 234
73 110
54 34...

output:

316 2186
17 44 58 65 204 130 24 249 230 179 89 61 161 74 241 190 131 52 207 35 255 68 224 7 87 247 70 147 100 126 83 212 223 54 20 102 152 79 124 216 180 154 40 2 125 78 194 38 137 221 57 63 243 34 23 71 222 3 178 149 214 95 18 173 97 251 229 22 168 27 56 116 110 14 26 55 203 41 48 145 66 81 31 69 2...

result:

points 1.0 correct answer = 316; correct answer = 2186;

Test #19:

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

input:

500
223 499
155 198
156 203
423 438
87 11
3 73
394 298
59 42
394 147
499 377
50 44
144 298
131 147
10 38
235 430
463 288
103 165
339 354
467 76
414 450
50 206
129 443
147 409
476 409
445 239
111 398
293 273
349 296
131 149
206 92
454 183
313 209
390 480
155 406
494 75
408 382
10 100
166 102
123 332
...

output:

636 5114
109 331 73 14 410 421 474 199 203 38 215 243 178 415 19 22 354 107 228 87 466 59 65 206 75 439 188 64 17 425 292 366 115 25 472 330 438 51 481 44 229 154 164 40 159 236 264 58 490 279 10 184 424 12 437 422 254 444 482 473 255 311 192 276 262 340 349 468 414 6 150 277 3 394 447 99 267 391 13...

result:

points 1.0 correct answer = 636; correct answer = 5114;

Test #20:

score: 38
Accepted
time: 1ms
memory: 8944kb

input:

499
239 23
393 140
346 79
261 477
343 157
9 31
466 9
459 488
365 191
38 405
302 340
413 434
227 499
40 318
289 373
290 394
21 479
287 322
52 378
422 283
86 369
39 444
19 321
132 302
31 364
301 142
417 6
25 219
199 223
405 372
133 67
89 449
412 39
382 418
21 379
244 391
477 469
246 484
423 416
6 9
36...

output:

614 4106
239 121 215 242 401 385 386 56 462 18 133 61 51 149 495 357 143 120 321 427 479 296 95 282 482 492 405 417 181 205 431 216 202 164 34 115 387 332 412 318 251 347 111 473 225 270 424 161 159 307 13 378 42 248 295 312 119 375 469 438 324 211 145 453 151 350 356 5 29 249 118 291 44 276 413 240...

result:

points 1.0 correct answer = 614; correct answer = 4106;

Test #21:

score: 38
Accepted
time: 1ms
memory: 8336kb

input:

1000
842 343
479 865
720 325
420 693
317 105
694 123
626 422
306 24
186 483
37 830
103 33
328 345
379 819
79 946
835 433
939 455
271 587
980 524
316 643
204 621
573 60
935 924
984 435
880 123
626 3
689 794
110 378
827 351
487 932
201 193
836 706
874 293
889 845
179 815
800 267
43 934
954 916
805 548...

output:

1294 14376
255 713 269 408 879 286 98 792 28 703 490 972 658 547 362 581 83 218 216 622 11 891 481 306 395 608 381 725 405 930 857 605 103 997 142 251 926 244 961 747 979 506 934 263 380 3 494 117 169 745 40 293 546 473 93 718 288 849 910 988 71 76 368 667 9 623 157 433 662 797 122 283 584 409 55 59...

result:

points 1.0 correct answer = 1294; correct answer = 14376;

Test #22:

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

input:

999
731 687
673 842
221 812
673 902
239 774
18 251
133 461
396 647
376 819
966 519
30 617
297 574
275 88
926 172
907 465
774 303
10 404
547 728
352 357
549 413
27 309
297 843
573 49
556 523
289 655
769 549
16 581
402 576
411 75
981 413
12 108
850 434
627 353
263 752
165 746
761 856
88 375
312 90
761...

output:

1244 11674
717 224 295 861 505 942 187 491 378 404 373 650 931 681 683 581 49 937 835 212 871 392 898 560 895 28 166 993 94 617 156 860 893 167 326 275 559 180 347 385 26 503 530 391 12 282 723 99 17 787 565 975 87 448 945 552 292 711 43 321 708 490 646 390 894 215 34 418 236 137 160 280 23 768 834 ...

result:

points 1.0 correct answer = 1244; correct answer = 11674;

Test #23:

score: 38
Accepted
time: 2ms
memory: 7292kb

input:

987
840 63
459 542
449 461
397 392
585 630
322 108
449 806
10 433
529 449
702 617
674 975
417 156
983 5
746 66
208 232
244 402
162 331
695 175
616 42
528 765
437 100
425 26
96 133
37 91
93 690
317 201
189 128
576 566
847 64
65 684
217 445
214 217
151 369
4 527
91 763
978 87
739 6
802 70
417 786
199 ...

output:

1266 11812
918 668 542 527 854 670 133 838 609 433 437 284 518 557 401 309 782 586 427 777 261 933 371 93 986 270 378 457 17 393 48 614 575 971 190 852 646 363 555 511 214 165 636 844 724 789 447 31 100 366 743 469 752 55 334 847 191 864 571 899 305 816 840 957 86 746 698 502 766 802 551 408 613 801...

result:

points 1.0 correct answer = 1266; correct answer = 11812;

Test #24:

score: 38
Accepted
time: 1ms
memory: 8700kb

input:

1000
618 292
281 35
663 995
702 117
25 252
913 959
740 974
985 395
23 397
352 905
932 681
209 542
745 500
346 371
449 506
856 812
664 545
999 23
813 227
554 944
455 541
472 53
224 39
91 484
139 731
620 233
759 253
279 151
857 450
353 400
797 482
63 43
81 516
141 943
382 660
977 45
240 589
267 47
560...

output:

1000 500000
902 350 486 860 69 680 799 576 730 482 842 850 604 615 654 376 721 763 736 64 635 873 999 555 252 195 73 510 464 737 502 272 397 740 281 420 99 798 752 220 196 558 63 198 977 934 267 245 126 832 452 590 472 302 529 720 65 969 505 657 714 864 43 20 57 207 578 153 5 425 219 710 27 375 349 ...

result:

points 1.0 correct answer = 1000; correct answer = 500000;

Test #25:

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

input:

999
871 760
692 751
234 935
861 721
846 760
231 625
667 861
258 596
771 61
876 782
69 799
567 422
927 920
318 235
58 911
26 383
257 606
228 738
476 428
381 292
46 988
144 814
277 532
770 648
217 32
405 941
130 603
146 661
58 503
912 714
377 256
92 637
477 395
88 278
438 294
708 356
906 149
381 140
9...

output:

1140 91036
729 70 111 732 147 12 120 548 454 750 648 6 247 36 355 840 114 924 287 820 488 949 808 351 31 383 53 464 733 796 25 217 880 726 713 14 110 673 662 49 810 709 717 326 255 988 686 455 40 700 922 789 27 309 366 849 934 911 444 676 771 282 579 748 286 78 702 80 799 711 203 414 841 265 154 174...

result:

points 1.0 correct answer = 1140; correct answer = 91036;

Test #26:

score: 38
Accepted
time: 1ms
memory: 7480kb

input:

909
140 106
583 520
460 181
523 659
107 351
900 122
135 31
368 867
262 110
128 579
640 445
14 818
378 341
196 117
350 400
62 348
879 597
318 618
283 37
315 523
239 879
207 458
905 574
35 127
479 883
812 550
342 590
410 624
462 782
422 560
858 526
8 125
215 447
182 360
17 369
803 7
372 219
8 455
1 64...

output:

1028 43956
64 732 571 357 39 754 828 474 507 21 713 404 23 302 894 547 534 477 173 133 10 5 13 701 275 799 117 819 544 792 272 391 865 228 127 291 875 242 22 639 155 65 533 871 97 522 118 749 751 78 87 176 90 719 371 904 723 842 109 586 91 348 102 1 42 292 752 70 742 68 897 688 695 245 793 856 542 5...

result:

points 1.0 correct answer = 1028; correct answer = 43956;

Test #27:

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

input:

1000
322 537
402 605
63 899
250 892
64 985
806 42
40 618
948 945
686 85
348 536
451 664
612 443
474 780
352 690
778 812
308 289
958 516
389 284
672 366
556 944
569 496
43 364
484 570
738 954
766 402
935 933
696 214
925 559
889 858
590 219
1000 473
609 580
418 357
271 466
758 929
682 878
678 778
917 ...

output:

1002 250998
407 494 686 447 924 434 742 709 673 456 414 160 780 488 858 30 790 552 214 972 599 663 508 946 642 351 973 448 585 16 423 564 671 813 699 374 674 574 679 728 812 806 364 958 710 566 388 939 947 967 286 694 138 834 320 724 820 375 201 178 983 166 123 637 963 587 586 862 518 228 669 936 93...

result:

points 1.0 correct answer = 1002; correct answer = 250998;

Test #28:

score: 38
Accepted
time: 1ms
memory: 7844kb

input:

1000
944 65
357 755
504 31
900 759
916 234
547 41
761 831
282 858
855 983
770 797
539 473
492 455
18 323
915 294
690 69
935 463
701 665
259 215
102 55
5 876
375 735
810 578
371 785
687 757
213 649
307 658
988 462
610 810
870 847
521 97
637 589
173 702
492 426
16 872
412 705
667 778
592 943
810 872
1...

output:

1248 127496
97 88 857 129 876 904 507 818 99 58 851 719 832 112 624 872 248 769 178 563 16 612 107 384 609 343 171 967 502 834 965 639 855 518 163 958 450 699 68 383 547 896 992 979 619 813 341 866 84 848 342 230 571 411 800 223 345 147 176 358 776 366 259 590 944 675 124 833 340 525 910 893 780 51 ...

result:

points 1.0 correct answer = 1248; correct answer = 127496;

Test #29:

score: 38
Accepted
time: 2ms
memory: 9208kb

input:

1000
275 786
275 833
193 275
948 275
409 275
275 988
539 275
275 267
187 275
367 275
556 275
425 275
295 275
275 763
587 275
73 275
40 275
275 709
912 275
64 275
847 275
275 979
275 520
239 275
701 275
477 275
275 454
356 275
906 275
420 275
814 275
739 275
30 275
275 95
502 275
550 275
275 230
275 ...

output:

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

result:

points 1.0 correct answer = 1998; correct answer = 1998;

Test #30:

score: 38
Accepted
time: 1ms
memory: 7480kb

input:

989
740 463
740 19
531 322
740 544
177 531
531 147
937 531
740 365
876 740
750 740
67 531
881 740
740 838
765 740
740 304
344 740
22 531
740 176
491 531
772 740
531 187
833 740
531 933
372 740
740 840
740 295
740 685
740 769
452 531
740 471
740 766
740 846
531 971
740 590
740 212
720 740
721 740
166...

output:

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

result:

points 1.0 correct answer = 1974; correct answer = 2962;

Test #31:

score: 38
Accepted
time: 1ms
memory: 8060kb

input:

1000
215 913
18 659
755 775
60 282
156 687
282 591
797 850
448 282
577 484
637 282
345 913
85 289
634 695
775 746
475 362
489 190
894 269
913 696
831 21
92 547
913 795
267 579
982 839
547 571
21 219
547 759
770 298
258 364
85 878
298 279
85 81
643 504
775 643
18 524
775 952
263 770
775 611
587 775
2...

output:

1940 7958
263 1000 463 521 60 4 3 7 361 5 202 1 279 410 191 267 14 942 15 13 991 12 9 19 22 16 10 289 258 634 190 29 8 23 11 418 92 504 34 32 763 27 26 40 38 41 39 31 362 47 43 51 48 50 53 35 45 25 49 282 36 55 785 6 999 24 33 30 67 52 17 58 69 73 20 215 37 54 78 70 973 72 42 558 992 64 71 74 80 44 ...

result:

points 1.0 correct answer = 1940; correct answer = 7958;

Test #32:

score: 38
Accepted
time: 1ms
memory: 8080kb

input:

888
310 287
55 464
55 160
2 713
73 237
427 193
2 61
679 55
45 73
117 73
73 432
55 785
797 861
704 55
312 861
397 73
474 317
73 43
434 474
213 861
566 801
861 301
230 73
737 2
134 566
427 337
480 55
11 73
577 861
427 114
674 474
887 185
429 427
861 723
316 474
861 819
206 732
73 346
568 55
887 20
2 8...

output:

1756 4288
797 881 464 732 1 193 5 317 287 7 237 4 10 12 11 14 9 13 18 185 15 8 20 23 801 21 19 25 6 713 30 29 22 26 31 27 17 35 36 34 24 32 40 42 43 37 41 45 48 47 44 50 28 51 875 49 56 53 52 3 38 39 61 33 59 60 57 58 46 64 63 54 885 72 70 65 74 66 62 68 71 75 79 69 80 85 77 16 81 67 84 78 90 88 91 ...

result:

points 1.0 correct answer = 1756; correct answer = 4288;

Test #33:

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

input:

1000
60 327
715 322
13 49
48 263
3 523
770 46
551 160
751 160
580 859
392 466
560 282
461 86
339 127
644 539
530 202
605 852
511 550
563 309
425 92
22 17
708 583
134 156
449 225
274 300
578 569
579 335
729 539
464 579
510 79
77 497
593 497
614 636
555 942
8 13
920 67
957 412
613 632
906 649
579 399
...

output:

1392 9628
567 701 990 630 900 457 760 988 833 210 416 985 913 767 451 943 22 433 494 272 743 670 679 823 566 945 712 853 858 959 923 972 54 928 778 998 816 825 534 346 920 385 713 513 963 503 837 997 13 789 726 293 877 918 559 802 310 139 653 327 573 981 396 632 127 874 753 537 948 57 19 274 351 818...

result:

points 1.0 correct answer = 1392; correct answer = 9628;

Test #34:

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

input:

987
543 539
482 744
58 699
322 99
741 808
107 99
248 230
247 917
934 869
438 424
248 258
393 578
632 704
786 418
683 882
679 730
849 46
203 968
33 972
155 223
799 154
154 291
527 867
424 739
731 323
424 484
158 86
452 679
799 686
138 818
672 600
424 853
424 247
331 261
734 772
754 780
15 103
482 552...

output:

1782 6554
818 780 778 322 145 4 769 392 6 358 5 699 46 8 103 10 67 309 658 9 510 19 527 13 731 131 20 16 962 11 363 265 608 17 30 28 132 36 29 289 861 893 1 43 27 849 952 21 48 14 49 374 261 51 546 662 216 981 753 54 542 744 38 22 45 65 466 39 68 881 155 56 349 190 35 86 69 940 12 50 77 64 81 342 18...

result:

points 1.0 correct answer = 1782; correct answer = 6554;

Test #35:

score: 38
Accepted
time: 1ms
memory: 8100kb

input:

975
645 307
416 645
377 175
639 842
527 377
591 444
134 7
42 569
305 194
598 758
7 209
850 175
598 975
471 393
303 444
614 320
126 598
671 194
444 564
728 444
338 598
324 947
733 891
906 515
124 752
175 470
752 243
727 645
547 455
670 499
687 444
590 444
662 552
7 175
444 39
349 444
597 444
473 639
...

output:

1874 5278
527 751 552 393 455 850 970 591 8 307 733 10 12 461 1 134 9 2 6 124 20 13 17 962 19 716 21 18 28 251 359 925 771 947 22 14 23 37 38 29 39 913 27 40 15 35 30 5 36 43 842 34 52 614 569 48 44 56 16 745 45 558 26 46 61 50 55 41 58 65 25 758 68 66 51 200 305 906 69 64 62 81 74 83 79 77 283 84 7...

result:

points 1.0 correct answer = 1874; correct answer = 5278;

Test #36:

score: 38
Accepted
time: 2ms
memory: 8752kb

input:

1000
538 932
941 662
61 662
90 217
276 538
721 260
75 979
217 53
235 684
769 662
538 497
662 355
414 662
147 217
235 309
44 235
217 689
156 217
498 235
52 217
217 617
709 662
662 510
306 662
583 752
578 662
721 258
662 603
217 249
286 235
734 75
662 165
291 721
721 482
917 110
340 235
538 800
217 42...

output:

1980 3906
460 1 941 90 3 917 5 684 932 9 4 11 12 7 14 15 10 16 13 18 979 6 20 19 22 23 17 752 26 29 21 2 30 24 34 8 36 35 33 32 38 41 27 37 953 42 39 46 48 43 47 49 52 53 54 55 51 56 57 31 59 58 61 44 63 50 62 66 65 67 40 28 69 64 995 73 76 77 78 74 60 79 82 70 68 84 83 87 86 217 85 71 260 89 88 95 ...

result:

points 1.0 correct answer = 1980; correct answer = 3906;

Test #37:

score: 38
Accepted
time: 1ms
memory: 7252kb

input:

1000
620 802
417 303
67 87
300 180
67 880
7 453
826 481
720 505
67 754
841 823
67 35
592 402
940 481
599 438
5 67
681 353
890 399
438 732
542 667
258 399
502 667
583 530
399 391
479 949
210 742
337 681
232 512
417 996
417 170
417 97
870 567
470 620
4 849
186 870
559 348
702 288
374 417
681 362
67 99...

output:

1890 6546
890 24 180 964 87 479 961 179 599 186 841 453 838 349 978 11 505 303 561 17 5 542 2 390 402 23 211 18 26 849 22 1 29 16 21 28 32 947 20 27 12 35 353 33 37 39 36 45 19 40 47 34 44 31 53 657 48 8 9 59 52 55 30 348 57 51 994 66 42 13 65 60 46 69 72 62 74 71 56 210 77 629 81 25 738 78 67 61 68...

result:

points 1.0 correct answer = 1890; correct answer = 6546;

Test #38:

score: 38
Accepted
time: 2ms
memory: 8936kb

input:

1000
520 185
785 97
15 774
521 437
421 163
906 123
869 429
520 538
459 70
97 943
178 39
475 97
742 637
705 417
502 520
57 705
487 123
627 97
469 59
403 123
165 437
123 264
369 538
231 57
786 715
96 15
762 794
437 744
692 893
794 437
135 437
794 74
765 9
305 57
924 15
57 965
469 559
520 163
690 449
1...

output:

1938 4626
453 785 917 185 521 762 5 231 997 765 10 59 692 12 981 369 4 782 791 230 16 906 7 119 2 774 421 26 8 25 6 29 810 17 22 3 20 742 178 697 13 40 36 28 420 21 878 691 14 42 30 50 51 417 35 55 991 52 469 32 449 43 54 34 39 23 63 19 62 856 56 27 65 31 459 60 71 61 68 64 11 76 67 73 78 81 53 87 5...

result:

points 1.0 correct answer = 1938; correct answer = 4626;

Test #39:

score: 38
Accepted
time: 1ms
memory: 8036kb

input:

999
683 443
89 76
60 664
625 39
3 811
337 527
687 154
956 443
695 664
702 100
290 957
20 445
154 397
260 823
347 154
620 299
339 664
154 851
170 620
397 781
68 154
155 264
823 555
281 445
620 697
397 213
815 75
811 896
953 397
290 997
154 13
677 664
9 823
527 166
544 154
989 445
11 39
75 570
535 39
...

output:

1938 4914
292 957 811 683 984 60 687 815 990 943 625 6 7 502 2 805 781 13 337 445 16 17 299 100 11 12 22 70 260 18 589 29 30 838 3 32 31 36 988 264 363 24 27 38 25 45 76 35 215 44 42 43 19 49 53 51 52 48 15 664 23 104 1 55 40 960 50 33 56 351 57 37 58 61 968 89 67 46 66 10 26 64 59 79 20 74 85 71 98...

result:

points 1.0 correct answer = 1938; correct answer = 4914;

Test #40:

score: 38
Accepted
time: 2ms
memory: 7276kb

input:

900
825 630
478 117
271 20
293 597
588 280
290 348
412 433
387 597
269 638
841 101
395 379
30 742
836 550
447 438
714 478
535 872
816 386
124 378
358 519
407 843
628 82
875 108
282 500
690 811
465 475
490 629
786 654
287 238
381 686
821 193
299 425
252 626
164 471
195 293
159 408
315 443
166 843
293...

output:

1066 7882
737 171 235 353 421 509 218 409 624 609 344 210 648 401 305 376 891 649 858 123 704 670 87 77 349 493 418 740 346 520 70 497 849 65 677 211 819 666 53 697 887 745 3 359 591 872 195 545 809 875 896 263 39 539 160 331 714 327 205 167 496 610 669 495 34 592 253 200 483 30 675 850 374 873 431 ...

result:

points 1.0 correct answer = 1066; correct answer = 7882;

Test #41:

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

input:

888
235 292
649 771
880 641
57 46
480 401
401 762
587 856
432 475
428 95
698 807
294 713
179 818
166 730
118 714
722 764
745 484
258 474
597 394
822 301
306 202
774 847
643 886
663 772
235 78
734 243
171 718
173 357
539 681
816 186
225 335
702 427
662 626
810 886
258 865
95 722
258 38
764 307
880 60...

output:

1144 10654
57 637 101 52 2 547 664 473 424 298 532 262 677 67 345 70 86 445 1 441 462 250 312 10 242 181 24 359 654 303 620 130 180 747 270 888 793 806 223 337 349 320 94 466 184 643 804 636 43 870 5 272 808 19 856 310 46 176 834 742 394 510 421 245 350 634 14 714 585 800 453 544 195 42 81 651 586 2...

result:

points 1.0 correct answer = 1144; correct answer = 10654;

Test #42:

score: 38
Accepted
time: 1ms
memory: 8672kb

input:

512
89 508
46 478
502 121
413 67
372 22
146 217
337 450
456 321
511 445
275 248
475 32
1 357
59 130
149 372
289 407
47 351
23 102
7 271
486 415
197 243
270 107
68 176
344 429
222 341
200 294
324 291
451 379
331 491
458 30
307 70
326 179
118 400
348 133
121 188
396 310
135 39
43 69
371 113
202 494
46...

output:

682 7190
223 488 321 487 400 8 271 308 47 438 232 396 495 317 307 131 443 53 149 185 472 471 407 237 110 205 492 435 174 455 211 475 143 446 215 170 444 5 430 83 301 13 327 25 480 139 194 382 157 479 142 340 353 173 101 272 180 94 133 442 245 119 198 252 502 333 476 265 484 171 27 410 97 147 402 99 ...

result:

points 1.0 correct answer = 682; correct answer = 7190;

Test #43:

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

input:

1000
749 604
537 255
155 171
608 433
9 347
189 482
269 714
955 137
134 903
730 26
18 478
563 64
722 990
270 587
237 29
67 419
792 574
587 59
797 48
581 91
826 262
87 589
417 649
10 59
693 668
400 678
639 826
541 590
925 96
319 537
348 675
615 429
73 335
987 150
362 243
49 125
169 507
207 266
318 702...

output:

1330 15930
183 467 569 740 2 89 290 279 347 846 941 857 818 807 73 523 761 302 902 351 409 595 140 714 510 730 901 402 237 738 364 125 743 324 787 393 456 326 617 856 60 350 252 848 918 934 401 797 590 493 746 66 465 463 674 339 923 57 631 122 935 561 163 563 741 991 419 755 411 588 74 21 198 179 98...

result:

points 1.0 correct answer = 1330; correct answer = 15930;

Test #44:

score: 38
Accepted
time: 1ms
memory: 8164kb

input:

513
505 334
136 410
403 254
205 286
43 133
274 127
257 389
355 335
182 30
494 221
134 365
354 468
293 204
482 326
418 489
221 458
471 22
173 176
71 461
348 194
190 81
434 459
432 123
420 260
207 483
83 494
506 379
302 184
340 510
465 466
159 57
418 392
77 110
164 436
246 353
462 363
64 72
298 58
177...

output:

684 7206
512 465 100 137 388 95 146 84 178 289 409 436 303 92 449 21 262 172 502 259 161 442 401 245 247 78 475 10 25 321 239 218 428 127 2 222 34 283 393 19 440 357 417 147 237 456 114 425 361 300 153 49 220 381 431 495 206 251 159 213 416 32 390 343 118 323 86 67 458 97 333 64 155 76 193 224 269 3...

result:

points 1.0 correct answer = 684; correct answer = 7206;

Test #45:

score: 38
Accepted
time: 1ms
memory: 7744kb

input:

1000
814 905
347 904
611 989
779 507
175 845
663 597
327 707
175 847
972 737
685 985
895 758
55 557
402 565
323 109
921 497
426 100
567 602
102 807
542 988
123 597
558 980
275 818
437 639
426 326
90 91
715 139
697 369
942 392
958 92
923 991
9 820
93 748
797 589
403 681
821 561
908 344
1 730
18 389
1...

output:

1596 9094
498 366 507 611 260 144 454 58 820 596 407 879 603 517 414 890 512 389 921 670 7 714 755 70 785 730 328 629 135 731 538 829 189 975 539 151 850 783 602 810 29 432 721 931 747 627 782 179 592 909 972 849 49 75 958 342 775 694 967 999 875 24 408 515 346 979 401 628 743 257 525 708 190 30 985...

result:

points 1.0 correct answer = 1596; correct answer = 9094;

Test #46:

score: 38
Accepted
time: 2ms
memory: 9096kb

input:

999
41 215
96 23
802 926
318 19
569 7
271 362
91 295
486 920
491 471
882 754
357 784
106 794
986 763
846 697
361 297
309 295
12 291
726 989
463 707
301 712
569 44
295 379
680 724
17 482
398 562
620 709
473 616
616 521
468 885
491 350
486 781
646 169
680 500
762 602
302 806
271 982
965 51
587 814
455...

output:

1814 5748
19 941 53 878 1 135 569 502 992 302 242 291 646 903 96 841 875 943 318 205 299 208 916 167 857 965 796 567 309 29 108 16 944 954 451 986 855 30 473 362 40 623 885 7 720 85 33 227 759 774 803 953 245 989 858 694 44 765 41 896 852 3 15 976 22 741 641 67 816 24 97 113 894 802 755 38 46 27 43 ...

result:

points 1.0 correct answer = 1814; correct answer = 5748;

Test #47:

score: 38
Accepted
time: 1ms
memory: 8160kb

input:

1000
553 877
155 71
446 981
20 558
254 673
558 1
322 83
553 933
597 810
155 569
585 246
836 254
728 203
55 558
1 847
23 1
775 246
739 246
615 246
558 446
997 810
619 558
810 574
560 203
83 740
446 887
246 364
885 558
203 850
1 445
203 269
830 558
254 255
707 155
925 1
246 72
900 254
1 164
232 203
55...

output:

1980 3794
977 597 877 847 4 981 20 3 8 322 5 6 7 71 14 15 16 13 673 558 585 9 11 10 18 21 12 26 17 2 30 25 19 22 23 27 31 29 32 36 35 39 42 728 40 43 34 47 37 41 33 28 52 38 46 48 45 49 44 59 24 56 60 62 53 57 63 64 54 55 155 65 61 73 72 69 68 50 58 67 80 77 993 81 74 82 76 87 88 78 86 91 51 93 85 7...

result:

points 1.0 correct answer = 1980; correct answer = 3794;

Subtask #3:

score: 50
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #48:

score: 50
Accepted
time: 31ms
memory: 12128kb

input:

90909
17758 575
3979 26221
88569 9552
14110 25350
82691 8857
4392 3854
29926 34058
58734 57918
79463 1578
72922 88952
29022 15060
7400 82837
22366 32557
40522 1551
11803 21395
67987 61163
61666 33213
76732 71510
12690 4331
45264 45547
33241 3589
42298 60029
175 16809
87099 33650
36724 90662
17339 82...

output:

111632 1514350
78262 67353 64675 41070 68660 84193 5761 77755 18757 81500 41894 6427 42484 41064 23891 80102 17497 88356 31471 84394 37331 20977 64465 32369 38029 35974 32642 83020 13379 27040 27916 33934 59751 65818 26185 38232 86524 44145 33289 24235 31029 67671 7995 88248 53951 52464 6306 42451 5...

result:

points 1.0 correct answer = 111632; correct answer = 1514350;

Test #49:

score: 50
Accepted
time: 34ms
memory: 12548kb

input:

99999
54092 13956
13184 61256
33359 49486
66333 35721
18952 38623
44461 32240
7677 43577
10072 69601
51823 90760
3409 2346
35171 14267
11756 4958
1279 98439
6663 79391
41211 680
60131 26805
35555 6553
11752 25265
78423 9479
35573 84992
7615 93132
27092 45858
58284 43654
82163 19951
44496 80808
30235...

output:

128320 2159862
65715 19776 68055 13145 87240 53356 20611 22526 85148 19609 50280 74859 5168 81558 98100 19726 84050 6642 97404 65093 92119 42276 89365 51527 78534 89445 87445 44010 14528 21389 28065 73598 3382 30733 40514 10933 56434 31883 618 56089 44136 20373 70209 57598 86655 49647 31005 45816 22...

result:

points 1.0 correct answer = 128320; correct answer = 2159862;

Test #50:

score: 50
Accepted
time: 34ms
memory: 12432kb

input:

100000
8397 23570
15100 5651
49763 76387
86170 31489
73912 4373
40057 1373
44267 59312
8016 9571
69847 58672
6937 26585
59707 54569
11150 71161
79711 85747
50827 77535
53619 30774
40442 87404
174 11719
28697 64997
99081 58676
97130 34559
36772 82010
93606 4909
50756 30487
45617 4455
73129 58420
7307...

output:

123860 1952940
29587 84429 57549 48964 91841 95014 8038 47683 1266 60179 45907 78354 12977 14246 18660 65558 38823 80413 38263 65212 21192 69455 29395 98711 41109 48096 76221 1433 76381 10231 55422 97108 88062 81932 80805 8820 11398 49258 69434 54480 49612 41806 12356 41108 87423 20513 19286 61962 9...

result:

points 1.0 correct answer = 123860; correct answer = 1952940;

Test #51:

score: 50
Accepted
time: 19ms
memory: 11612kb

input:

77777
49943 35215
22761 10315
63949 60762
4297 59709
45833 48233
24906 70063
1043 24637
48007 35750
52453 36493
22069 3606
16535 2881
42152 50952
62168 47796
55820 54249
31137 17726
71771 10232
23669 19313
25535 61808
43055 75073
27628 61062
3909 15503
5234 8030
43698 40315
47559 43005
42986 14117
3...

output:

99504 1605682
34226 75028 46745 19310 6760 67946 53098 70976 31395 22604 48292 71164 16959 64388 37035 22051 47958 9984 76762 39036 77370 10393 59411 1065 45092 34420 1874 69714 12989 61185 51232 60774 14981 29998 54329 1849 15141 64945 36495 61392 42888 40268 46377 66097 1303 62537 53827 13431 5305...

result:

points 1.0 correct answer = 99504; correct answer = 1605682;

Test #52:

score: 50
Accepted
time: 34ms
memory: 12452kb

input:

98765
26164 11043
13421 94996
26702 23597
51201 48250
67973 352
95881 8874
26458 74693
39046 88648
56736 47954
12216 65746
47531 21188
53614 90889
75649 88093
12503 85226
13085 17574
3182 88290
7886 11181
74066 20694
68687 85540
2669 95364
26971 65560
21145 71952
645 80289
96522 98194
6246 27803
294...

output:

121438 1740764
40273 76663 71300 22607 54725 60288 24926 92411 41753 1091 56496 84203 91790 75874 51487 57009 5027 18516 94297 76454 35478 95863 91421 73817 67912 98322 76167 67335 32408 10452 51207 62498 24841 90438 83057 91357 67052 3023 10455 96698 72589 22585 65938 33979 93970 6489 45777 39199 9...

result:

points 1.0 correct answer = 121438; correct answer = 1740764;

Test #53:

score: 50
Accepted
time: 35ms
memory: 11920kb

input:

88888
18007 20138
8462 60324
76528 52591
4898 80575
65204 88644
39569 56354
74132 32611
76206 80221
30915 52745
6143 32530
37410 31142
59677 25661
76412 76063
6660 37530
45897 15591
71856 63855
1803 81486
33589 37579
38044 36868
51718 27393
56500 62186
50198 1745
24687 49671
56093 47676
2749 5510
41...

output:

113806 1835832
14729 46462 77746 71022 24925 44060 72116 62847 53469 68390 8965 11499 88118 27483 34313 36704 36162 73512 41640 7588 45003 848 34110 51276 249 13715 58466 42782 74055 33243 35400 43123 67786 74075 31811 2900 47585 57079 81991 64779 46205 74268 47859 11999 86707 76940 33846 19734 7299...

result:

points 1.0 correct answer = 113806; correct answer = 1835832;

Test #54:

score: 50
Accepted
time: 21ms
memory: 17376kb

input:

50000
14916 47169
33646 11209
38695 46961
47666 40483
17572 38925
37411 36620
4463 17026
40132 10341
17528 19481
4578 35441
46407 23708
41583 49270
1195 24736
44669 15788
3517 5379
3133 19387
32077 35038
28532 44617
35666 10962
43195 29214
27865 27035
110 63
43623 37912
49803 3591
32881 6416
13331 6...

output:

50000 1250000000
17058 6776 22005 23828 45874 39303 4476 14335 28363 17962 6383 14168 43413 43700 10945 12093 27445 35138 36634 29055 36476 44004 38418 37079 36303 22322 20233 38966 16768 25054 19677 231 19517 10469 34913 47267 40033 5554 3908 8808 19679 39204 4293 14118 24876 35880 17358 32695 7872...

result:

points 1.0 correct answer = 50000; correct answer = 1250000000;

Test #55:

score: 50
Accepted
time: 46ms
memory: 26636kb

input:

100000
34635 44783
29898 23005
11921 93048
26316 97267
76312 78003
44678 65267
92998 33803
18207 56360
97228 34583
51479 61204
15154 52716
55424 6281
26461 50794
52385 57566
45012 286
61533 53131
70762 40867
44304 47410
8330 48137
471 45034
86876 4416
8219 69916
90129 69737
91513 22330
28128 77098
9...

output:

100000 5000000000
16429 71778 52159 64739 78956 71205 90635 51220 84989 35155 65772 28847 35720 49758 81397 65734 91368 54768 98851 66373 103 30647 70581 65203 70270 69907 72714 79091 77499 70250 46984 55913 75404 44636 94542 71876 76988 49377 52894 80912 61976 15699 67811 27186 81576 87503 92977 56...

result:

points 1.0 correct answer = 100000; correct answer = 5000000000;

Test #56:

score: 50
Accepted
time: 41ms
memory: 17756kb

input:

100000
57874 74848
75513 33053
8252 73504
54317 83788
60111 13340
31363 50361
18099 58345
84161 14657
44767 33004
7985 30623
55979 10992
6046 17013
68042 57124
66489 22815
81861 10841
20185 88719
72124 59308
43981 25485
93741 19371
67292 25574
39133 49194
55685 66197
97964 53704
64571 75054
40228 42...

output:

110618 2504160170
6382 8680 43161 26134 41409 65941 13688 10181 25101 96577 26535 37396 68895 26628 75911 20199 43654 89159 55685 17892 86419 13776 53351 48193 7963 13598 67754 6049 88218 22948 43632 58253 31749 55157 40524 6589 69523 22969 56639 55042 5190 33216 44062 5388 55974 70820 48953 34390 3...

result:

points 1.0 correct answer = 110618; correct answer = 2504160170;

Test #57:

score: 50
Accepted
time: 40ms
memory: 15900kb

input:

98765
81026 87591
95939 42505
22772 71253
58032 39973
83905 46725
9616 51346
90127 71702
16798 22229
74466 35601
53002 94854
14026 29206
36395 41515
19908 51464
55451 80213
41927 56419
17761 68704
57675 88162
39109 27245
78393 53771
73516 97673
10058 27149
60582 32042
63577 2879
11137 97742
19593 62...

output:

110634 1634005140
69272 30504 21524 34064 13344 52213 88637 54212 93355 46382 34169 45718 21239 89756 10499 15715 9578 82938 44664 36939 97235 80198 10125 90675 96177 40941 39635 95902 8831 59598 68884 59956 82476 14287 36041 80772 45699 26571 58050 44889 40805 63561 84249 57556 14789 31288 66242 21...

result:

points 1.0 correct answer = 110634; correct answer = 1634005140;

Test #58:

score: 50
Accepted
time: 35ms
memory: 14224kb

input:

100000
21659 3974
12194 694
75940 8912
96273 38672
95780 34408
14755 83593
74731 36134
456 71307
65344 26234
48183 38993
5303 37248
4527 14460
84382 77887
36991 47193
64329 27470
2326 58685
26601 13997
9625 46107
10647 16094
25195 95211
85068 49658
17059 9840
38230 15203
35339 51305
43188 31525
8652...

output:

112768 830383780
12719 90340 93533 49171 23745 32853 53812 31292 16139 82349 20382 82255 22816 37451 88934 14468 67703 5794 95978 31649 10143 58521 41073 21268 68892 61336 41211 71917 12622 21483 33069 81334 4461 48580 76954 82827 75776 78335 1657 18656 4907 6235 68038 19235 94472 68894 42671 54357 ...

result:

points 1.0 correct answer = 112768; correct answer = 830383780;

Test #59:

score: 50
Accepted
time: 33ms
memory: 12508kb

input:

100000
76978 82392
95351 80699
72534 98914
55636 92340
51114 53079
87369 16897
13382 68476
91961 67058
30326 38260
92346 69124
13572 17998
26610 62603
19103 76290
63391 82287
10466 86694
74552 96544
81984 81396
17931 31839
75637 24199
42173 60079
98253 95511
88390 76077
78642 92871
54168 53240
66642...

output:

132516 81728820
56946 23337 52724 55695 80644 64646 49391 26294 35195 43663 91767 94333 91305 78778 51296 78003 50417 12337 54383 58443 53787 44677 71830 15305 9954 26521 69476 51435 3695 7314 44229 14401 67347 95314 30855 51263 56923 65183 2031 65546 44641 56965 7536 27063 16360 200 64851 35567 815...

result:

points 1.0 correct answer = 132516; correct answer = 81728820;

Test #60:

score: 50
Accepted
time: 23ms
memory: 12232kb

input:

100000
6298 68124
6298 92167
43605 6298
20237 6298
63882 6298
17208 6298
6298 8987
35761 6298
6298 37845
6298 12511
6298 84393
6298 4322
6298 70916
77435 6298
6298 13009
3497 6298
6298 32572
6298 97863
3877 6298
6298 3043
6298 89660
6298 61248
77168 6298
6298 74790
39750 6298
6298 3914
6298 73268
44...

output:

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

result:

points 1.0 correct answer = 199998; correct answer = 199998;

Test #61:

score: 50
Accepted
time: 29ms
memory: 12320kb

input:

100000
42523 18318
78023 33382
42523 74647
51119 93379
42523 74276
35982 31079
86097 73375
73375 37592
88260 78023
51119 16060
51119 41589
31079 76077
78023 895
31079 80768
33854 73375
81020 31079
73375 23846
73375 32020
72275 51119
78023 20372
91098 78023
76149 73375
31079 10682
65827 51119
31079 6...

output:

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

result:

points 1.0 correct answer = 199990; correct answer = 359886;

Test #62:

score: 50
Accepted
time: 30ms
memory: 12788kb

input:

100000
61154 13087
5895 20067
53687 86061
65229 2888
82566 2913
77544 1083
64861 21491
60935 82827
94490 81164
2751 80045
36174 20082
23301 28396
4507 38899
3671 75923
97876 10985
1083 8128
94690 61154
83849 67805
14978 44250
53687 13493
82995 30707
79102 65229
80669 5895
60831 14829
64861 31115
326...

output:

199800 932808
71585 85475 79732 27718 67828 29434 6295 29206 1 75923 82827 90533 86061 12000 17164 46390 90903 47222 56282 366 99278 5 74287 26947 55613 14 25 6922 78472 29652 43118 45761 21 2888 99649 14978 36076 88189 31 21730 8 34 11152 69395 28396 10 54557 10985 20082 71042 37 9966 94057 14442 8...

result:

points 1.0 correct answer = 199800; correct answer = 932808;

Test #63:

score: 50
Accepted
time: 25ms
memory: 12568kb

input:

93829
47115 19407
23207 63386
17281 25733
40288 38302
337 2745
91558 51272
22370 40783
13789 52003
37083 8059
27675 38898
16630 62411
5446 7537
48460 75134
75503 42782
39428 2789
53303 44469
17049 13789
33819 78840
93481 56041
45430 54823
47115 47902
59366 26785
68439 80701
88748 31652
25730 88748
8...

output:

187472 837534
17794 24740 59120 17281 40783 9761 68439 88527 3 63297 5820 9568 14037 71547 31557 74470 12353 27675 18492 5 13 89230 47459 54739 2852 48460 74741 45430 1 93303 14833 34058 1980 59921 77580 47902 20 32 8395 2745 7 68897 6571 4 19 2 14345 14 35382 39 10 11 25539 81363 386 59804 49 83711...

result:

points 1.0 correct answer = 187472; correct answer = 837534;

Test #64:

score: 50
Accepted
time: 28ms
memory: 12788kb

input:

100000
6074 30016
92873 16202
89382 94763
84451 61695
55410 77311
70734 1348
84717 93254
322 16517
36660 36555
19763 29256
45432 79846
56371 47603
1293 45667
80748 61938
60378 65283
7214 68770
33315 41354
19205 30453
85874 7272
6461 92941
21152 40823
31531 70537
88385 43025
62239 37094
76000 64945
3...

output:

181934 1209576
13860 95205 7944 20073 79067 47603 66937 8471 940 70008 564 10411 83994 24329 28951 61401 62924 71598 4796 4248 87328 96434 37513 6898 11603 6006 1682 30832 31948 18699 4860 72918 9843 1754 14092 10985 63452 33356 93673 38699 78822 44780 93497 73394 7433 91374 60457 92333 93432 96482 ...

result:

points 1.0 correct answer = 181934; correct answer = 1209576;

Test #65:

score: 50
Accepted
time: 25ms
memory: 12864kb

input:

100000
62417 92075
9076 90574
1978 20625
80303 97502
99109 81465
6723 90574
85715 28319
10212 82521
67762 54591
7926 61407
34194 58080
94103 50110
95676 49819
66386 38478
95660 19111
66186 81032
97417 34022
66146 26540
57859 22135
31461 26768
14198 72129
36051 71315
68973 73771
8786 72861
17058 5867...

output:

197998 1179808
79404 94103 58672 59139 3 61076 89086 29445 99109 73091 91870 67791 9 62958 15424 19878 70100 4353 25489 874 45595 66882 77086 61609 21103 8394 23673 67259 11016 43111 26 66899 99763 12 16676 76201 67609 1978 31767 13 45787 29 40473 8 90812 11718 73185 66439 63766 41837 29906 20 35582...

result:

points 1.0 correct answer = 197998; correct answer = 1179808;

Test #66:

score: 50
Accepted
time: 24ms
memory: 12392kb

input:

93737
25805 12771
58579 81355
40517 64871
32105 61687
7811 38363
39 60019
92788 69703
80392 8638
69458 60914
28508 74958
44040 33277
76080 88615
32105 2051
31640 56251
12235 44072
7811 33026
28297 3146
74710 32807
37813 57534
16768 61620
48071 91372
12742 56251
61620 3372
22308 39
80509 53749
34275 ...

output:

187266 676668
60019 58579 44072 31640 61494 44531 1 13835 55355 48071 28189 10 4 7 65301 25738 78468 25060 53749 48276 78821 64871 91884 16 37736 22 28508 24 13 14 18339 28 30264 30 87935 18435 32 34 93706 3 38 19 23 36 18 41 45 46 26 48 49 37 85472 50 52 44040 54 57 66473 58 55 35 51 21 63 7057 383...

result:

points 1.0 correct answer = 187266; correct answer = 676668;

Test #67:

score: 50
Accepted
time: 19ms
memory: 11456kb

input:

73820
68064 38747
62935 55677
38747 58570
22710 4111
65275 38747
35710 48769
38747 23670
72818 38747
34638 11917
38747 33628
38747 66577
56980 38923
38747 71252
11366 67900
60971 38923
38747 36433
38747 56366
22710 7426
5505 38747
60963 34638
50309 38923
22710 40719
18272 11366
5124 22710
66588 3874...

output:

147618 308338
11917 1 9919 68064 56980 4 6 4111 2 9 7 11 10 13 67900 12 14 16 18 19 8 21 13198 20 22 17 5 26 24 27 30 28 32 33 25 34 29 36 38 37 40 35 41 39 43 44 45 46 47 49 42 50 31 52 51 55 54 56 57 48 59 15 60 58 61 65 63 67 68 64 69 48769 71 66 70 3 74 23 77 75 79 80 73 81 82 83 85 76 84 86 359...

result:

points 1.0 correct answer = 147618; correct answer = 308338;

Test #68:

score: 50
Accepted
time: 22ms
memory: 12212kb

input:

84739
27645 6266
38069 44689
82910 62243
64459 18141
3766 67772
79199 63315
6984 83607
33618 26140
3281 34449
77905 74209
39039 13877
27099 50860
78270 68531
17315 13537
9539 48165
71932 81912
3093 55744
50723 28194
56519 2659
41178 15309
66588 12487
76725 69893
39845 82843
82370 15791
12054 72466
4...

output:

164500 943500
57232 54430 56108 60859 32345 49546 75762 47245 69094 83377 20708 68531 28458 66914 57830 58744 2665 59087 15791 67132 39762 76781 33223 3736 47122 81107 68554 3616 74418 59197 17517 22 1558 68199 6 49991 49106 64763 5 65692 26650 28921 83133 47040 15991 31379 79983 47202 3390 34449 36...

result:

points 1.0 correct answer = 164500; correct answer = 943500;

Test #69:

score: 50
Accepted
time: 29ms
memory: 12844kb

input:

100000
36497 69443
57547 46832
48779 2175
24154 77660
49565 41399
52180 80166
2105 56691
37345 33567
2041 26971
41967 16118
78293 78726
91173 29725
93733 45461
90296 62428
34733 83769
76626 20346
47219 15731
81322 75681
65022 219
11203 47989
3993 42788
31517 44794
65357 48584
23855 6477
46900 79318
...

output:

199368 633508
77660 9199 43877 3 11203 90250 99872 54511 47223 30610 11407 83991 67319 3146 85506 41399 87980 8582 12 39349 58204 69443 51393 95718 62864 12829 95228 44338 10 91384 83905 77746 27 39 69057 77417 62729 62782 90097 21 41772 36134 52005 37 16 29 62354 38110 99989 24998 7845 32298 14 320...

result:

points 1.0 correct answer = 199368; correct answer = 633508;

Test #70:

score: 50
Accepted
time: 28ms
memory: 12652kb

input:

93830
5353 89021
42613 10223
62115 81879
34643 18962
76473 5353
4056 4
63378 3164
32851 91689
2518 26936
1309 45627
86974 62153
12093 80379
1172 17485
18649 33293
39255 42562
16938 24457
3653 15693
1541 15201
48606 20698
17492 91689
79239 53179
8731 14575
72896 32618
57110 11569
68213 12567
281 2508...

output:

187052 572628
16303 59754 12469 93798 3 61885 46955 34113 17923 59557 25085 84465 25531 93009 34618 84147 81792 22470 87957 1062 16530 87237 46179 63093 17926 16792 56780 32125 80379 27 39785 14986 54539 1172 21087 4056 30 15201 85828 35 21842 40675 63031 40876 15 36 86974 53179 25 4336 46345 82799 ...

result:

points 1.0 correct answer = 187052; correct answer = 572628;

Test #71:

score: 50
Accepted
time: 17ms
memory: 11460kb

input:

69696
66494 391
17982 64558
13321 10790
28456 6163
59410 33383
18936 15319
5133 18630
54526 61701
48508 4262
32037 62911
66399 23511
2981 65113
31417 58821
37834 39033
39250 43655
32689 4362
28364 58039
4813 11992
61478 60973
25333 15194
3850 729
12679 60601
50842 19341
3929 42447
45909 17885
16630 ...

output:

138866 431180
65398 20052 35635 2981 24566 67902 6906 55255 60638 60299 48028 7386 19296 63114 4501 44467 1875 48508 27504 31417 32090 52724 4241 43459 18487 48221 69430 35436 15 38950 7 4 23 18630 64041 42827 35 33 3929 28364 44232 16 64416 37 64743 13204 31374 50842 35620 25002 40 29270 24 21 2 19...

result:

points 1.0 correct answer = 138866; correct answer = 431180;

Test #72:

score: 50
Accepted
time: 20ms
memory: 11964kb

input:

78987
50446 31217
10794 66216
18480 62852
70322 27242
6686 12303
19970 58804
55986 2835
35829 66681
70335 58144
30611 31562
59624 51532
57846 42319
151 497
27730 1734
74029 34949
70160 65556
18487 56667
38834 11982
32742 69375
31417 28044
33529 21420
68415 51617
5177 2699
65556 72700
27377 78961
600...

output:

157414 480886
78340 15210 78609 41962 60644 39557 78862 45181 77615 60309 68614 7819 53722 2699 60705 70261 58989 58672 43217 20325 3644 30611 20 11612 70095 4090 69349 37285 2 78694 5236 14658 73812 78803 5 30435 18251 31547 74338 14062 69116 10 61347 73201 12 35 46945 49192 33816 70335 69540 4 511...

result:

points 1.0 correct answer = 157414; correct answer = 480886;

Test #73:

score: 50
Accepted
time: 22ms
memory: 13004kb

input:

99909
67987 37873
59438 18344
69248 60837
80284 72449
82067 44182
7347 66943
204 99576
20051 93553
16699 42974
50963 131
30206 18503
84146 81416
40002 20626
20959 74043
96265 49617
50869 65018
22501 6623
88439 74277
66330 61579
15157 85873
52321 60174
72666 32099
96871 33612
32525 8346
72291 13831
8...

output:

199190 621708
14649 82067 46658 36870 86566 49316 80342 34278 35117 93553 7347 17373 18344 37936 48783 44980 17097 99906 32176 9684 39723 50111 19 11084 25987 16125 40582 95172 15753 3 37135 96871 35771 28834 61348 65527 29047 41513 22 94467 83087 88823 74837 15 75740 33 2973 18611 46374 61579 6623 ...

result:

points 1.0 correct answer = 199190; correct answer = 621708;

Test #74:

score: 50
Accepted
time: 23ms
memory: 12504kb

input:

91413
18433 23117
39518 88780
73634 8375
51086 79039
29685 34503
89810 38630
81368 88746
82927 57444
82104 85400
5906 40542
75577 71148
48623 64005
51512 27586
17173 16511
88746 26255
53758 63629
40899 62791
83800 33391
16089 40303
36362 63446
79889 47281
46465 12939
31493 28594
81159 73849
31493 19...

output:

182222 564658
63174 10705 84934 73257 4 9966 36124 2561 49793 7248 41598 53514 24065 45630 32098 73634 52310 89872 40303 831 49546 28594 38904 14 16511 13 4794 17 26 32880 19409 27 10 48317 62791 8001 91385 23845 6752 28 5933 34624 21497 71337 88150 74072 17315 31 67857 5519 30 15 13613 32 46958 711...

result:

points 1.0 correct answer = 182222; correct answer = 564658;

Test #75:

score: 50
Accepted
time: 28ms
memory: 12396kb

input:

100000
19102 79795
15934 47159
11990 20192
16296 51154
97096 27289
4939 91163
2673 42185
1806 13975
48842 10897
26719 19468
26399 9106
1560 63915
52883 66592
18838 46497
39164 1171
67607 11022
96214 28225
96535 32935
4887 10753
27029 87166
96412 97892
2527 4868
35044 4617
1126 96434
65672 48049
2398...

output:

133328 2875752
2538 51344 86351 80760 59186 8395 95070 84568 31658 82106 72062 23856 15152 24117 39296 44995 37730 74721 85484 23003 98711 75062 30152 77293 64250 71290 55701 30130 21992 20943 86502 70808 52306 34686 5743 58654 38857 9516 64533 6740 78427 3234 19600 89765 55545 56972 3359 2981 21495...

result:

points 1.0 correct answer = 133328; correct answer = 2875752;

Test #76:

score: 50
Accepted
time: 35ms
memory: 12392kb

input:

100000
75186 63877
30682 67959
59008 68830
13637 63860
94404 70388
88997 2416
90186 89995
6381 74173
39644 1479
8990 93543
34924 80311
21555 38157
83335 82822
47379 66027
58545 93415
83098 55197
79276 12395
57124 68551
98957 87628
44742 96005
81802 68017
57385 97315
26358 93734
75229 72243
42347 838...

output:

149996 1934292
51752 83736 41760 94984 9493 44165 27640 55425 63712 53701 76850 13591 55434 98932 99247 85626 79470 24864 28641 13574 35246 50070 52303 1181 89914 58177 72861 27747 80675 68226 31279 15425 43079 37555 55387 89926 48622 77464 56584 99062 89717 422 96713 60753 76138 77871 7493 41896 96...

result:

points 1.0 correct answer = 149996; correct answer = 1934292;

Test #77:

score: 50
Accepted
time: 21ms
memory: 12648kb

input:

93930
41507 82962
74769 3770
72031 54394
13069 62632
45450 83050
13961 63651
15741 74408
23828 24545
49293 25901
74902 68758
34601 8724
91009 12415
25226 79318
21677 57210
35979 45086
14102 12495
72158 47754
51907 35373
90680 67546
53596 88867
42317 11762
9873 67021
866 50185
40981 90832
30093 85377...

output:

169070 977694
36850 29177 38664 89412 50687 86307 54837 63439 90951 68842 83111 29715 36466 46208 90600 93231 68012 25651 48593 91555 8308 86112 1034 92066 84126 40256 17262 48565 93254 85770 4971 22986 53487 60927 90249 91736 28316 62645 64031 23700 81758 78745 34601 64372 83243 3769 21253 38280 56...

result:

points 1.0 correct answer = 169070; correct answer = 977694;

Test #78:

score: 50
Accepted
time: 17ms
memory: 11336kb

input:

66666
2708 28938
18111 55593
46507 60492
28211 60354
62177 42106
32334 46682
54891 60720
12631 32446
33964 14077
33843 53751
10493 48939
48573 15925
47187 42344
42818 14380
28170 62539
63144 21807
46841 4470
27694 45562
3165 43146
3215 65473
7421 63611
32774 63019
61958 43387
40532 31463
21685 53001...

output:

114280 798958
32082 48825 48563 45748 54488 42139 40834 50149 59668 61404 4539 38254 34058 50182 54324 52414 60406 60898 30319 44046 58733 9251 4578 52922 65880 51983 54307 45858 43198 27531 60944 42963 1493 45923 51791 56956 11006 62597 44887 56200 58982 44830 14968 28523 2835 35738 38034 39163 583...

result:

points 1.0 correct answer = 114280; correct answer = 798958;

Test #79:

score: 50
Accepted
time: 22ms
memory: 11540kb

input:

77777
49369 24449
54325 6946
35965 66783
76466 71203
2951 49141
58917 10371
2247 50627
17325 45488
64322 10832
54119 16739
71942 22004
5669 59682
30435 46823
75426 8464
49716 45345
11249 63092
53811 30685
50209 59714
981 22555
24635 3770
12609 18627
59905 51515
5014 30189
54811 7392
69500 39567
6452...

output:

136106 887574
72441 22523 39700 32102 77177 23078 45227 45640 59538 69578 30981 37414 2108 27726 42871 10071 49388 51614 33695 7273 54986 35674 4592 6342 59898 34587 77607 43013 66957 45298 16959 822 33655 33961 70863 58611 63224 56821 42350 20502 13985 18439 76950 56302 7835 68404 25487 15882 32217...

result:

points 1.0 correct answer = 136106; correct answer = 887574;

Test #80:

score: 50
Accepted
time: 37ms
memory: 12328kb

input:

99999
34134 31512
55415 48626
9899 98702
24742 36230
68336 49341
47014 26483
8014 23654
80819 6762
4106 2043
53126 95878
40268 15773
38569 82908
17144 593
61589 33340
21595 14286
2307 46262
13520 33753
97081 21121
64483 80578
37007 75704
27327 32104
79431 38166
75683 39406
13333 86195
52529 60493
45...

output:

133328 2875718
59609 67996 32419 80377 54128 765 6575 83399 99038 40939 88729 78811 90969 85085 21290 74897 7407 90962 83279 80617 35334 47451 13184 53632 21979 42619 20258 14632 75772 6791 59129 70332 99737 87931 11962 83081 72342 98753 87664 60437 70449 76534 11297 10056 73804 57566 86658 26143 34...

result:

points 1.0 correct answer = 133328; correct answer = 2875718;

Test #81:

score: 50
Accepted
time: 31ms
memory: 12752kb

input:

93792
74714 28726
23910 20740
3508 41621
37903 76011
72483 64428
16621 2707
26752 16310
4099 66364
69520 23944
68543 26259
70570 38828
3615 51139
42643 6953
44734 75053
17579 54545
47875 81814
78574 49423
20229 3741
70837 3534
59233 83851
92737 92812
1120 57640
15001 8970
35263 51813
86949 62582
143...

output:

177160 749346
17693 54686 38469 10097 91901 87622 10427 9427 91738 79169 58808 41890 13337 48149 42358 68032 24403 51300 5691 3985 21294 73339 27854 74363 69086 82857 93143 36548 90718 18498 73177 80766 40935 91565 92894 28216 73608 79085 90905 35871 14267 90560 35399 50104 52958 16984 52953 39823 3...

result:

points 1.0 correct answer = 177160; correct answer = 749346;

Test #82:

score: 50
Accepted
time: 26ms
memory: 12792kb

input:

99123
2797 6945
30658 68802
61712 84113
62236 90495
7451 10575
503 52469
18199 28556
34303 50085
3793 18450
79309 37327
76471 2366
60651 15777
86221 75493
93198 91391
76798 43771
12482 60504
31236 53949
87601 70233
287 95910
96819 3931
17535 8267
55279 45400
43114 41790
79370 12949
39345 23475
47591...

output:

196644 563982
93795 32673 36178 58706 54442 13491 34474 80664 85199 68478 97853 73292 46835 81793 1352 28668 61712 6 43190 98881 34674 1772 48824 41396 9710 92549 67778 6182 61462 66691 6748 13438 87567 82406 95178 21374 60651 51855 95262 52469 15964 18367 23593 54698 45691 15839 56983 15722 70527 9...

result:

points 1.0 correct answer = 196644; correct answer = 563982;