QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#287589#5048. All Pair Maximum FlowjeefyAC ✓1263ms95068kbC++142.2kb2023-12-20 19:47:192023-12-20 19:47:19

Judging History

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

  • [2023-12-20 19:47:19]
  • 评测
  • 测评结果:AC
  • 用时:1263ms
  • 内存:95068kb
  • [2023-12-20 19:47:19]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using lint = long long;
const int N = 4e5 + 7, inf = 1e9, mod = 998244353;

struct pli {
	lint first, second;
	bool operator < (const pli &p) const {
		return first != p.first ? first < p.first : second < p.second;
	}
};

int grp[N], siz[N];
int find(int x) {
	return grp[x] == x ? x : grp[x] = find(grp[x]);
}

set<pli> cov, E[N];
int x[N], y[N], rem[N];
lint w[N];

void del(int e) {
	cov.erase({w[e], e});
	E[x[e]].erase({y[e], e});
	E[y[e]].erase({x[e], e});
	// cerr << "Del E " << e << ": " << x[e] << " - " << y[e] << " (" << w[e] << '\n';
}

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int n, m; cin >> n >> m;
	for (int i = 1; i <= m; ++i) {
		cin >> x[i] >> y[i] >> w[i];
		if (x[i] > y[i]) swap(x[i], y[i]);
		if (x[i] + 1 == y[i] || (x[i] == 1 && y[i] == n)) cov.insert({w[i], i});
		if (x[i] == 1 && y[i] == n) swap(x[i], y[i]);
		E[x[i]].insert({y[i], i}), E[y[i]].insert({x[i], i});
		// cerr << "Read " << i << x[i] << y[i] << " done \n";
	}

	int T = m - (n - 1);
	while (T--) {
		int e = cov.begin()->second;
		// cerr << "Pop E " << e << " !\n";
		del(e), rem[e] = 1;
		int cur = x[e], prv = y[e];
		while (cur != y[e]) {
			auto it = E[cur].upper_bound({prv, inf}); // 顺时针遍历
			if (it == E[cur].end()) it = E[cur].begin();
			int i = it->second;
			prv = cur, cur = it->first;
			// cerr << "Nxt E " << i << '\n';
			if (cov.find({w[i], i}) == cov.end()) {
				w[i] += w[e];
				cov.insert({w[i], i});
				if (x[i] != prv) swap(x[i], y[i]); // 修改方向
				// cerr << "Make IN " << i << ": " << x[i] << " - " << y[i] << '\n';
			} else {
				del(i);
				w[i] += w[e];
			}

			// cerr << "Cur to " << cur << " prv " << prv << '\n';
		}
	}

	cov.clear();
	for (int i = 1; i <= m; ++i) {
		if (!rem[i]) cov.insert({-w[i], i});
	}

	for (int i = 1; i <= n; ++i) grp[i] = i, siz[i] = 1;
	int ans = 0;
	for (auto it : cov) {
		int e = it.second;
		// cerr << "Rest e " << e << ": " << x[e] << ", " << e[y] << " (" << w[e] << '\n';
		int u = find(x[e]), v = find(y[e]);
		if (u == v) continue;
		ans = (ans + 1ll * w[e] % mod * siz[u] % mod * siz[v]) % mod;
		grp[u] = v, siz[v] += siz[u];
	} cout << ans << '\n';
}


詳細信息

Test #1:

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

input:

6 8
1 2 1
2 3 10
3 4 100
4 5 1000
5 6 10000
6 1 100000
1 4 1000000
1 5 10000000

output:

12343461

result:

ok 1 number(s): "12343461"

Test #2:

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

input:

20 30
5 7 9066926
13 15 636587393
1 12 234024833
7 11 863853881
7 9 961926707
12 20 525748907
7 10 217196987
15 20 715248370
17 19 577652480
16 19 78750484
1 2 216519168
2 3 26083428
3 4 381598120
4 5 78513523
5 6 106643887
6 7 20069507
7 8 467260856
8 9 383736316
9 10 400897545
10 11 404258163
11 1...

output:

858325335

result:

ok 1 number(s): "858325335"

Test #3:

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

input:

20 26
13 17 325133268
9 18 216183439
2 7 16535651
4 6 390851818
12 17 381307448
9 17 980041383
1 2 141256756
2 3 688869622
3 4 579655258
4 5 570436112
5 6 293656896
6 7 988638554
7 8 887938206
8 9 413776002
9 10 983955283
10 11 198400568
11 12 434019230
12 13 960512608
13 14 942127959
14 15 75671628...

output:

286660015

result:

ok 1 number(s): "286660015"

Test #4:

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

input:

20 30
12 14 28222897
2 4 425326589
8 19 985232890
9 15 330291477
9 11 199514528
7 20 148246184
9 14 771529315
1 7 74025894
1 4 121592328
16 19 533025399
1 2 656923794
2 3 251967493
3 4 905936081
4 5 218526186
5 6 298821633
6 7 141173509
7 8 823436709
8 9 266422723
9 10 570882032
10 11 434809298
11 1...

output:

31481143

result:

ok 1 number(s): "31481143"

Test #5:

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

input:

200 379
184 191 236609500
178 180 710537395
12 34 803762294
164 166 77794954
75 91 229922975
4 199 403835359
98 109 275493753
74 91 8512493
99 105 430613927
42 45 20773932
174 184 872427370
157 160 374930702
130 138 377241825
113 116 813473613
171 173 951985709
76 90 789580090
174 191 588309194
54 5...

output:

920791837

result:

ok 1 number(s): "920791837"

Test #6:

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

input:

200 283
157 159 131187508
2 200 438550272
55 60 202485515
67 69 150037453
50 84 827467740
39 95 364116840
160 162 932977137
38 95 453124199
71 74 496271084
195 197 56912228
134 137 78971838
100 110 303398638
120 195 420738008
163 166 411910898
39 44 53775992
48 50 514255080
10 14 164383285
72 74 839...

