QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#445708#8522. Waterfall MatrixCrysflyAC ✓576ms84740kbC++142.2kb2024-06-16 09:38:512024-06-16 09:38:53

Judging History

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

  • [2024-06-16 09:38:53]
  • 评测
  • 测评结果:AC
  • 用时:576ms
  • 内存:84740kb
  • [2024-06-16 09:38:51]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define int long long
#define ull unsigned long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 400005
#define inf 0x3f3f3f3f

int n;
int a[maxn],b[maxn],c[maxn];
int col[maxn],res;

int mat[maxn];
void solve(int l,int r,vi o){
	if(!o.size())return;
//	cout<<"solve "<<l<<" "<<r<<"\n";
//	cout<<"vec: ";for(int x:o) cout<<x<<" "; cout<<"\n";
	if(l==r){
		for(int x:o) col[x]=l,res+=abs(c[x]-l);
		return;
	}
	int mid=l+r>>1;
	multimap<int,int>mp;
	Rep(i,(int)o.size()-1,0){
		int x=o[i];
		if(c[x]>mid)mp.emplace(b[x],x);
		else{
			auto it=mp.lower_bound(b[x]);
			if(it==mp.end()){
				mat[x]=0;
				continue;
			}
			mat[x]=(it->se);
			mp.erase(it);
		}
	}
	int lim=inf;
	vi pl,pr;
	for(int x:o){
//		if(c[x]<=mid)cout<<"x,mat[x] "<<x<<" "<<mat[x]<<"\n";
		if(c[x]<=mid && b[x]<=lim && (!mat[x] || b[mat[x]]>lim)) lim=b[x]-1;
	//	cout<<"lim,x "<<lim<<" "<<x<<"\n";
		if(b[x]>lim) pr.pb(x);//cout<<"R\n";
		else pl.pb(x);//cout<<"L\n";
//		if(c[x]>mid){
//			if(b[x]<lim) pl.pb(x);
//			else pr.pb(x);
//		}else{
//			if(!mat[x] || b[mat[x]]>lim) lim=min(lim,b[x]);
//			if(b[x]>lim) pr.pb(x);
//			else pl.pb(x);
//		}
		
	}

	solve(mid+1,r,pl);
	solve(l,mid,pr);
}

void work()
{
	n=read();
	For(i,1,n)a[i]=read(),b[i]=read(),c[i]=read();
	vi o;
	For(i,1,n)o.pb(i);
	sort(o.begin(),o.end(),[&](int x,int y){
		if(a[x]!=a[y])return a[x]<a[y];
		else if(b[x]!=b[y])return b[x]<b[y];
		else return c[x]>c[y];
	});
	int V=1e9;
	solve(1,V,o);
	cout<<res;
}