output:

173384867

result:

ok 1 number(s): "173384867"

Test #7:

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

input:

200 249
156 162 863757672
18 173 271777360
94 96 395927303
69 75 677606292
137 142 984836887
43 45 378085025
8 16 722096782
187 189 185797793
8 11 12218731
39 46 756790689
70 72 193569894
156 165 238103229
64 134 496971099
89 93 879265558
78 80 905448367
3 192 249346208
21 168 861399459
6 16 4194033...

output:

376271425

result:

ok 1 number(s): "376271425"

Test #8:

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

input:

2000 3521
494 547 856005142
1001 1037 740768848
1049 1051 589773919
1059 1061 876975698
1577 1615 314411513
1512 1553 894110218
5 340 716008124
694 699 669738672
1952 1959 863131296
741 746 694903762
1092 1284 266368794
49 328 829308568
810 816 791951151
427 461 855694472
148 159 68731874
1620 1665 ...

output:

443249627

result:

ok 1 number(s): "443249627"

Test #9:

score: 0
Accepted
time: 4ms
memory: 24456kb

input:

2000 3353
1145 1153 12605202
186 188 953755004
1022 1026 505955905
1693 1702 62140204
1703 1726 364351896
1586 1596 132590766
1127 1134 360840007
542 580 962305152
1805 1811 665632670
1995 1997 189177343
1306 1503 44892081
1047 1506 220639710
1881 1889 13475416
1198 1246 970979539
1208 1210 55816328...

output:

801970247

result:

ok 1 number(s): "801970247"

Test #10:

score: 0
Accepted
time: 4ms
memory: 24640kb

input:

2000 3898
1431 1433 809972284
73 111 664058149
1005 1013 568858748
75 109 133078102
1723 1728 191019995
972 1086 362400554
1694 1696 248762361
485 602 377854845
1149 1885 303113860
368 371 982093698
950 952 158604431
220 222 49506934
309 311 789353594
614 616 265388202
336 343 774520388
1633 1635 88...

output:

787855536

result:

ok 1 number(s): "787855536"

Test #11:

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

input:

20000 30032
657 665 160835941
13956 13965 741584028
10945 11012 130422619
17647 17660 223266914
7347 7353 333531191
3136 3139 158362313
9162 9510 91853589
8714 8731 988697119
10271 10283 33241684
4431 4435 768775121
5375 5381 898321771
5453 5455 177333856
6886 6936 722860393
6737 6739 591891329
7516...

output:

216708401

result:

ok 1 number(s): "216708401"

Test #12:

score: 0
Accepted
time: 25ms
memory: 29032kb

input:

20000 25152
5961 5964 192559952
14521 14523 521181460
15561 15563 96908593
1550 1552 772130292
10326 10329 712025211
18026 18233 311253508
4374 4376 33835288
2675 2677 328357615
17030 17138 717298610
2545 2547 168523698
4379 4401 111054858
4057 4060 9358517
17325 17359 377680441
1235 1285 213375517
...

output:

905981499

result:

ok 1 number(s): "905981499"

Test #13:

score: 0
Accepted
time: 35ms
memory: 30732kb

input:

20000 37665
7930 7935 818024195
8578 8582 507720548
15742 15764 109932710
15943 15952 628715347
793 796 790044979
7481 7512 426103744
12365 12402 177567670
17413 17416 445483457
460 471 39260725
7581 7750 419714966
4065 4067 383372426
5497 5514 928871784
829 832 36356290
8658 8660 333192336
7542 754...

output:

680443981

result:

ok 1 number(s): "680443981"

Test #14:

score: 0
Accepted
time: 608ms
memory: 76928kb

input:

200000 278635
140659 140662 991635161
117272 117985 416639118
15602 15611 718344748
74295 74298 478875476
45897 45907 386322111
113312 113314 846248116
105551 105554 539173002
127899 128131 307408584
72496 72514 77941579
173338 173363 660161854
95305 95336 935414201
90162 90164 580655428
166887 1669...

output:

455085182

result:

ok 1 number(s): "455085182"

Test #15:

score: 0
Accepted
time: 812ms
memory: 87984kb

input:

200000 350495
838 891 850926412
61000 61002 264165952
3852 3882 73181112
114357 114369 405937062
148267 148276 714114577
60525 60597 945416829
178514 178516 134279238
89485 89487 772975453
155644 155649 480556407
191728 191757 248039147
117423 117425 754473043
84203 84207 380989152
170625 170630 246...

output:

190390450

result:

ok 1 number(s): "190390450"

Test #16:

score: 0
Accepted
time: 592ms
memory: 76940kb

input:

200000 277960
6214 6216 63799300
4009 4013 265084401
180392 180394 73446384
181354 181710 958964142
96238 96241 88262764
101861 101969 318597463
63256 63269 113658398
102008 102071 691063763
76930 76967 477472778
182376 182382 85617547
59461 59463 871375571
45199 45201 846878360
106630 106843 995057...

output:

427569826

result:

ok 1 number(s): "427569826"

Test #17:

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

input:

10 15
6 7 614139616
7 8 377028609
6 10 646556714
5 6 320955180
8 9 102078631
9 10 842683426
3 4 80243544
6 9 709919715
1 2 454268851
2 3 107537912
1 5 558872671
1 6 651190999
2 5 913107003
10 1 119035019
4 5 858376612

output:

927730588

result:

ok 1 number(s): "927730588"

Test #18:

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

input:

8 10
6 7 18
5 6 72
7 8 99
4 5 28
2 3 96
1 2 66
3 4 40
8 1 8
6 8 78
2 6 16

output:

1905

result:

ok 1 number(s): "1905"

Test #19:

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

input:

6 9
1 4 16
4 6 30
2 3 5
1 2 74
4 5 91
3 4 70
6 1 33
1 3 26
5 6 94

output:

1483

result:

ok 1 number(s): "1483"

Test #20:

score: 0
Accepted
time: 845ms
memory: 89108kb

input:

200000 364299
101280 101286 446343809
153176 153180 642651638
37502 37515 970967639
141177 141187 891535214
57978 57981 718810055
58522 58598 756618771
159091 159096 8261282
2367 2369 568077237
135894 135935 329775054
148415 148419 296053764
23970 23972 186986576
191075 191078 94114604
89247 89259 6...

output:

586641757

result:

ok 1 number(s): "586641757"

Test #21:

score: 0
Accepted
time: 532ms
memory: 74388kb

input:

200000 259932
73341 73410 921298358
179331 179519 638523012
179736 179739 538674263
76687 107466 337995474
8878 8887 104537482
141412 141439 282995902
176835 176837 578439333
156653 156660 87995397
76623 76628 39126531
4192 4196 831812798
157078 157112 54454086
196881 196883 389545386
137345 137349 ...

output:

366700096

result:

ok 1 number(s): "366700096"

Test #22:

score: 0
Accepted
time: 797ms
memory: 87044kb

input:

200000 349903
25936 25942 540471023
82660 82663 147650806
140730 140733 895966634
178860 178892 432276146
56994 56996 539391705
162418 162430 155083747
68846 68850 376923019
129896 129903 917719395
12668 12670 819857733
42805 42807 39867670
92161 92163 886648939
23714 23716 844474835
39535 39537 639...

output:

345055108

result:

ok 1 number(s): "345055108"

Test #23:

score: 0
Accepted
time: 348ms
memory: 65340kb

input:

200000 200000
1 2 297000612
2 3 426000134
3 4 317438185
4 5 865641347
5 6 837674560
6 7 622032764
7 8 21212528
8 9 663607610
9 10 187847385
10 11 937405853
11 12 582953680
12 13 278175054
13 14 62160466
14 15 864960498
15 16 728100365
16 17 685277013
17 18 319263096
18 19 760905566
19 20 378805904
2...

output:

420086555

result:

ok 1 number(s): "420086555"

Test #24:

score: 0
Accepted
time: 339ms
memory: 66372kb

input:

200000 200000
1 2 234824570
2 3 572016738
3 4 798119374
4 5 250830166
5 6 926127942
6 7 731357492
7 8 344390731
8 9 586922470
9 10 265130667
10 11 493420162
11 12 291312575
12 13 634005283
13 14 120377074
14 15 857308519
15 16 763565054
16 17 764428935
17 18 361419715
18 19 959816527
19 20 432137137...

output:

696432160

result:

ok 1 number(s): "696432160"

Test #25:

score: 0
Accepted
time: 298ms
memory: 65332kb

input:

200000 200001
198834 199341 28865320
1 2 348689133
2 3 739887491
3 4 757316328
4 5 356832613
5 6 547439753
6 7 600477436
7 8 423505818
8 9 861286758
9 10 301444417
10 11 824402058
11 12 744643988
12 13 558650833
13 14 849554118
14 15 528546818
15 16 725799024
16 17 206723687
17 18 129889175
18 19 96...

output:

453315

result:

ok 1 number(s): "453315"

Test #26:

score: 0
Accepted
time: 354ms
memory: 65360kb

input:

200000 200001
131016 131018 242105111
1 2 408623851
2 3 703095410
3 4 569975652
4 5 670792054
5 6 967073300
6 7 73300962
7 8 187195646
8 9 982488362
9 10 802900262
10 11 962781761
11 12 252212490
12 13 118528605
13 14 352859193
14 15 150970217
15 16 651467103
16 17 261544654
17 18 186575672
18 19 55...

output:

952818448

result:

ok 1 number(s): "952818448"

Test #27:

score: 0
Accepted
time: 349ms
memory: 65224kb

input:

200000 200010
164644 164646 665102443
177394 177413 491534720
133321 133323 103301252
141395 141398 339734219
31425 31427 891626817
18895 18899 519904429
121615 121764 330779934
122275 122283 979088252
92856 92860 237523469
166650 166674 929590703
1 2 586358294
2 3 487486612
3 4 363410799
4 5 536168...

output:

274367922

result:

ok 1 number(s): "274367922"

Test #28:

score: 0
Accepted
time: 331ms
memory: 65364kb

input:

200000 200010
174471 174477 561036888
137822 137825 980930846
146444 146454 465463273
132854 133495 600159147
181184 181193 483190709
149775 149825 914792479
65356 65358 79835500
22134 22164 341936437
178859 178861 826374228
111001 111004 482856545
1 2 576933531
2 3 888993054
3 4 407710470
4 5 70051...

output:

126398101

result:

ok 1 number(s): "126398101"

Test #29:

score: 0
Accepted
time: 334ms
memory: 66556kb

input:

200000 200100
102995 103003 25036931
49729 49742 31616319
41125 41211 378650777
154167 158145 122637918
92780 92782 780116260
64355 64357 840634606
37155 37170 59368993
154037 158202 447769508
98740 98746 320234904
24425 24430 199587547
49671 49683 611491284
3642 3644 79207102
54300 54303 3895058
19...

output:

46801133

result:

ok 1 number(s): "46801133"

Test #30:

score: 0
Accepted
time: 363ms
memory: 65492kb

input:

200000 200100
148736 150403 674340470
188360 188372 844692461
144938 144940 554605245
143101 143570 928072823
44530 44564 504373971
155998 156002 379235233
99052 99054 822021725
143214 143216 595624915
92388 92392 277481265
19470 19472 333457201
49034 49063 810724149
187315 187324 19539537
184490 18...

output:

211815255

result:

ok 1 number(s): "211815255"