signed main()
{
//	freopen("data.in","r",stdin);
//	freopen("my.out","w",stdout);
	int T=1;
	while(T--)work();
	return 0;
}
/*
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 3 5
3 2 1
3 3 3
4 4 1
3 5 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

1
1 1 58383964

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

2
1 1 204909414
2 2 807091086

output:

602181672

result:

ok 1 number(s): "602181672"

Test #4:

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

input:

4
2 4 107744934
3 2 143843719
4 4 908851567
2 2 307161330

output:

801106633

result:

ok 1 number(s): "801106633"

Test #5:

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

input:

7
1 2 140766572
5 3 795389698
3 6 279722536
2 6 442413348
4 2 475716910
5 4 704493410
5 2 423494885

output:

935621651

result:

ok 1 number(s): "935621651"

Test #6:

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

input:

11
1 5 104443431
4 9 692130290
4 1 18812720
7 3 381505729
7 7 706418558
11 9 242808397
10 4 490383412
3 2 72839501
10 7 883914647
10 6 738589165
11 10 556539693

output:

2757182575

result:

ok 1 number(s): "2757182575"

Test #7:

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

input:

17
14 13 957289906
14 1 220840920
10 3 230060608
9 12 405076666
13 5 112827045
12 12 925699151
11 9 243364659
3 15 66125969
1 5 481618704
17 11 67207393
9 4 141885319
2 2 641760683
4 6 30421350
5 9 145177348
7 13 468875688
11 7 557989385
13 17 468110036

output:

3056543193

result:

ok 1 number(s): "3056543193"

Test #8:

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

input:

26
22 1 655039096
18 3 405980640
11 23 310084709
17 6 5210226
6 25 869210460
14 23 9079903
17 9 162692938
21 1 703337421
13 8 216969244
8 23 242760842
11 9 876472951
5 15 545320494
8 6 764694540
4 12 164086724
6 13 394175551
10 1 906738317
26 25 224731347
12 14 967318812
26 14 449256484
23 4 6152281...

output:

3872286425

result:

ok 1 number(s): "3872286425"

Test #9:

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

input:

40
33 19 974202889
40 11 262863105
18 17 143706322
15 37 253303786
4 8 962133788
40 22 885916470
22 19 949122323
32 29 221627390
17 24 605257795
3 14 259799950
5 3 987951246
28 30 451968921
13 17 503334855
11 26 190979064
11 13 497711531
29 4 764544900
38 16 199461325
7 9 618831071
25 30 209848351
1...

output:

7657769074

result:

ok 1 number(s): "7657769074"

Test #10:

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

input:

61
6 25 772410634
9 47 581631393
40 34 565465748
8 55 154525415
3 50 298013089
16 23 593130934
26 5 721815207
42 43 28712243
61 21 539501497
49 53 283028482
4 20 267467572
59 45 55599983
26 3 218043086
15 8 213292621
37 44 119318590
29 33 445273185
37 3 734748198
21 56 178476345
12 40 897802983
3 29...

output:

9305689053

result:

ok 1 number(s): "9305689053"

Test #11:

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

input:

92
67 63 115551817
40 57 922062274
21 83 268857323
59 65 957783695
44 1 720871230
44 65 682393003
85 21 850933251
47 32 990892557
75 90 807656030
37 83 446279042
6 8 121301986
52 34 648749799
29 56 519610045
58 28 915936953
19 8 736754508
77 25 251573087
77 5 708764858
71 66 395892865
37 9 339525762...

output:

20584500053

result:

ok 1 number(s): "20584500053"

Test #12:

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

input:

139
34 89 106739274
76 37 623575790
96 95 241595468
100 37 24819785
67 78 157943133
86 66 173514198
6 107 220712008
95 94 902234730
124 117 827871287
82 10 199132415
48 29 821720496
99 15 21336498
79 84 287004315
27 57 112113016
102 106 99696275
52 94 326387056
17 41 717541828
24 119 561086579
137 1...

output:

34223480997

result:

ok 1 number(s): "34223480997"

Test #13:

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

input:

209
202 11 985436507
81 23 303372005
58 65 271936110
105 6 780231383
183 131 67052291
140 15 742761772
92 31 934033938
172 97 238586287
77 191 267962930
199 10 970201899
2 150 211701369
35 162 119938268
195 197 567498864
62 159 198698620
17 110 472437657
202 179 121800271
115 135 70371572
111 62 443...

output:

49909325408

result:

ok 1 number(s): "49909325408"

Test #14:

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

input:

314
26 307 692391292
279 111 226570582
290 76 261494858
132 47 708283863
253 177 82612833
32 26 881275895
248 213 349235000
240 136 227630771
133 208 894493845
295 174 760101024
191 182 333036912
309 205 326571720
138 220 582371900
185 262 33941275
113 151 91998856
194 51 532523590
219 174 90194801
...

output:

73980124774

result:

ok 1 number(s): "73980124774"

Test #15:

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

input:

472
215 64 888756595
191 437 782953525
284 151 807803141
142 382 737321722
200 373 933468526
387 190 414005694
137 464 157330847
240 55 838395267
262 74 996210474
428 42 179226852
364 446 789614149
177 66 882599216
6 278 229756157
22 325 676675321
231 131 811796299
335 86 632795653
184 433 454696152...

output:

115815454982

result:

ok 1 number(s): "115815454982"

Test #16:

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

input:

709
507 296 959229221
564 579 785837067
165 238 854583076
195 550 409079670
134 411 35472127
581 210 191747703
170 161 804804474
111 106 442762676
488 333 310679628
69 505 273768286
120 85 205745581
652 565 468876379
30 165 512567322
236 654 568944218
572 116 598480208
448 537 315385253
590 374 4940...

output:

176997131937

result:

ok 1 number(s): "176997131937"

Test #17:

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

input:

1064
1011 964 184314429
821 627 456155208
732 497 56527680
179 168 52071168
836 1005 604045343
19 401 439301716
818 500 303713286
970 268 24075641
888 744 839729821
101 97 726134962
942 260 735986500
143 436 241015562
668 910 391605524
634 635 160559352
205 50 612020502
20 360 696670729
175 575 2551...

output:

266930542461

result:

ok 1 number(s): "266930542461"

Test #18:

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

input:

1597
639 1393 166904194
1326 984 426206306
443 1524 935852282
848 1091 771776465
760 898 864783022
1379 372 38647886
481 603 346594658
521 122 293597610
1441 1589 133798182
1185 1272 279881925
544 666 231802145
1081 429 975793623
802 720 31278767
918 535 992962940
528 706 915212950
520 505 309874112...

output:

405559254752

result:

ok 1 number(s): "405559254752"

Test #19:

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

input:

2396
1981 1533 298355427
97 1737 959008541
787 1377 213392751
471 1 315600441
1995 1605 255228530
1813 309 900206470
463 536 734537574
730 2056 946098919
42 535 656307145
213 2365 598200890
582 105 100509217
1413 1740 655194157
1152 17 689800494
2106 1978 135105427
1252 999 617607068
1044 612 802184...

output:

597231143545

result:

ok 1 number(s): "597231143545"

Test #20:

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

input:

3595
1226 458 449847735
3424 1750 313050010
3169 2627 640096567
162 1184 906369956
1422 1015 293642622
340 2940 990712500
1026 1217 841244511
388 3004 899853656
896 669 146375886
2674 2297 111706208
3201 1696 323055839
351 1670 182429627
1633 511 12020195
2001 3285 41275714
248 1703 219345489
1759 1...

output:

899911898812

result:

ok 1 number(s): "899911898812"

Test #21:

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

input:

5393
2093 1287 583196596
2605 4403 533046343
3917 285 235297421
4318 4681 411844255
1588 1842 648962599
2164 2375 680797189
217 3854 531509369
4606 3646 354560797
4059 1754 976303595
1979 2652 265487574
4518 3955 157233712
2220 3416 107520029
1693 4855 722727994
4784 4162 245866252
498 1215 20109583...

output:

1349936604836

result:

ok 1 number(s): "1349936604836"

Test #22:

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

input:

8090
4866 7478 356775584
2504 3192 239406790
7743 2941 65392868
5615 1820 337863138
7340 4815 69744983
6191 1229 587983387
7729 3212 685050434
4313 5380 999113456
6515 5715 447059187
2429 7934 458547204
3870 7822 238996790
2286 3953 479733208
2620 3563 480862876
1111 6631 522438482
7956 2469 1939648...

output:

2064278617120

result:

ok 1 number(s): "2064278617120"

Test #23:

score: 0
Accepted
time: 22ms
memory: 13296kb

input:

12136
9194 7715 385468038
10307 6421 156181299
2779 9831 370946156
5449 7750 978449190
1276 844 367495644
1009 11917 41206130
4623 821 884083711
7802 3252 270221800
11699 9720 67880248
905 7498 882641163
846 10014 591139488
6648 1671 688996597
4295 12118 207178901
4320 10134 122002645
3686 10730 854...

output:

3119930013408

result:

ok 1 number(s): "3119930013408"

Test #24:

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

input:

18205
15502 9773 287504909
99 3826 342956061
5281 2167 882347909
11920 6288 432122804
12016 16973 61123860
5295 1207 911757865
14111 7883 777996097
1347 9620 363217200
660 15969 710395355
13065 15291 668428361
11892 17197 764778250
5172 9857 283025751
10253 11454 797309399
854 16916 387603881
4046 9...

output:

4646485106348

result:

ok 1 number(s): "4646485106348"

Test #25:

score: 0
Accepted
time: 54ms
memory: 18032kb

input:

27308
24579 3661 862768022
5266 18066 445716653
23679 2988 969489642
19312 17314 795242288
4196 16999 888385325
4082 25785 490546658
20278 6999 217961913
23575 3413 63174645
23253 26512 938455547
11715 7880 24996012
12751 25040 156918854
10141 15211 698329456
21632 8801 287594181
8346 4485 864856860...

output:

6953369240363

result:

ok 1 number(s): "6953369240363"

Test #26:

score: 0
Accepted
time: 98ms
memory: 21396kb

input:

40963
32397 21728 665533394
14092 25532 885841420
6996 13499 541070446
10132 14170 968034413
34862 23452 27553808
4384 18087 951007362
40193 36533 876771802
21939 255 835996912
14813 34602 396870817
23518 12878 121167193
24674 35802 634701100
30982 21854 872559058
37114 1857 748537081
14651 28035 78...

output:

10475585732428

result:

ok 1 number(s): "10475585732428"

Test #27:

score: 0
Accepted
time: 131ms
memory: 23640kb

input:

61445
36697 25963 94951597
7513 24837 819005409
854 59947 670876395
53706 28155 500385795
21808 12434 384290319
22180 9978 226530813
24817 39062 431206958
29985 44370 903111841
33782 7850 744209998
40702 37285 53291120
25414 271 438279520
4742 2959 465420139
4122 48945 880775407
42032 3922 82058901
...

output:

15678557202606

result:

ok 1 number(s): "15678557202606"

Test #28:

score: 0
Accepted
time: 207ms
memory: 43852kb

input:

92168
56230 42965 742064775
4877 45898 159393199
59960 15737 139858988
83885 3886 29974986
7528 23740 133054240
42731 67896 795632101
65960 85613 760855118
22584 18115 872879663
74322 5174 466635717
16877 65430 512235721
42196 12741 698697046
13205 45782 999285629
9991 85074 537703269
11324 57987 99...

output:

23527389016280

result:

ok 1 number(s): "23527389016280"

Test #29:

score: 0
Accepted
time: 367ms
memory: 50448kb

input:

138253
137028 98027 420176109
80718 126363 925205029
6738 78045 403027262
61401 88129 15744684
23837 119097 640220864
15996 46921 935267867
55975 15608 132891604
113324 22647 47973513
6441 33699 644316078
25548 66322 765816467
122863 55030 252850483
98023 67850 575671984
60006 91757 240693176
74046 ...

output:

35424061451157

result:

ok 1 number(s): "35424061451157"

Test #30:

score: 0
Accepted
time: 324ms
memory: 51956kb

input:

131071
90672 123987 228449234
3604 102308 987422594
59810 25149 860613161
104850 269 689330493
24993 101682 976691697
78019 43297 520816902
71433 76386 821164796
5909 77441 120378040
45000 43490 35922905
17468 78999 878299743
1241 113223 90941807
110893 103555 180500551
91339 77238 493814644
13139 5...

output:

33473411344075

result:

ok 1 number(s): "33473411344075"

Test #31:

score: 0
Accepted
time: 332ms
memory: 44484kb

input:

131072
61466 60099 43713848
4432 107280 858182963
105411 3399 116715084
97176 123606 720509750
25188 78189 197911350
63294 23532 650834189
29931 114646 773415808
83011 103448 15006743
36024 52158 574964066
104377 4278 481207906
98234 14071 880195643
95198 110017 473546968
90133 59609 136208461
322 5...

output:

33464721182174

result:

ok 1 number(s): "33464721182174"

Test #32:

score: 0
Accepted
time: 343ms
memory: 55428kb

input:

131073
45917 103829 958666723
94319 91112 870672821
76150 4477 607817071
116729 95377 688420221
63089 57400 798542306
96986 104154 423949112
122218 10852 946616129
82316 122347 621862025
76160 94630 657810973
128606 83099 974721993
36605 86452 897502490
47480 70841 125116337
126918 109172 170092230
...

output:

33570691146219

result:

ok 1 number(s): "33570691146219"

Test #33:

score: 0
Accepted
time: 543ms
memory: 74128kb

input:

199995
15467 44256 880189728
11879 82576 277886095
88467 171050 502781139
34306 134775 937105286
128255 122988 6045953
191726 128000 120294449
184032 174614 229445343
39848 120710 778565003
164709 140201 284867637
170121 23229 628225839
83381 194905 423440701
105958 129062 548268870
157416 169550 53...

output:

51069618351288

result:

ok 1 number(s): "51069618351288"

Test #34:

score: 0
Accepted
time: 576ms
memory: 84740kb

input:

199996
188022 175146 435109837
39484 18941 140354330
187252 68697 197359292
140669 100199 239571071
33378 157983 659846919
98775 148000 461407329
183074 161683 120451896
174079 107192 640918162
14142 142382 77946963
153761 156103 679585394
64357 34527 883645388
109018 133416 10586375
47249 119730 24...

output:

51185777204840

result:

ok 1 number(s): "51185777204840"

Test #35:

score: 0
Accepted
time: 543ms
memory: 69248kb

input:

199997
73516 19739 838723435
38402 99472 365024663
187720 163332 931156594
56035 23471 580502230
49038 141873 429779646
8373 33192 396621510
68459 156696 6650869
166766 98968 254901248
181072 29231 47536080
54302 118076 773441482
66958 11176 846380382
152996 46474 8222134
7962 143671 451843263
73692...

output:

51290453888715

result:

ok 1 number(s): "51290453888715"

Test #36:

score: 0
Accepted
time: 503ms
memory: 68724kb

input:

199998
190213 150886 166429875
135067 169295 920168970
14759 108153 278613035
34650 71509 216938350
40124 175509 223806600
177470 80553 613251251
112961 160689 560174209
199764 23352 272323852
49788 119514 140779902
65354 161950 227806555
122949 3774 996466001
38293 125522 96151161
187758 37169 9289...

output:

51151696245074

result:

ok 1 number(s): "51151696245074"

Test #37:

score: 0
Accepted
time: 540ms
memory: 64148kb

input:

199999
50070 37886 219662346
189360 149197 851580760
22803 24921 55886162
34597 66728 448499354
129241 45304 858815568
79315 77886 941776779
184463 48502 842324713
126429 153105 303195651
15965 159721 739003078
163463 165170 474932148
173069 168053 538878285
127254 115886 829462341
58964 148360 9015...

output:

51134677983253

result:

ok 1 number(s): "51134677983253"

Test #38:

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

input:

200000
3053 48451 852024905
130801 35304 406221494
155083 22092 637456588
27810 112924 897277150
186503 124280 165552724
1050 149205 721877548
84582 76769 721109700
36679 17354 915239240
8176 167598 89917290
66925 9658 537126621
114134 179363 318957046
140274 139241 256813774
89367 43733 432309120
1...

output:

51181746963331

result:

ok 1 number(s): "51181746963331"

Test #39:

score: 0
Accepted
time: 487ms
memory: 56480kb

input:

200000
18032 42637 994004831
107687 93151 1
146380 46394 999999974
19029 102809 968135491
144277 176499 3
29371 27209 972804372
126179 37298 999675260
105313 136862 396494
187401 34864 999988675
9509 61833 999999678
28123 123134 998640738
27570 2355 999999982
123391 159656 20293624
134993 1821 39
67...

output:

94638840715200

result:

ok 1 number(s): "94638840715200"

Test #40:

score: 0
Accepted
time: 484ms
memory: 58504kb

input:

199938
157289 79441 999999885
7274 59644 917
128813 125238 10018200
130060 16106 669933
82766 154952 1
136698 192241 999756229
116687 138602 958437703
190047 85657 999999514
181372 135008 28
188618 130954 999998253
90399 126826 4169878
195034 62671 16
197222 171004 999759771
93320 65646 999991932
18...

output:

94564959018584

result:

ok 1 number(s): "94564959018584"

Test #41:

score: 0
Accepted
time: 518ms
memory: 65480kb

input:

199809
191524 2302 999999987
26322 20497 2436769
107727 105643 424785
114452 75577 999999135
95309 187395 922785002
36623 196948 999897684
108165 30068 990732739
90159 110725 5
183727 149516 8998834
46718 150948 999986688
120472 112960 999994567
137939 177875 1175
20321 24484 996529789
195674 141463...

output:

94656882862646

result:

ok 1 number(s): "94656882862646"

Test #42:

score: 0
Accepted
time: 500ms
memory: 53220kb

input:

199992
17491 108201 999999973
46139 170475 1098
63905 14801 217
179110 151920 53
30285 18067 999998706
96817 142860 188
47164 115510 17
23612 14964 3
30832 155065 999997277
11899 78138 999999993
74893 152921 32
3832 139360 21091
140761 192714 661572950
30965 99162 1682
136835 100239 999995588
139980...

output:

94781878312984

result:

ok 1 number(s): "94781878312984"

Test #43:

score: 0
Accepted
time: 439ms
memory: 37780kb

input:

200000
22660 177341 3567
22018 177983 5324
158816 41185 9673
25309 174692 20312
166489 33512 22798
57756 142245 24188
73331 126670 27337
165374 34627 45497
549 199452 60469
124759 75242 62821
190829 9172 67547
84954 115047 71160
107563 92438 72178
90755 109246 81895
177334 22667 83803
116754 83247 8...

output:

0

result:

ok 1 number(s): "0"

Test #44:

score: 0
Accepted
time: 351ms
memory: 39196kb

input:

199998
18464 181536 800350907
29934 170064 678248091
89768 110232 88647223
38124 161876 590541519
90347 109653 83641788
6727 193271 927757818
15941 184057 827693561
22467 177531 758262055
58102 141896 375637093
67211 132789 281572233
94971 105027 43303372
45534 154464 510865697
12500 187498 86538531...

output:

2174338990

result:

ok 1 number(s): "2174338990"

Test #45:

score: 0
Accepted
time: 400ms
memory: 38152kb

input:

200000
1838 198162 980178988
32717 167283 648985408
16439 183563 823697651
34210 165790 632775927
22279 177721 760432627
34756 165244 626834126
94621 105381 46472626
16878 183124 819737427
17225 182775 815333031
11472 188530 876842117
65451 134549 296674941
58111 141891 376235881
60467 139535 349870...

output:

16525540505

result:

ok 1 number(s): "16525540505"

Test #46:

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

input:

199993
64300 135744 613312093
34861 165183 296582475
90699 109245 899810649
6522 193522 55837460
77837 122107 760239626
59198 140746 558383193
1944 198000 16830187
96978 103066 966989068
37678 162266 327325533
33610 166434 285740280
81403 118541 798424357
51385 148559 474432054
93948 105996 93469771...

output:

49979415209

result:

ok 1 number(s): "49979415209"

Test #47:

score: 0
Accepted
time: 309ms
memory: 36944kb

input:

199998
42354 157695 381749892
13828 186221 119483284
44492 155557 404578724
58421 141628 554928734
76777 123172 750913414
39402 160547 349695544
36671 163378 319924619
82125 117824 807826958
12010 188039 103921135
16730 183319 143998331
81343 118606 799757850
68534 131415 663157579
17404 182645 1495...

output:

50018556053

result:

ok 1 number(s): "50018556053"

Test #48:

score: 0
Accepted
time: 308ms
memory: 38088kb

input:

199997
31364 168584 662489251
16582 183466 822331606
95137 104911 42838118
86187 113861 119330597
75084 124864 214540141
63036 136912 323432421
70529 129419 253944309
26697 173251 713260701
78810 121238 182722788
54878 145070 410135506
43231 156717 534310798
92735 107313 63155678
27630 172318 703432...

output:

52679513086

result:

ok 1 number(s): "52679513086"

Test #49:

score: 0
Accepted
time: 515ms
memory: 82484kb

input:

199998
100390 189609 89319227
4497 105502 38638787
179755 110244 890868097
105743 184256 134939289
6071 103928 52121684
2867 107132 24575689
136522 153477 426056891
31727 78272 272579877
64366 45633 618496799
58222 51777 552009537
137727 152272 438789744
99557 10442 995557880
99336 190663 80119517
8...

output:

25617117364511

result:

ok 1 number(s): "25617117364511"

Test #50:

score: 0
Accepted
time: 539ms
memory: 82948kb

input:

199992
172473 117520 810591299
133977 156016 395428073
56079 53914 523772658
172060 117933 801910595
34259 75734 302785382
153832 136161 624261219
17274 92719 150556467
126395 163598 314991478
12467 97526 106969764
85067 24926 836136880
114837 175156 214241942
135514 154479 416066013
95139 194854 45...

output:

25535687755138

result:

ok 1 number(s): "25535687755138"

Test #51:

score: 0
Accepted
time: 541ms
memory: 83988kb

input:

199991
12522 97470 802819319
185702 104290 807693689
63844 46148 337007309
121351 168641 471822569
94328 195664 377701210
176699 113293 700491311
108772 181220 358281626
177407 112585 384993795
113861 176131 465475385
98373 191619 238407920
123640 166352 27086055
125472 164520 397508090
159076 13091...

output:

25576769610985

result:

ok 1 number(s): "25576769610985"

Test #52:

score: 0
Accepted
time: 384ms
memory: 36880kb

input:

199991
194665 194665 22880362
3107 3107 983488233
189522 189522 44793597
23887 23887 871439617
163629 163629 156791581
11477 11477 937697588
86990 86990 531849196
92270 92270 503372412
168009 168009 137490066
198788 198788 5246074
175535 175535 105076092
183888 183888 68982828
166686 166686 14327898...

output:

0

result:

ok 1 number(s): "0"

Test #53:

score: 0
Accepted
time: 414ms
memory: 36604kb

input:

200000
135685 135683 276563069
133790 133789 284612517
130100 130105 301317918
90945 90944 511808733
171149 171147 123345701
11075 11072 940259703
95841 95844 485551675
168545 168544 134319316
27102 27100 852732492
88048 88047 527690142
117645 117647 368426229
51895 51894 721041650
115389 115390 380...

output:

410516055

result:

ok 1 number(s): "410516055"

Test #54:

score: 0
Accepted
time: 404ms
memory: 39168kb

input:

200000
43431 43422 767501778
162822 162819 159073703
180642 180638 83681311
52882 52891 716273308
115316 115313 380561220
33959 33953 818260578
139015 139008 261290471
125193 125194 326901624
11066 11072 940585276
132861 132861 287727280
91918 91917 505656546
123165 123168 337880389
45418 45420 7570...

output:

871556481

result:

ok 1 number(s): "871556481"

Test #55:

score: 0
Accepted
time: 391ms
memory: 38156kb

input:

199992
1947 1948 989429728
72811 72812 607675580
177705 177704 94839321
90570 90570 512512422
115355 115348 378986670
2257 2254 987723936
61763 61763 667932919
60589 60589 674281673
76190 76169 589751075
136488 136487 271814239
105744 105739 430619435
105112 105116 433904613
173529 173525 112264296
...

output:

2433218429

result:

ok 1 number(s): "2433218429"

Test #56:

score: 0
Accepted
time: 388ms
memory: 36636kb

input:

200000
120044 120036 353819339
178031 178034 93989148
61081 61062 670074633
65652 65643 645934771
131617 131642 293337624
169491 169490 130825055
75265 75242 594261748
115686 115695 377042580
60687 60696 672067171
4371 4366 976755110
180558 180564 83100105
1288 1322 992921822
160971 160984 166773279...

output:

5342162603

result:

ok 1 number(s): "5342162603"

Test #57:

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

input:

199991
155361 155350 191272932
75669 75722 592361703
33369 33332 820315371
166526 166546 143664611
112336 112343 395418448
189368 189388 45211553
109420 109361 410848808
130658 130697 297516423
34928 34931 811835858
50123 50106 729175269
75463 75505 593615400
164689 164650 151592787
10926 10937 9416...

output:

18324347126

result:

ok 1 number(s): "18324347126"

Test #58:

score: 0
Accepted
time: 369ms
memory: 38928kb

input:

199999
69680 69673 625757853
93125 93120 499747501
90770 90799 512430591
39896 39870 786840466
26436 26440 858881536
133900 133916 282190136
75085 75072 597999442
181455 181476 77737733
63427 63561 658466554
18348 18376 902113086
76503 76476 590161029
61243 61252 671292057
47942 47994 742636237
6750...

output:

32144265081

result:

ok 1 number(s): "32144265081"

Test #59:

score: 0
Accepted
time: 368ms
memory: 38924kb

input:

199992
40685 40714 781526029
141884 142044 248993684
68324 68279 634605940
15162 15307 919325223
75234 75122 597219881
54165 54070 708814795
80029 79941 571049114
8395 8339 954797483
13209 13165 929313742
17872 18147 902721612
18386 18297 901678520
72682 72575 610550756
34378 34175 816117219
3773 35...

output:

67868880549

result:

ok 1 number(s): "67868880549"

Test #60:

score: 0
Accepted
time: 350ms
memory: 38320kb

input:

200000
180023 180288 84339695
2499 1969 988336549
182981 182853 80048977
96544 96552 483533244
108433 108590 418130408
25003 24449 869103630
26731 26866 855517626
143819 143746 244244955
172089 171364 121201733
73143 73075 608477792
195980 195564 19847429
76466 76335 589350819
172043 172103 12069883...

output:

215524315357

result:

ok 1 number(s): "215524315357"

Test #61:

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

input:

200000
140014 140272 261482551
94292 93528 490714300
82979 83102 554567359
54035 53842 708467113
16263 16329 910362578
175660 176299 103658538
19891 19639 892551970
198547 199154 6175039
132306 131497 288754216
114736 114722 384104286
187150 187015 60878276
44786 43273 759685138
15902 15611 91546568...

output:

368077087270

result:

ok 1 number(s): "368077087270"

Test #62:

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

input:

200000
159885 159042 171676772
103691 103694 442815632
127446 128998 308313621
145586 145659 254582794
78720 79743 578665874
139070 140045 258727081
92082 92952 511801919
111194 113646 388001260
95066 99233 481408960
130289 129588 309463689
102289 95008 440360586
127813 127670 314619636
29043 29753 ...

output:

899562637441

result:

ok 1 number(s): "899562637441"

Test #63:

score: 0
Accepted
time: 332ms
memory: 37232kb

input:

200000
187797 188740 42619872
198841 199180 13331015
35238 31951 804803373
6982 9286 939339043
5185 13953 908046636
94468 92656 501755787
123982 124512 356115478
189172 190662 39625458
38782 42209 767060007
104824 103503 440497060
132907 136184 273456760
131849 134980 268264950
133451 140278 2586390...

output:

2275242477924

result:

ok 1 number(s): "2275242477924"

Test #64:

score: 0
Accepted
time: 359ms
memory: 38320kb

input:

200000
94194 94419 492414878
110184 113938 371446190
103753 102211 440900739
144775 142992 324610449
92645 91647 511557741
31308 43868 788108361
78850 85969 536632698
133667 128806 274034966
79534 73500 563253949
77326 74886 590355544
33941 44574 825981303
125795 135006 290961000
12746 15524 9294274...

output:

5268091599365

result:

ok 1 number(s): "5268091599365"

Test #65:

score: 0
Accepted
time: 445ms
memory: 38884kb

input:

200000
308 224 282795304
445 35 389420214
42 323 645335271
407 91 350043207
392 269 116686718
132 421 249808242
293 149 478300532
360 178 273321598
368 390 37842579
9 193 890698340
180 83 816209952
146 148 768743126
93 1 976498424
258 44 757594451
106 409 313955917
390 216 177953826
128 372 34589343...

output:

0

result:

ok 1 number(s): "0"

Test #66:

score: 0
Accepted
time: 445ms
memory: 38260kb

input:

200000
286 391 100338575
164 54 874525344
131 94 865756758
99 265 646778492
192 430 158301137
163 37 893988919
55 231 783990841
71 412 381880440
427 398 8067967
145 100 841337995
253 31 786642624
92 19 967907732
401 348 43132045
320 322 135804399
154 336 366222507
209 118 715978082
434 329 34800556
...

output:

13421471

result:

ok 1 number(s): "13421471"

Test #67:

score: 0
Accepted
time: 446ms
memory: 39828kb

input:

199732
53 253 750457201
388 273 117965351
375 218 196659836
346 407 42311575
296 423 66589884
163 131 770265332
55 50 969992410
262 129 591870816
46 328 624921970
412 166 216938906
232 433 114325177
354 339 87467146
26 421 465363872
131 58 905229223
312 22 702748704
350 201 256941654
50 262 73851907...

output:

20862654407

result:

ok 1 number(s): "20862654407"

Test #68:

score: 0
Accepted
time: 371ms
memory: 36316kb

input:

200000
370 394 43266558
182 344 297952717
335 381 63185920
178 387 236158118
278 402 103010732
228 114 685614594
284 35 744672885
240 256 342511956
418 163 212413020
29 404 512286594
228 315 268392444
269 74 695382386
297 269 228660063
318 268 218621020
63 139 890269808
32 160 906802554
66 179 83727...

output:

769301802155

result:

ok 1 number(s): "769301802155"

Test #69:

score: 0
Accepted
time: 340ms
memory: 39068kb

input:

200000
82 66 971102008
360 19 629486782
159 433 194686548
431 190 172765548
306 302 309995870
437 111 272673175
312 140 474317642
256 239 365861259
269 134 563102942
219 203 525957213
307 101 587218237
410 375 7857727
439 416 7915983
9 409 511901245
89 82 914657232
151 262 561015022
230 239 44697772...

output:

2659848140246

result:

ok 1 number(s): "2659848140246"

Test #70:

score: 0
Accepted
time: 384ms
memory: 38580kb

input:

199495
186885 186936 53942447
63364 63428 658155180
39135 39210 787642148
38290 38195 792016750
100533 100589 457796430
14283 14293 922316851
155180 155188 190770767
118554 118595 360816427
97699 97704 473523501
158696 158737 175441634
135123 135051 276375466
78174 78191 577591602
69866 69921 622577...

output:

4761393792

result:

ok 1 number(s): "4761393792"

Test #71:

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

input:

199866
93473 93524 496784247
55074 55048 705169680
38180 38072 794526037
174541 174425 106472998
125044 124789 328231227
43103 43192 768463208
82351 82379 557404313
102000 101792 451040967
158143 158311 177865622
15776 15797 915489952
19961 19887 893497541
123706 124004 335631671
7611 7396 959311787...

output:

60917392006

result:

ok 1 number(s): "60917392006"

Test #72:

score: 0
Accepted
time: 403ms
memory: 38744kb

input:

199579
116052 184208 378285944
40711 40197 783212350
21915 28616 883560306
161639 104097 164408961
190156 91717 41037078
125756 42985 326086513
187469 164821 53031878
106240 22639 431702168
191045 117428 37106415
188484 51199 48339078
62399 563 666236836
144670 104124 237173212
27667 18292 853170850...

output:

4661887781

result:

ok 1 number(s): "4661887781"

Test #73:

score: 0
Accepted
time: 377ms
memory: 39836kb

input:

199477
66770 52520 642353176
139117 30258 259420418
118910 130349 359433032
86741 3558 536019246
116883 47197 371846538
180404 197820 82455423
39596 102857 787513284
182954 44072 71254826
16818 67019 908753505
73293 95568 606799778
111891 166100 396464386
14097 94502 923139482
198163 35335 5310742
6...

output:

59947639798

result:

ok 1 number(s): "59947639798"

Test #74:

score: 0
Accepted
time: 365ms
memory: 38844kb

input:

199869
172973 74199 115882440
128458 33567 311657243
14484 35795 922363941
58426 5657 683983409
177824 129953 93570045
33584 142329 819343206
7196 22750 961557713
43537 121952 766065477
57145 104855 692472119
165246 169176 145874102
103333 24937 444118384
173966 163586 109592228
120854 170925 350168...

output:

190495084205

result:

ok 1 number(s): "190495084205"

Test #75:

score: 0
Accepted
time: 368ms
memory: 38044kb

input:

200000
109619 178485 408525309
81039 70890 564419579
34074 11217 811059409
44154 153326 755890900
136437 95729 269493968
50874 32196 727123567
108930 4581 411273999
35873 124303 814367865
66980 25581 634176528
127023 146948 318672492
126741 30114 314855113
183755 11674 65362133
178429 157323 8966152...

output:

660425622094

result:

ok 1 number(s): "660425622094"

Test #76:

score: 0
Accepted
time: 359ms
memory: 38640kb

input:

199936
75188 24322 599819217
34622 153449 813476409
77900 180684 579662513
69879 1507 620667708
63901 134402 648640685
129397 183159 293919317
73165 65181 593464087
47031 165893 745354488
63377 92616 648540922
138973 5710 255558859
8696 147025 951555208
146927 70492 248640935
4153 37238 967436865
60...

output:

2011806766138

result:

ok 1 number(s): "2011806766138"

Extra Test:

score: 0
Extra Test Passed