Test #31:

score: 0
Accepted
time: 360ms
memory: 67252kb

input:

200000 201000
193445 193449 790532300
75632 75644 41191161
117676 117678 525403074
69924 69929 261357043
50340 61820 840004092
144893 144913 363789583
198759 198761 512296129
177838 177846 356681386
159323 159325 793617844
149988 150029 795454621
112050 112245 450098174
195359 195374 547275244
78898...

output:

693653792

result:

ok 1 number(s): "693653792"

Test #32:

score: 0
Accepted
time: 346ms
memory: 66280kb

input:

200000 201000
164236 164241 792134191
30119 30121 559640891
94004 94007 191306207
147437 147472 56510942
131828 131841 312736403
6864 6882 583251834
168471 168474 573835683
122597 122604 135810213
26597 26608 112419126
7120 7817 913298038
6737 6740 683999008
194445 194450 345970797
100735 103992 858...

output:

379648868

result:

ok 1 number(s): "379648868"

Test #33:

score: 0
Accepted
time: 417ms
memory: 67608kb

input:

200000 210000
41006 41010 655622988
98619 98642 161032556
13606 13613 935914222
46562 46564 301105406
115752 115762 416713200
102056 102060 155337259
180168 180520 582144438
102725 102728 682640105
195687 195698 166827082
120797 120992 740366417
166117 166387 2684331
149830 149833 308237924
162251 1...

output:

678067655

result:

ok 1 number(s): "678067655"

Test #34:

score: 0
Accepted
time: 370ms
memory: 67384kb

input:

200000 210000
29330 29332 856295587
163666 163672 864100229
46033 46037 258077873
101966 101968 849316156
107736 107740 803209485
156469 157354 433442026
9270 9324 389020685
120681 120765 146864365
20617 20658 133574404
61024 61030 290363087
39801 39810 898626706
65065 65112 503352422
30836 30852 85...

output:

249579059

result:

ok 1 number(s): "249579059"

Test #35:

score: 0
Accepted
time: 620ms
memory: 80584kb

input:

200000 300000
184665 184674 817610626
12237 12446 894111269
193018 193051 200646802
196019 196021 337264506
9669 9689 847116351
53886 53888 543949703
82363 82372 326450975
5010 5017 271193479
54218 54223 523716928
54366 54397 946573161
102590 126850 298341154
160041 160046 78206436
194155 194232 306...

output:

727422098

result:

ok 1 number(s): "727422098"

Test #36:

score: 0
Accepted
time: 636ms
memory: 80204kb

input:

200000 300000
151931 151937 490626332
41979 41981 508008703
159315 159319 917514154
77047 77049 235035097
10381 10383 424485929
83137 83549 350982188
61015 61018 75947280
37484 40215 875762034
5874 5878 151426069
134833 134860 274799293
107608 107881 244403604
151931 151935 348394345
110001 110004 7...

output:

235934634

result:

ok 1 number(s): "235934634"

Test #37:

score: 0
Accepted
time: 910ms
memory: 94184kb

input:

200000 399995
105352 105425 390423814
35532 35535 187018930
19548 19552 141038511
94890 94892 120980235
77781 77783 942168066
78246 78295 745411984
194591 194639 994898795
155182 155184 811111542
117046 117048 347634469
143734 143736 532193961
172218 172225 225533460
2139 2143 435373116
178672 17867...

output:

428301849

result:

ok 1 number(s): "428301849"

Test #38:

score: 0
Accepted
time: 965ms
memory: 94864kb

input:

200000 399995
1637 131792 584895393
63342 63344 682681853
60082 60084 719595720
176121 176142 274966072
19923 19940 437361618
120518 121547 899166786
57714 57716 578123797
180303 183127 286511750
60514 63834 848835981
84177 84181 249724085
52314 52322 646305768
64665 64721 553906798
68716 68719 5078...

output:

644350423

result:

ok 1 number(s): "644350423"

Test #39:

score: 0
Accepted
time: 1044ms
memory: 94696kb

input:

200000 399997
66913 66916 938514116
52156 52184 326467963
123221 123234 713718213
170548 170550 583252325
76815 76817 446051090
33554 33555 811353350
19129 19130 295765328
164461 164462 622532624
85369 85370 853816193
99556 99557 838431712
22860 22861 279762893
99437 99438 754341009
192123 192124 99...

output:

149416843

result:

ok 1 number(s): "149416843"

Test #40:

score: 0
Accepted
time: 1100ms
memory: 94800kb

input:

200000 399997
165950 165951 548708406
156210 156241 331503139
109618 109874 566981953
164499 164999 848018644
16296 16297 791728548
169651 169652 587807421
28166 28167 367818124
46880 46884 132462920
112259 112260 999567283
69163 69219 32612038
126323 126324 154486714
82360 82361 793703198
109226 10...

output:

771064900

result:

ok 1 number(s): "771064900"

Test #41:

score: 0
Accepted
time: 1057ms
memory: 94796kb

input:

200000 399997
107701 107702 309877534
107634 107638 896837340
185275 185284 218944934
196753 196754 380240155
51792 51793 893571082
87471 87492 733882996
29732 29733 129199251
197938 197939 740390109
45842 45844 796060638
16941 16942 423940882
146547 146548 92692578
37875 37876 662043394
84649 84650...

output:

225412999

result:

ok 1 number(s): "225412999"

Test #42:

score: 0
Accepted
time: 1062ms
memory: 94132kb

input:

200000 399997
192363 192372 982964334
176787 176790 69654696
15737 15739 202362793
122902 122907 368153990
32867 32880 882481317
36154 36155 908949450
101540 101542 624902339
57559 57642 314020734
78957 78960 741613194
165488 165585 85763663
190555 190558 895223234
157968 157970 621985067
5367 5369 ...

output:

882808465

result:

ok 1 number(s): "882808465"

Test #43:

score: 0
Accepted
time: 1035ms
memory: 94212kb

input:

200000 399997
142109 142110 640566351
135409 135410 595247842
60592 60595 39681148
87441 87562 980235544
125386 125387 496174852
41209 41210 818820666
112217 112218 592988334
46521 46529 637212251
180209 180210 571802163
187954 188000 690528116
25329 25330 199807519
94038 94039 433524610
2536 2541 2...

output:

678399451

result:

ok 1 number(s): "678399451"

Test #44:

score: 0
Accepted
time: 1017ms
memory: 94080kb

input:

200000 399997
4231 4232 899270448
6993 6994 637636245
195628 195636 345855346
197503 197505 654760009
130768 130769 442746238
60550 60557 873652502
29336 29348 422975612
62869 62872 615278290
67686 67687 270283676
127209 127210 162631460
136546 136547 792520900
144251 144252 322308823
128506 128509 ...

output:

21468226

result:

ok 1 number(s): "21468226"

Test #45:

score: 0
Accepted
time: 1038ms
memory: 94868kb

input:

200000 399997
139870 139872 198997800
163343 163357 488558245
191481 191486 852185313
69145 69147 347772691
154727 154745 320175451
148179 148180 117724201
21570 23041 439138532
96577 96578 219156343
177821 177822 48085460
62860 62861 887581380
97908 97913 644045026
186515 186516 731190265
156011 15...

output:

621489904

result:

ok 1 number(s): "621489904"

Test #46:

score: 0
Accepted
time: 1052ms
memory: 94804kb

input:

200000 399997
93518 93519 872986352
64133 64134 721345080
122844 122845 940403419
43988 43993 855331957
32666 32667 767570091
24776 24789 18934443
91063 91064 547335726
90414 90428 527171242
58166 58167 265058425
11896 11897 425130628
5458 5459 549055755
115647 115648 292689007
174156 174255 2874581...

output:

930325572

result:

ok 1 number(s): "930325572"

Test #47:

score: 0
Accepted
time: 1088ms
memory: 94084kb

input:

200000 399997
197247 197250 168008171
178141 178143 508290392
81870 81871 391390794
183470 183476 362536420
22269 22270 437645694
169874 169875 325073450
177158 177159 561397440
158430 158431 388992570
145414 145492 771215804
161424 161425 692621325
125782 125784 631211434
158293 158294 362039010
15...

output:

935966369

result:

ok 1 number(s): "935966369"

Test #48:

score: 0
Accepted
time: 1062ms
memory: 94024kb

input:

200000 399997
77356 77357 693751911
65027 65028 995719291
95542 95543 962055000
126546 126547 878735332
183475 183476 661513628
41677 41679 67745774
25246 25247 135914930
114752 114754 360542963
199329 199359 405003414
183258 183259 44828335
57382 57623 31782946
180152 180153 376758878
106563 106564...

output:

30572582

result:

ok 1 number(s): "30572582"

Test #49:

score: 0
Accepted
time: 1112ms
memory: 94840kb

input:

200000 399997
147029 147032 963130356
59362 59363 165389376
147158 147167 612263883
16283 16286 775700654
28980 28981 168325510
58532 58534 869968879
96231 96232 73069329
126964 126965 797295289
53480 53481 650467289
142754 142755 173560405
34693 34694 308775500
187610 187934 986883947
40683 40721 1...

output:

244130290

result:

ok 1 number(s): "244130290"

Test #50:

score: 0
Accepted
time: 1087ms
memory: 94092kb

input:

200000 399997
13017 13247 907667409
128475 128482 834531035
195031 195032 94823042
157066 157069 21993738
116398 116400 976044023
54390 54394 236113534
44231 44233 7912429
132055 132056 370470
63676 63677 354209684
83523 83613 682020611
77540 77541 386722892
183056 183057 436515740
28338 28340 54174...

output:

233019882

result:

ok 1 number(s): "233019882"

Test #51:

score: 0
Accepted
time: 1042ms
memory: 94084kb

input:

200000 399997
190211 190212 472590112
100559 100560 704875838
142843 142844 77904313
77098 77099 315919899
187131 187193 679633387
141480 141481 282699983
135453 135454 214069252
24724 24725 645580791
124363 124366 876858759
137410 137411 325272688
81425 81426 239590616
80890 80891 224532297
110289 ...

output:

148797692

result:

ok 1 number(s): "148797692"

Test #52:

score: 0
Accepted
time: 469ms
memory: 66964kb

input:

200000 200000
65088 65089 8657714
28553 28554 196163048
106369 106370 680190771
154137 154138 432563652
166510 166511 130566088
136321 136322 149305437
176403 176404 107377415
60288 60289 291235303
41015 41016 496976261
170058 170059 832681975
129532 129533 418591296
20933 20934 541632217
85053 8505...

output:

238592585

result:

ok 1 number(s): "238592585"

Test #53:

score: 0
Accepted
time: 575ms
memory: 74152kb

input:

200000 250000
95954 95955 59057013
20542 20544 146706995
54978 54980 729575694
8534 8536 68976793
88727 88728 400186711
106728 106729 644283864
56111 56112 665964779
83852 83853 764514638
35982 35983 900969465
13254 13255 428044641
39150 39152 137341637
71347 71348 726763256
58390 58392 296456691
17...

output:

247114065

result:

ok 1 number(s): "247114065"

Test #54:

score: 0
Accepted
time: 754ms
memory: 87032kb

input:

200000 300000
89076 89078 562198734
70183 70184 830267946
59102 59103 803239369
130713 130714 466357724
120416 120417 278417316
19666 19667 198172094
106450 106451 475881854
132470 132472 623793158
5645 5646 52824987
116948 116950 474399960
12712 12713 279478521
77880 77882 247038718
41122 41124 491...

output:

622949575

result:

ok 1 number(s): "622949575"

Test #55:

score: 0
Accepted
time: 883ms
memory: 89104kb

input:

200000 350000
14370 14372 406138272
165603 165604 598378690
118126 118127 813215385
28698 28699 730055
114128 114132 330681852
108710 108711 795321730
185686 185687 456492129
116986 116987 472267163
104154 104156 197690260
11188 11190 960640979
89743 89744 321963090
5612 5613 235170847
101362 101364...

output:

922097383

result:

ok 1 number(s): "922097383"

Test #56:

score: 0
Accepted
time: 956ms
memory: 91044kb

input:

200000 375000
140048 140056 906376616
56785 56786 983502006
121222 121223 492897282
36645 36646 62089619
190834 190836 432570265
123170 123171 894986069
75348 75349 106620462
192514 192515 836818966
54694 54695 503300386
2688 2696 810825807
138987 138988 162682059
58228 58229 206517356
130349 130350...

output:

254671804

result:

ok 1 number(s): "254671804"

Test #57:

score: 0
Accepted
time: 1029ms
memory: 92376kb

input:

200000 387500
1167 1168 187547640
155252 155256 17791401
120040 120048 453632731
185530 185531 544273427
150976 150984 511980502
36682 36684 517748098
94500 94502 772369137
90138 90140 651602423
176 177 443999453
73362 73364 152600996
162682 162683 981967546
86942 86944 340119723
43435 43436 1502352...

output:

697560828

result:

ok 1 number(s): "697560828"

Test #58:

score: 0
Accepted
time: 1053ms
memory: 93908kb

input:

200000 393000
135378 135379 442693311
6428 6430 495064723
29788 29790 703630190
178830 178832 837897340
14120 14128 859298831
37344 37352 753790520
18653 18654 687958791
55438 55439 235983580
192484 192485 844421351
82674 82676 872917828
197629 197630 379418831
24656 24658 60608303
30976 30977 52585...

output:

696153473

result:

ok 1 number(s): "696153473"

Test #59:

score: 0
Accepted
time: 994ms
memory: 93820kb

input:

200000 397000
109012 109016 803595503
121850 121852 625587974
122293 122294 17387927
128232 128240 613733549
138091 138092 687146742
134396 134400 165000141
119171 119172 259059656
173057 173058 524300277
77630 77632 19186177
54124 54128 164241272
139852 139856 65286575
2865 2866 885599390
3220 3221...

output:

607972865

result:

ok 1 number(s): "607972865"

Test #60:

score: 0
Accepted
time: 1032ms
memory: 94080kb

input:

200000 399900
135325 135326 733318722
100693 100694 360656237
95689 95690 142636193
38285 38286 436507338
185403 185404 855858271
132809 132810 472957059
115512 115520 269496538
103778 103779 819108512
43644 43645 5729059
108728 108736 630302949
132020 132021 978548187
3185 3186 954342997
184342 184...

output:

21936884

result:

ok 1 number(s): "21936884"

Test #61:

score: 0
Accepted
time: 1062ms
memory: 94452kb

input:

200000 399977
95059 95060 102358373
131323 131324 587549273
102581 102582 399064423
88404 88406 557700846
121758 121760 391484405
6120 6124 43878698
192056 192058 710933987
128605 128606 27893881
93368 93370 14014215
22306 22307 104656577
163052 163056 791544629
142344 142352 259472317
28589 28590 2...

output:

511010717

result:

ok 1 number(s): "511010717"

Test #62:

score: 0
Accepted
time: 1080ms
memory: 94852kb

input:

200000 399997
148220 148221 44435465
36419 36420 508273335
150822 151119 849150221
89004 89010 806235335
103922 103924 148187057
179601 179623 591442194
63906 63908 142514189
56144 56209 275497902
50090 50091 68213425
55523 55524 947087528
176102 176103 862083837
189328 190233 291049581
39967 39981 ...

output:

361824348

result:

ok 1 number(s): "361824348"

Test #63:

score: 0
Accepted
time: 1092ms
memory: 94536kb

input:

200000 399997
166031 166070 643418101
179422 179435 413946868
100683 100686 274025790
115203 115204 363066737
31245 31265 38807130
143902 143911 329743765
109745 109746 515532861
60578 60579 957973705
9171 9173 807651306
30824 30825 85331916
143321 143500 239544270
191816 191818 797291119
160221 160...

output:

430046876

result:

ok 1 number(s): "430046876"

Test #64:

score: 0
Accepted
time: 1047ms
memory: 94756kb

input:

200000 399997
107674 107686 911640181
167133 167135 169854526
194024 194025 436266749
7051 7056 782957749
127903 128107 181299661
135022 135023 908682486
87155 87156 56740996
192704 192705 636399223
151892 151898 25461880
2771 2842 115946132
10153 10157 722067704
81409 81416 216617745
16895 16898 84...

output:

747900181

result:

ok 1 number(s): "747900181"

Test #65:

score: 0
Accepted
time: 1087ms
memory: 94024kb

input:

200000 399997
98059 98063 722878401
45492 45493 815119482
102798 102799 50257324
129065 129071 675161901
157960 157961 104318736
72891 72922 929783451
113359 113360 302318956
17814 17817 379241512
70933 70934 135122856
81836 81860 123988390
112675 112676 356718377
124184 124188 892138446
175338 1753...

output:

330260128

result:

ok 1 number(s): "330260128"

Test #66:

score: 0
Accepted
time: 1053ms
memory: 94248kb

input:

200000 399997
186908 186942 376504651
162294 162297 127847889
137214 137216 628275401
121605 121612 603199454
31006 31010 499669961
178173 178174 861234197
191410 191424 11201500
119852 119855 376403079
183747 183748 440921711
24345 24346 90487352
57244 57247 520499499
28467 28468 600037182
160993 1...

output:

614120874

result:

ok 1 number(s): "614120874"

Test #67:

score: 0
Accepted
time: 1055ms
memory: 94676kb

input:

200000 399997
101161 101162 536554386
101175 101179 165097585
58676 58679 118974030
73635 73638 589745928
61520 61521 295022905
31789 31791 706929999
12542 12548 512619095
67474 67475 673784681
125917 125918 14436645
117117 117119 645648011
139724 139725 420458450
79257 79258 832804117
183524 183527...

output:

250055241

result:

ok 1 number(s): "250055241"

Test #68:

score: 0
Accepted
time: 1055ms
memory: 94080kb

input:

200000 399997
37995 38017 836196463
20849 20859 709407588
27507 27509 266534401
180190 180204 265809782
72751 72783 329087776
183521 183522 464345721
120410 120411 566145649
11871 11872 683722348
116518 116519 916217197
17977 17978 984106962
159153 159154 596238462
93626 93629 316561823
198570 19857...

output:

580312779

result:

ok 1 number(s): "580312779"

Test #69:

score: 0
Accepted
time: 1021ms
memory: 94564kb

input:

200000 399997
133031 133040 508663650
14731 14749 525723971
197319 197321 931039074
27611 27612 810475437
97316 97317 131306580
48618 48619 652320668
193964 193971 751029192
84874 84876 42787267
62598 62599 333608177
171714 171715 944513886
72961 72962 912924309
75661 75696 128606965
120697 120698 7...

output:

211378866

result:

ok 1 number(s): "211378866"

Test #70:

score: 0
Accepted
time: 1084ms
memory: 94200kb

input:

200000 399997
43532 43533 309075042
172129 172130 196188025
133550 133551 889420892
66773 66774 945701791
51217 51221 499887992
132260 132263 981098359
177139 177142 772044504
134206 134207 284091248
147451 147452 944114607
140421 140436 210717560
46307 46308 772135793
149549 149550 633679776
79266 ...

output:

737925782

result:

ok 1 number(s): "737925782"

Test #71:

score: 0
Accepted
time: 1052ms
memory: 94212kb

input:

200000 399997
69228 69253 181822365
112417 112418 70414181
56380 56381 492600618
45668 45669 517005557
91403 91404 511222728
69250 69252 452283057
101856 101857 52457649
129824 129831 616548676
60538 60539 394338670
120152 120154 769729200
90725 91180 640641949
148642 148653 531728987
152490 152495 ...

output:

290876398

result:

ok 1 number(s): "290876398"

Test #72:

score: 0
Accepted
time: 1169ms
memory: 94252kb

input:

200000 399997
2 37765 811491082
21215 21216 797080555
2 53757 166423845
88135 88136 234559375
1 192526 214041893
104727 104728 697064273
2 45856 214360621
53977 53978 532572882
61498 61499 559898648
121296 121297 269985910
198883 198884 906558543
2 180443 328446868
2 121555 392682782
65771 65772 698...

output:

81863731

result:

ok 1 number(s): "81863731"

Test #73:

score: 0
Accepted
time: 1164ms
memory: 95068kb

input:

200000 399997
41226 41227 67289509
2 78262 717764100
1 181377 802321119
84452 84453 317776316
2 24117 75676759
2 110448 760233164
2 60121 226066933
150322 150323 905689516
144539 144540 207460416
2 21319 805613726
151239 151240 244179323
100600 100601 467576496
2 55996 627396906
2 71335 84870203
1 1...

output:

293886091

result:

ok 1 number(s): "293886091"

Test #74:

score: 0
Accepted
time: 1199ms
memory: 94196kb

input:

200000 399997
89530 89531 183539036
25053 25054 653068185
2 116371 294004659
2 96970 646689109
2 106698 297003005
2 165084 880822490
2 90058 177957855
166528 166529 195248858
2 20196 84174346
2 70609 706321240
145645 145646 271643513
2 164891 303465064
32021 32022 540863429
196413 196414 842485324
1...

output:

734230858

result:

ok 1 number(s): "734230858"

Test #75:

score: 0
Accepted
time: 1263ms
memory: 94152kb

input:

200000 399997
82645 82646 506677646
1 186381 582523350
117894 117895 29195294
3 16712 76413160
1 62073 767229878
33826 33827 955555578
125596 125597 643499246
3 21861 239815632
189662 189663 878973628
178836 178837 897292013
85219 85220 354438630
49872 49873 664529783
3 38268 125314849
1 114105 8098...

output:

198142498

result:

ok 1 number(s): "198142498"

Test #76:

score: 0
Accepted
time: 1198ms
memory: 94696kb

input:

200000 399997
4 36484 841354461
4 10362 380506460
4 9278 500485985
4351 4352 487077537
74809 74810 887467370
4 34798 976709260
96316 96317 865070351
4 27721 220392858
164663 164664 513218937
4 118786 200099173
1 167594 395406761
4 79214 154860129
4 86944 716270919
4 94343 892742177
176835 176836 762...

output:

313131486

result:

ok 1 number(s): "313131486"

Test #77:

score: 0
Accepted
time: 1149ms
memory: 94140kb

input:

200000 399997
26477 26478 155000419
1 153865 226788626
1 128666 436624909
22313 22314 519668424
696 697 388904768
4 83429 356773401
1 160840 605191141
26825 26826 894307702
4 53883 836083922
1 182311 882751175
135744 135745 583562676
124805 124806 533963656
4 65118 915354799
1 126513 178269408
4 445...

output:

662256656

result:

ok 1 number(s): "662256656"

Test #78:

score: 0
Accepted
time: 1205ms
memory: 94004kb

input:

200000 399997
5 118 626791768
5 11155 419875242
1 168138 227438074
5 46499 544218076
150715 150716 991868800
91196 91197 922672449
5 13202 466366733
4 52195 915577259
3 83525 14995210
15778 15779 148439381
3 73496 520857044
1 171774 900712592
3 79358 12640683
91172 91173 35226554
5 33543 910070685
3...

output:

65024738

result:

ok 1 number(s): "65024738"

Test #79:

score: 0
Accepted
time: 1227ms
memory: 94120kb

input:

200000 399997
8431 8432 749079730
1 150059 687775495
80896 80897 358771329
5 72122 236943357
5 645 237066368
5 1438 269119567
18979 18980 415841539
4 80499 711393177
144285 144286 517366910
55969 55970 124553260
5 61894 980366521
34051 34052 30813898
188798 188799 132396044
1 100882 208374768
77781 ...

output:

831424463

result:

ok 1 number(s): "831424463"

Test #80:

score: 0
Accepted
time: 1260ms
memory: 94916kb

input:

200000 399997
3 21274 293067049
41524 41525 356849201
1 124459 162737255
142292 142293 390269358
48685 48686 250034180
2 63961 844686581
3 28133 384268726
1 198320 219036394
170593 170594 419988812
86112 86113 624995334
106682 106683 49661085
3 21028 894675023
154442 154443 790065796
39927 39928 167...

output:

618012230

result:

ok 1 number(s): "618012230"

Test #81:

score: 0
Accepted
time: 1233ms
memory: 94244kb

input:

200000 399997
45451 45452 68098897
54860 54861 988159419
9 107044 563659063
9 84673 410397428
9 49669 274179394
61679 61680 348730991
119540 119541 480337577
10 37381 386736596
10 32872 858568119
7 129745 176633034
9 47472 305972707
118195 118196 173548674
193952 193953 800636550
10 34138 817323195
...

output:

287160290

result:

ok 1 number(s): "287160290"

Test #82:

score: 0
Accepted
time: 1194ms
memory: 94108kb

input:

200000 399997
7 84562 628904662
90844 90845 62480190
7 74565 914817914
48511 48512 383196455
1 199475 133303372
5 174470 174680275
5 139437 693961959
104422 104423 805460304
7 83874 456930280
10 57427 35350538
22526 22527 140411671
10 26049 168680825
5 165693 686840104
10 15482 63752174
7 71682 9390...

output:

527293058

result:

ok 1 number(s): "527293058"

Test #83:

score: 0
Accepted
time: 1208ms
memory: 94760kb

input:

200000 399997
147043 147044 57922771
168551 168552 644979625
4 140678 949173018
1 180727 174005256
1 181360 735504595
39404 39405 890712075
2 161294 327583518
197187 197188 129785988
8222 8223 905980064
128692 128693 398061275
7 122355 208331219
189915 189916 611623150
13 93080 114621643
7 129395 39...

output:

866443152

result:

ok 1 number(s): "866443152"

Test #84:

score: 0
Accepted
time: 1214ms
memory: 94172kb

input:

200000 399997
2 106369 648831673
2 118723 486863604
34586 34587 544538040
169127 169128 142766129
2 145925 746868512
162179 162180 173250425
2 62393 630297303
2 134278 549786221
2 171395 60493289
3057 3058 610881404
94019 94020 601677440
2 139767 582554987
119482 119483 706357311
2 89101 217817040
1...

output:

789124734

result:

ok 1 number(s): "789124734"

Test #85:

score: 0
Accepted
time: 1219ms
memory: 94420kb

input:

200000 399997
110766 110767 487063375
1431 1432 168668201
99 4829 367551161
57412 57413 787546527
99259 99260 818256615
26 165014 67026448
85 56758 884798432
28 126962 952442601
19509 19510 764444866
91 41519 46064536
26 164743 652064265
117251 117252 425452899
135999 136000 172486047
96 38338 62786...

output:

162485263

result:

ok 1 number(s): "162485263"

Test #86:

score: 0
Accepted
time: 1225ms
memory: 94892kb

input:

200000 399997
162363 162364 905729972
963 148915 139071536
973 13534 626436068
969 70729 65421793
66 181742 758576105
124726 124727 133287408
970 41779 810230363
76403 76404 347723970
969 104315 454414353
969 116298 755021655
970 39940 966559919
969 118613 331207319
53731 53732 618884382
80338 80339...

output:

737422584

result:

ok 1 number(s): "737422584"

Test #87:

score: 0
Accepted
time: 1191ms
memory: 94080kb

input:

200000 399997
371 132032 483989781
58979 58980 745401219
387 89495 200906364
17256 17257 595596333
497 78440 136056323
370 141843 45199654
304 171219 628594533
13909 13910 42541341
387 83178 871903172
257 185656 237665621
173011 173012 143627932
153498 153499 36876071
27717 27718 206457430
257 18640...

output:

223732831

result:

ok 1 number(s): "223732831"

Test #88:

score: 0
Accepted
time: 1176ms
memory: 94368kb

input:

200000 399997
51952 51953 932112531
1540 115390 192000764
1544 102069 791008116
1487 129266 786466832
172285 172286 964578028
24656 24657 173342263
1540 112218 604110067
107318 107319 104097956
1978 89357 51099563
9631 46477 734589722
831 152966 640514472
9327 55413 949072519
193736 193737 890924421...

output:

546770089

result:

ok 1 number(s): "546770089"

Test #89:

score: 0
Accepted
time: 1210ms
memory: 94256kb

input:

200000 399997
3623 181725 387224714
4396 134666 867743441
124218 124219 419737349
5182 5184 347712064
111566 111567 207080893
2225 2226 269318284
8206 66807 379628458
111687 111688 144201030
96295 96296 907394887
85036 85037 155243742
36348 36349 91040400
8251 48671 205838737
9262 22108 73265892
145...

output:

469287432

result:

ok 1 number(s): "469287432"