QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#74741#2266. Colorful RectanglelarryzhongAC ✓575ms18168kbC++173.1kb2023-02-03 17:04:252023-02-03 17:04:28

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 13876kb

input:

10
9991473 83825681 1
26476526 51616963 1
50765942 43355004 0
53028333 5604344 2
57100206 5782798 0
80628150 92688632 2
82964896 73929713 2
85102330 11439534 1
86076990 82286008 0
89626190 52420216 0

output:

75818374

result:

ok single line: '75818374'

Test #2:

score: 0
Accepted
time: 10ms
memory: 13864kb

input:

150
90758267 21234402 1
21737107 45944411 2
71064827 33646685 1
15732041 80099984 2
59366384 89336101 1
23463874 1772178 1
63300491 91439944 2
55016570 76385018 2
68263153 41801574 2
87098378 47936087 1
52162678 88263752 2
33679612 20590713 2
75242487 92720661 1
1669174 61465572 2
99532428 10613104 ...

output:

29171440

result:

ok single line: '29171440'

Test #3:

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

input:

10
4093976 78512657 0
27609174 62042588 1
31354091 61870386 0
35151441 36807411 1
37547440 25518220 0
44055162 7821981 2
66673981 41182270 0
83484785 58963611 1
83713705 24676214 2
88603397 80197017 0

output:

75778302

result:

ok single line: '75778302'

Test #4:

score: 0
Accepted
time: 46ms
memory: 14124kb

input:

10000
12096 65562074 1
14562 60486739 1
20187 50242814 1
35859 51060918 0
50463 52231435 1
56216 44100657 2
68431 98864745 1
73973 62323865 1
74745 22912751 2
100382 29322594 2
106833 31933585 2
123956 66437573 2
124095 72164704 2
130151 80006173 1
149897 26940530 1
150544 42049736 2
154249 83266583...

output:

476190

result:

ok single line: '476190'

Test #5:

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

input:

600
46864911 65058066 1
43812689 67844083 1
47624523 65356242 1
65763113 65439718 2
66870643 65931362 0
100000000 43232094 2
99773659 8651677 1
66502329 65775578 0
67130062 61467562 2
41297284 85249873 0
45570122 61586875 1
68626502 64903738 2
44727214 64595373 1
69383055 64974526 2
50960869 6495575...

output:

29384768

result:

ok single line: '29384768'

Test #6:

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

input:

10000
2177 6599212 0
3313 13493229 1
8624 80455572 2
10635 33135945 0
13266 17210177 0
21252 67913127 0
25630 44096615 0
26868 61301695 0
35959 34225877 2
40034 86139028 1
49019 16335976 0
56879 37023369 1
58406 27475381 2
65029 74490416 1
76280 94487503 0
78480 69430131 0
79030 23340728 0
79320 803...

output:

529732

result:

ok single line: '529732'

Test #7:

score: 0
Accepted
time: 246ms
memory: 16188kb

input:

60000
56904392 34119842 0
56860702 34345199 0
56863596 34223670 0
56833507 34167094 0
69029799 88014623 1
56701555 34308096 0
56818682 34376693 0
56834926 34330417 0
56949550 34257853 0
56684748 34297211 0
56900683 34127043 0
69073935 88044683 1
57002769 34170885 0
56645259 34209545 0
56949514 34101...

output:

214547970

result:

ok single line: '214547970'

Test #8:

score: 0
Accepted
time: 47ms
memory: 14224kb

input:

10000
5943 40201737 0
14879 96360008 1
84275 93764821 1
88316 65975310 2
92537 83169863 2
120913 54444955 1
122906 99179164 2
129216 52068348 1
138852 89877942 2
141123 97415909 1
155989 59760984 2
169805 6529653 2
170898 51961777 2
189693 18175483 1
198839 91060856 0
200187 19004619 0
207702 916481...

output:

392858

result:

ok single line: '392858'

Test #9:

score: 0
Accepted
time: 422ms
memory: 18148kb

input:

99999
65554710 12155679 0
78502621 86698549 1
66034198 11853186 0
78908439 86997239 1
75690302 59078887 2
75917845 58838788 2
78706695 87224574 1
75278920 59317406 2
75811752 58764827 2
65449462 11911322 0
79138515 86744879 1
65343865 11801595 0
65831220 12681966 0
78208917 86344984 1
78233596 86692...

output:

167810038

result:

ok single line: '167810038'

Test #10:

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

input:

10000
16453 91339702 2
17091 38182701 1
20936 29620225 2
47682 28151688 0
63221 76101571 0
65233 11392954 2
66284 74135634 2
86624 70956583 1
108068 98693936 1
114014 84167404 1
114265 18545899 1
120274 72079572 1
120373 96300499 2
123059 39784349 2
157658 37801703 0
170521 81004158 1
176351 5250039...

output:

352820

result:

ok single line: '352820'

Test #11:

score: 0
Accepted
time: 411ms
memory: 17924kb

input:

100000
36557383 100000000 1
53846533 5947338 0
24566151 89955356 2
23273552 91215468 2
36969432 98598695 1
26107898 89329321 2
53542808 6884678 0
37879687 99187185 1
52969807 5797175 0
53372131 4763020 0
36301035 100000000 1
53325023 6481729 0
37569840 100000000 1
24536890 89611841 2
24005966 893013...

output:

219386438

result:

ok single line: '219386438'

Test #12:

score: 0
Accepted
time: 47ms
memory: 14252kb

input:

10000
913 71695869 0
44727 80986550 2
53187 92127111 2
76157 87371194 1
80315 95062820 2
87064 48749409 1
87394 92128884 1
112372 46500690 2
120966 66525629 0
125652 92792157 1
136750 86862566 1
143481 96898726 2
151343 34996186 0
159085 62728567 2
164963 39895589 0
174996 82892797 2
184024 52133875...

output:

431976

result:

ok single line: '431976'

Test #13:

score: 0
Accepted
time: 424ms
memory: 17976kb

input:

97932
52284988 92138589 2
29206507 82522141 1
52909858 87999226 2
45692188 80211744 1
35493727 86238397 1
34822632 93781153 2
40346454 81255316 1
49468709 92105158 2
31027254 82650917 1
97094988 41517207 0
27125320 68205834 1
56699871 91310811 2
90235937 15919826 0
35696832 76242003 1
47376311 94592...

output:

60926458

result:

ok single line: '60926458'

Test #14:

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

input:

10000
4121 45276640 2
35568 51336364 0
47620 84075629 1
63330 76418369 0
63958 45357799 1
79664 74393497 0
88739 8368773 1
98705 64915375 0
100114 16259520 1
108749 92262958 0
116309 59859481 0
125921 4595658 2
131545 17676231 2
146925 83052695 0
154543 16882767 1
166321 43160274 0
174342 3499817 0
...

output:

506892

result:

ok single line: '506892'

Test #15:

score: 0
Accepted
time: 437ms
memory: 17960kb

input:

100000
39798904 68828678 2
56937242 58014952 0
56758306 57451114 0
38746499 51964627 2
56532042 58143844 0
52939689 63344810 2
45049586 65171055 2
20057743 3432569 1
51529728 57602014 0
62773199 68566788 2
51377179 65794879 2
34174168 63457598 2
52814256 69625370 2
58610225 67089086 2
56575100 58165...

output:

34188812

result:

ok single line: '34188812'

Test #16:

score: 0
Accepted
time: 47ms
memory: 14232kb

input:

10000
5737 37220377 0
5803 36404658 2
9249 6747714 2
25732 55571376 1
61246 30922073 0
61836 42608265 1
81477 70348885 0
107589 8738354 0
111307 8040637 2
143560 54882437 2
152517 76825039 2
176017 43369316 0
180092 87823847 0
184947 94495058 0
197882 37492026 0
217517 77700615 2
222701 67543247 1
2...

output:

181554

result:

ok single line: '181554'

Test #17:

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

input:

100000
17622444 8000033 0
30835380 8000033 1
52663741 8000033 0
70031205 8000033 0
54407389 8000033 2
82444091 8000033 1
79610268 8000033 1
53930150 8000033 0
28541791 8000033 2
43252170 8000033 2
53546829 8000033 2
3516948 8000033 0
51935542 8000033 1
55023622 8000033 0
65885269 8000033 2
89745547 ...

output:

40

result:

ok single line: '40'

Test #18:

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

input:

10000
797 75327956 0
1739 7223559 1
9535 32305593 0
11449 21913826 0
37076 67597268 1
44781 99118529 2
46837 19559579 1
53721 80491438 1
58502 76311712 0
62494 46799879 0
66912 46495165 2
72642 37596193 0
95419 70508156 0
98774 68665733 0
99049 63085873 1
100851 60379638 1
102269 54262558 0
124039 4...

output:

234328

result:

ok single line: '234328'

Test #19:

score: 0
Accepted
time: 280ms
memory: 17320kb

input:

89999
205666 94455220 1
205666 35678917 2
205666 52256947 2
205666 68754269 1
205666 94005 1
205666 2422108 2
205666 2285892 1
205666 5400544 2
205666 589131 1
205666 11052855 1
205666 58854275 1
205666 49541641 1
205666 9344081 1
205666 72847030 1
205666 88462926 2
205666 18405168 1
205666 37641873...

output:

570

result:

ok single line: '570'

Test #20:

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

input:

10000
16418 25742119 1
19362 72835924 0
25814 55273402 2
28354 16503772 1
35674 73165022 1
44784 1087463 2
47601 12411624 1
50648 33151245 1
65567 31969157 2
90135 58551022 1
93667 66249435 0
94800 81757923 2
95687 96403513 1
111285 5434122 0
122743 49787251 0
124178 24380367 2
127104 33015480 1
138...

output:

314578

result:

ok single line: '314578'

Test #21:

score: 0
Accepted
time: 301ms
memory: 17892kb

input:

99988
81658596 9857678 1
12901691 9857678 1
51330473 9857678 1
69758723 9857678 1
24863994 9857678 1
24647238 9857678 1
93743 9857678 1
23646126 9857678 1
62838732 9857678 1
87093702 9857678 1
66500611 9857678 1
55552900 9857678 1
69339800 9857678 1
11982991 9857678 1
88136181 9857678 1
58652443 985...

output:

33234210

result:

ok single line: '33234210'

Test #22:

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

input:

10000
12463 53976273 2
16752 44666915 2
35486 22942117 1
69285 10937347 1
90198 70512938 2
107835 17626469 0
110490 89422081 0
114230 76613764 0
116715 91852815 2
127212 33004689 1
129849 65884262 0
155831 3625748 0
197899 45439813 0
202844 90370232 0
221100 20227427 2
225410 86047873 0
243668 50293...

output:

471262

result:

ok single line: '471262'

Test #23:

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

input:

99000
3867278 6211390 0
3867278 7438194 0
3867278 61921807 0
3867278 64187547 0
3867278 3901333 0
3867278 85260412 0
3867278 90217021 0
3867278 33963707 0
3867278 76240668 0
3867278 9992815 0
3867278 70544690 0
3867278 8775049 0
3867278 59639602 0
3867278 80040055 0
3867278 88397701 0
3867278 686650...

output:

88145142

result:

ok single line: '88145142'

Test #24:

score: 0
Accepted
time: 488ms
memory: 17952kb

input:

100000
18889746 80825892 2
94088814 62055130 2
79603215 44900699 2
42896677 38430658 1
49282970 53290837 2
22790858 33522808 2
1308532 63910843 1
12517633 69091444 1
3548743 90642550 2
48276428 28094103 2
40019210 39413695 2
55101430 23501911 1
27540387 29927920 1
52831306 75094677 1
65765384 273908...

output:

556080

result:

ok single line: '556080'

Test #25:

score: 0
Accepted
time: 10ms
memory: 13928kb

input:

10
768944 75697598 0
6902422 93216713 2
15183597 180955 0
27184986 33864891 2
27879905 20284528 0
32701180 7153030 2
36169848 67213970 0
48935691 97215564 1
73072894 82457134 2
79462238 57686675 0

output:

133809280

result:

ok single line: '133809280'

Test #26:

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

input:

10000
2676 63840966 0
14845 22948247 2
57334 22476181 0
60999 70184447 0
62855 72897534 0
76256 10683056 0
89398 97963174 2
91652 26815417 2
94305 77677456 2
128548 42286076 2
131156 88841682 2
133804 66567842 1
148798 34612419 0
150638 36990047 1
162716 18287173 2
164239 7136954 1
167747 92072516 0...

output:

419330

result:

ok single line: '419330'

Test #27:

score: 0
Accepted
time: 137ms
memory: 15532kb

input:

45002
80784878 100000000 0
74070358 100000000 0
92264068 100000000 0
8217521 100000000 0
83010581 100000000 0
73021869 100000000 0
6097006 100000000 0
92628542 100000000 0
70631671 100000000 0
40446046 100000000 0
81040350 100000000 0
87440111 100000000 0
29702167 100000000 0
17836395 100000000 0
21...

output:

400000000

result:

ok single line: '400000000'

Test #28:

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

input:

10000
2006 27533984 0
7644 74450473 0
8441 13467706 1
8707 21108601 1
16184 85751962 1
31798 9401597 0
42515 33420931 1
47644 48212749 2
51041 26506909 1
54561 27238134 1
56426 48692922 2
66877 3951875 0
79176 27746449 0
83720 51263071 1
85646 85716140 1
96417 53433529 2
98349 99160354 0
101167 6766...

output:

641480

result:

ok single line: '641480'

Test #29:

score: 0
Accepted
time: 301ms
memory: 17888kb

input:

100000
0 23703331 1
0 64719277 1
0 87134496 1
0 42528306 1
0 45955283 1
0 65834033 1
0 66909138 1
0 94609830 1
0 95023036 1
0 37710801 1
0 49608915 1
0 98201020 1
0 23204876 1
0 22847412 1
0 45515359 1
0 73664101 1
0 54554658 1
0 13592393 1
0 1239300 1
0 51625196 1
0 84457291 1
0 96063270 1
0 288385...

output:

400000000

result:

ok single line: '400000000'

Test #30:

score: 0
Accepted
time: 46ms
memory: 14104kb

input:

10000
2749 8483150 2
6464 86936949 2
25425 42463787 2
26994 25562668 2
36603 85654264 0
41400 29645959 1
61393 81017746 2
94781 70915225 1
97649 64589780 0
109828 38477659 0
112319 73129841 0
125563 55316202 1
166032 85075539 1
171964 76351651 0
175773 7203035 2
204302 36081012 1
208750 58377391 1
2...

output:

456034

result:

ok single line: '456034'

Test #31:

score: 0
Accepted
time: 24ms
memory: 14172kb

input:

6000
376362 476188 2
402285 454848 0
99322 676817 2
193250 534293 2
571992 169388 2
303168 619233 2
99648 748507 2
775504 136790 0
981414 10792 2
254809 354288 2
610758 217021 0
71627 659798 2
322982 542437 0
280512 46060 0
538957 302114 2
128934 385464 2
534040 260473 2
130361 714502 0
248822 69938...

output:

394005206

result:

ok single line: '394005206'

Test #32:

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

input:

10000
11085 19956076 2
28992 78970329 0
62939 3733180 0
76991 98597291 2
91684 5867897 0
95877 13330962 2
97547 72977193 2
111404 58237061 2
113703 89539114 0
147025 79088418 2
157648 8753689 2
161830 43039760 0
178084 39138275 2
192121 56077012 0
195210 44079461 2
229798 39538899 2
231110 37702191 ...

output:

288872

result:

ok single line: '288872'

Test #33:

score: 0
Accepted
time: 281ms
memory: 16576kb

input:

65000
89199626 4616651 0
95103481 8362141 1
88512928 11561768 1
77842524 4132995 1
95321645 24854262 1
82409559 1627651 0
86529038 6522907 0
98617006 26961410 1
97626514 12044628 1
97478519 25018252 0
92438187 3035915 0
99952892 21273710 0
99715252 9202369 0
88710104 2571477 0
90433147 14002664 0
88...

output:

260067488

result:

ok single line: '260067488'

Test #34:

score: 0
Accepted
time: 47ms
memory: 14188kb

input:

10000
4734 82549009 0
9564 68995802 2
22897 61097368 1
41505 47284556 1
48247 55520192 2
54821 59256506 2
60784 15441678 1
62825 37141865 2
63306 44680951 0
74413 9110874 0
108586 46119242 0
119645 18081153 0
126559 7268901 1
136177 67866693 2
140790 29001354 2
185073 55390324 0
188692 54520929 2
20...

output:

597216

result:

ok single line: '597216'

Test #35:

score: 0
Accepted
time: 463ms
memory: 18168kb

input:

100000
2279400 85441 2
9917502 6195371 2
3571515 15532863 2
7489670 13387104 2
6766221 3672048 2
3390774 7866646 2
754687 4248851 2
10289262 12099356 2
4844256 9088781 2
2448719 7285217 2
1584821 21652364 2
2108702 13904922 2
17989615 1812747 2
827473 3846073 2
11872182 7140455 2
4229575 3605478 2
7...

output:

300072164

result:

ok single line: '300072164'

Test #36:

score: 0
Accepted
time: 47ms
memory: 14100kb

input:

10000
38155 50006790 1
48129 72721045 0
54668 10726795 0
100164 71165501 0
121669 30776169 0
123454 10830424 2
126593 37903389 1
140425 181165 1
141237 44253462 1
164654 95283318 2
169068 84413084 0
175852 1426364 2
189498 87935816 0
201891 81168572 1
235016 12862030 2
269826 84258128 0
270322 46785...

output:

460908

result:

ok single line: '460908'

Test #37:

score: 0
Accepted
time: 194ms
memory: 15480kb

input:

45000
1039806 16593563 1
2086737 16044300 1
5681898 8975193 1
2014278 7053991 1
8252050 6684331 1
2448270 14065943 1
2922149 15187540 1
13908461 7278135 1
172474 12975995 1
5262766 17548527 1
12860542 302398 1
4482690 20145297 1
12873095 9381880 1
7378483 11265505 1
3338797 191414 1
4890717 12202050...

output:

300039818

result:

ok single line: '300039818'

Test #38:

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

input:

10000
1811 82518842 0
12333 18566552 1
14450 43597768 1
17854 660897 0
43127 26497585 1
60988 30487734 2
69545 71073037 0
76626 18435225 1
82323 81858923 0
86137 93398613 0
103013 31328850 2
103512 5718013 1
106353 64710947 0
112188 65835832 0
116485 48449352 2
144177 60931392 1
148896 73259653 0
15...

output:

375560

result:

ok single line: '375560'

Test #39:

score: 0
Accepted
time: 474ms
memory: 18108kb

input:

100000
79717748 4186687 0
99920294 12543450 1
97556964 4796658 1
89945715 13443543 1
96256664 30845568 1
91281610 16906394 1
87131674 3145704 0
94826250 12965275 1
99820666 24518164 1
90475837 27251713 1
73094424 10746145 0
83603385 13866139 0
99319848 25942125 0
92548887 26128240 1
80152055 1248756...

output:

240069000

result:

ok single line: '240069000'

Test #40:

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

input:

10000
4290 8535133 0
5355 55822325 1
14019 699047 1
22505 61891556 2
40419 85315155 0
41054 84138102 0
42754 17650095 2
46192 25028891 0
51555 92295265 1
66281 86049150 1
67543 19388903 0
115032 82721506 1
118652 89550587 1
173169 59567501 0
179086 10593157 0
195991 21179132 1
204100 93694371 2
2117...

output:

410760

result:

ok single line: '410760'

Test #41:

score: 0
Accepted
time: 7ms
memory: 13936kb

input:

3
1885870 51584628 0
75633897 78835681 2
345677 55440871 1

output:

205078546

result:

ok single line: '205078546'

Test #42:

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

input:

10000
818 33289070 2
2108 67754187 0
5809 65836103 1
26874 47478246 0
45180 75547181 0
48873 52866411 2
51292 16189634 1
60882 92718889 1
77489 53709543 0
91981 87612227 2
95468 4606822 1
119179 32852804 2
120602 92547111 1
128207 7056502 1
130712 73153116 2
131586 33979644 2
161163 85277169 1
16290...

output:

234950

result:

ok single line: '234950'

Test #43:

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

input:

10
40931814 70172592 0
22882704 2509322 1
53154894 71392507 1
48347940 17363535 0
2595608 40754164 2
65170429 16854966 1
13806538 16384984 2
64049175 56446322 1
54018988 12737318 0
53397412 47597938 2

output:

72520334

result:

ok single line: '72520334'

Test #44:

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

input:

10000
2143 15330515 1
2461 14718996 0
13917 53089608 2
15987 54227799 0
16675 61446952 0
33627 46039625 1
40156 94523825 2
42679 32339557 2
63315 77848751 0
70028 24179301 2
121688 1642152 0
126899 3156157 1
133344 60921390 2
138825 8353469 0
157573 73562047 2
169635 6266354 2
171130 7876039 1
18340...

output:

394382

result:

ok single line: '394382'

Test #45:

score: 0
Accepted
time: 5ms
memory: 13848kb

input:

15
91797495 78091422 0
59045162 69067429 0
12641436 57891255 0
11506415 95429572 0
51636689 18985849 1
58827514 34741421 2
79678200 21362968 0
40389556 5671390 1
51701612 18165954 2
13090560 10044069 2
97483674 62920255 0
18765070 96690846 2
76655093 14427188 0
28774575 56361086 0
78699453 5777669 0

output:

59154130

result:

ok single line: '59154130'

Test #46:

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

input:

3000
74825112 84614343 2
54036072 33644266 0
81610821 443547 2
91713725 10899048 2
52099201 31350832 2
22874152 71039985 0
26390556 75528971 0
83985333 64939382 0
48201592 58223064 0
21355643 1018417 0
25050940 42650257 2
56967126 88912071 2
26595456 74287288 2
83547920 8802810 0
52999808 67749378 0...

output:

8706694

result:

ok single line: '8706694'

Test #47:

score: 0
Accepted
time: 5ms
memory: 13876kb

input:

10
4192465 56156774 1
14093789 7755109 1
20106145 75954824 1
54370752 58358740 1
64251663 1799164 2
64332286 96842715 2
74234341 46825819 2
79333880 46124602 1
85241483 3014702 0
94400651 89723231 1

output:

109636518

result:

ok single line: '109636518'

Test #48:

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

input:

100000
118 76490616 0
1460 86682671 1
3583 69000215 2
3672 28132726 1
5517 66325350 0
5739 68150603 0
6737 76837404 2
10392 60050091 0
12679 93972079 0
13682 63815531 1
15428 42954077 1
16460 83657343 1
18186 10421141 0
18608 8693880 1
19805 62522798 0
20053 50896792 1
21062 36303682 0
23445 2329602...

output:

54652

result:

ok single line: '54652'

Test #49:

score: 0
Accepted
time: 10ms
memory: 13844kb

input:

16
41636747 62616543 1
16342290 74905258 2
43747703 33496207 1
39841543 48898956 0
57242568 81655996 0
18187777 93084380 1
87625412 57736842 1
45830118 80333416 2
94811870 44941770 2
21481201 35701767 2
86401962 96021038 1
25298545 37656211 2
13296457 59608967 2
55014741 80184505 1
41345785 40831195...

output:

25767882

result:

ok single line: '25767882'

Test #50:

score: 0
Accepted
time: 552ms
memory: 17868kb

input:

100000
244 56579921 1
1409 67157814 1
2083 3770928 2
3580 42982386 0
4385 4626364 2
5353 9727286 1
5648 32581352 1
6440 32496711 2
6648 11468152 2
7006 33763558 1
10696 61007346 1
11106 99287838 2
12161 28058998 2
13812 42020506 1
14218 10647227 0
14399 30379992 0
14764 94311550 0
17147 86761607 0
1...

output:

43758

result:

ok single line: '43758'

Test #51:

score: 0
Accepted
time: 10ms
memory: 13960kb

input:

22
80066653 37627339 0
62626051 15146717 0
74406176 71309980 0
56253098 30355902 0
3047072 52070412 2
9708274 4132179 0
31892117 60421531 2
88535939 44253106 2
51411483 83018293 2
13658743 10504298 0
94864540 81480517 2
99161858 54720343 0
95212984 69522728 1
99036424 57018758 0
921663 51112570 2
57...

output:

57267286

result:

ok single line: '57267286'

Test #52:

score: 0
Accepted
time: 546ms
memory: 17872kb

input:

100000
228 76863460 0
3539 2062835 1
3712 33623372 0
4695 67867935 2
6247 74642118 1
7041 50669088 1
8233 38191173 0
9058 32165810 1
12281 1305697 1
13125 53516247 1
14304 37020589 0
14423 1913344 0
15316 22486491 0
15723 8831496 1
16264 41698014 1
18652 92934924 1
19827 75158782 2
22294 39952737 0
...

output:

25544

result:

ok single line: '25544'

Test #53:

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

input:

100
4711176 98856920 0
88483896 58888945 0
15909684 99159379 0
85416837 66671086 2
18202643 96401026 0
41874703 73334771 2
28661548 70157611 1
55671176 67954879 0
43287102 26382036 0
32605815 6246482 1
18868496 25081450 0
16188276 49099500 1
99883159 18946366 0
96623180 95188027 0
20922469 52982098 ...

output:

16970696

result:

ok single line: '16970696'

Test #54:

score: 0
Accepted
time: 559ms
memory: 17972kb

input:

100000
1216 64789985 1
2259 73951554 2
3438 15483842 0
3774 73440811 0
5689 17786777 0
6412 44683580 1
7988 99359997 2
8146 68743321 0
8636 93076034 2
9493 2871620 1
13121 40740699 0
13796 73566691 1
14081 25088597 0
15235 69454281 2
15252 24674876 0
16202 75210414 2
16216 60714105 2
16700 16016203 ...

output:

89186

result:

ok single line: '89186'

Test #55:

score: 0
Accepted
time: 5ms
memory: 13928kb

input:

150
25704555 75419647 2
44494060 59744119 1
34704588 349658 0
68012183 12323007 2
53965932 87025359 2
98190154 37978037 1
53247965 73231207 1
33566524 58883507 2
98063969 72395257 0
65009278 89236901 1
24888359 79971336 1
61098158 25496641 1
81639752 21037755 1
6271382 91878460 2
7852538 65685371 1
...

output:

8089638

result:

ok single line: '8089638'

Test #56:

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

input:

100000
83 17079143 0
1345 7386169 0
1532 4743328 1
1782 2512416 0
2904 56259740 0
3014 15610322 2
4092 77311923 0
4564 52467098 1
5223 20875902 2
5318 90139869 1
5611 18147969 0
10138 93579864 1
10253 45210099 1
10614 97598898 0
10809 2874562 1
11445 47988989 0
12275 16146632 0
13165 59019833 2
1341...

output:

52828

result:

ok single line: '52828'

Test #57:

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

input:

250
95880216 60063391 0
75166431 50328864 2
6196524 41445882 2
70172976 12473994 0
70359872 29166191 1
23515570 8214389 1
73850840 16907406 1
44616956 29254958 1
11153053 53523236 0
82035740 62798823 2
61488031 10353871 1
94328565 2721918 0
75213400 4056774 1
92018269 66898265 1
3857965 59506863 2
9...

output:

8656850

result:

ok single line: '8656850'

Test #58:

score: 0
Accepted
time: 548ms
memory: 17824kb

input:

100000
305 27418142 0
1877 58621381 2
2518 20452557 0
2777 94647782 2
3017 19209609 0
3474 4794604 1
3849 35439413 0
4831 32589894 0
5284 7865425 0
6346 79966370 0
7555 95934882 2
7711 7386030 1
7761 40958760 2
9022 82372360 0
9561 62120044 0
10530 50452367 2
10881 80765717 1
11339 24272125 0
12168 ...

output:

60770

result:

ok single line: '60770'

Test #59:

score: 0
Accepted
time: 9ms
memory: 13984kb

input:

999
4789720 15427176 2
89178611 99318968 1
67041443 71971507 2
59318888 29988421 1
34112152 86685431 0
42213458 35828365 2
6375548 20565698 1
32966271 21361994 1
61791279 88964008 2
76596818 89032463 1
70841661 74697766 2
36626331 78073417 0
78407332 97964026 2
16705263 41719522 0
99030316 18196088 ...

output:

2626312

result:

ok single line: '2626312'

Test #60:

score: 0
Accepted
time: 544ms
memory: 17824kb

input:

100000
4228 71659486 2
4576 55924812 0
5153 76787621 2
7526 85511904 2
7895 17772078 0
9586 86475404 2
13139 88440953 0
14410 25774518 0
14651 17374956 1
15058 45018291 1
17621 87198093 2
17670 25607588 0
18452 79338480 2
18889 96043170 1
18894 20757134 1
19836 62695754 0
20753 79138160 0
20772 8517...

output:

66778

result:

ok single line: '66778'

Test #61:

score: 0
Accepted
time: 9ms
memory: 13920kb

input:

1000
25698443 9979245 0
52449888 7219678 1
69241672 24703161 0
87029973 87979171 0
23301524 69462314 0
24874595 11993882 1
96782684 22204210 1
16752486 28837015 2
89322065 52971101 2
89325236 30087090 1
52494442 46464894 0
93451105 58705780 0
68667010 70537317 0
36585776 36861323 0
51090611 87881152...

output:

2510600

result:

ok single line: '2510600'

Test #62:

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

input:

100000
2131 36313479 1
2294 11971079 0
4471 4139217 2
4571 47900486 0
6662 91111147 2
6668 84004803 1
7431 61563007 1
9732 5053099 2
9874 47142104 2
10384 69882473 1
11189 32686828 2
11786 22368365 0
12244 29986914 2
12402 76915651 0
12753 22167843 2
13830 21287466 1
14338 40195369 2
17137 90721978 ...

output:

70862

result:

ok single line: '70862'

Test #63:

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

input:

10000
88024368 73455166 2
33462357 39887412 1
34041703 54939233 0
28860729 97399072 2
37406563 84965516 1
51281632 26037048 1
82143694 93646483 2
87583231 67513690 1
20633258 3556210 2
57535526 30715245 0
56239923 74505960 0
69843018 96735129 1
84416980 75280220 2
52375973 50218857 1
5565997 9484671...

output:

462166

result:

ok single line: '462166'

Test #64:

score: 0
Accepted
time: 566ms
memory: 17876kb

input:

100000
1084 2259514 0
4185 72014549 1
4480 57853649 1
4980 72602591 1
6846 98052596 2
7969 75885299 2
12958 22733787 0
13038 31129302 0
13747 79890501 2
14968 95740529 1
15546 91080678 0
16340 38524328 2
19141 7382179 2
19892 27445792 1
20552 46120517 0
20756 89237546 1
20803 3546010 1
21144 2849093...

output:

62546

result:

ok single line: '62546'

Test #65:

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

input:

35000
50580798 2798654 1
15420764 80045737 1
29855996 76906980 0
55927099 94718562 0
20957065 36554164 1
6459810 94347242 0
48102202 51469773 1
50122099 15054749 0
99759079 2710609 2
78309614 9604427 1
79820233 76356282 0
95030670 5180325 2
97652688 79976146 2
80261875 74568436 2
8655562 86012948 1
...

output:

154872

result:

ok single line: '154872'

Test #66:

score: 0
Accepted
time: 557ms
memory: 17936kb

input:

100000
4286 25780219 2
4843 62796210 0
5605 90465735 1
6305 23945491 0
6939 66093492 1
7375 39910900 0
7622 35220031 0
7768 47915802 1
9240 19080122 1
9524 38215295 2
9874 15795938 1
11714 21500923 0
12045 8575804 1
13613 86990433 2
13876 34691662 1
13950 12184758 1
14336 94865108 0
15452 1065437 1
...

output:

54790

result:

ok single line: '54790'

Test #67:

score: 0
Accepted
time: 255ms
memory: 15880kb

input:

50000
41339630 43298262 0
26107289 81804713 1
22352251 80375574 2
84717389 76286380 0
18976063 50448618 1
11546446 4166334 1
16310493 10389744 0
14326767 3088538 2
11275271 20866483 1
48135174 41759564 2
81228620 19736180 1
22585144 57847838 1
95954917 37803830 1
90308690 96908473 2
61833712 4312901...

output:

129726

result:

ok single line: '129726'

Test #68:

score: 0
Accepted
time: 495ms
memory: 17892kb

input:

100000
60497086 28873424 2
35261652 99507027 0
56046618 45466345 0
76231478 42256919 2
86729298 57010382 0
9962980 53681303 0
15936312 54795568 2
53368584 9596278 0
10907767 9147585 2
48534925 6826065 2
46130085 67810762 0
22455471 23967088 2
1365590 45800461 0
27274187 86279568 2
3632443 99795492 2...

output:

1247468

result:

ok single line: '1247468'

Test #69:

score: 0
Accepted
time: 8ms
memory: 13848kb

input:

10
1144964 22220532 0
2348045 65568825 0
2707015 50094136 2
5877534 73778244 0
11433924 66087950 0
16555455 87137143 2
31452458 78063624 0
50853661 708503 2
55150259 57576871 1
98635287 33721905 1

output:

136310152

result:

ok single line: '136310152'

Test #70:

score: 0
Accepted
time: 573ms
memory: 18040kb

input:

100000
6786 53692432 0
8230 44103412 1
11196 67428034 0
11794 43340546 1
12049 2717020 2
14702 85918139 1
15078 7278983 1
16549 6461842 2
18419 37213052 1
18771 32877890 2
19373 81946159 2
20681 88114778 1
21563 97388072 0
23236 51184212 0
23891 23604447 2
25305 14455405 0
26553 44573383 2
28527 520...

output:

88152

result:

ok single line: '88152'

Test #71:

score: 0
Accepted
time: 431ms
memory: 16848kb

input:

77777
20694752 89565062 1
24770420 33462636 2
50776636 41555416 0
17899057 65691776 1
78445322 64946212 0
98263090 79972679 1
91331632 25247452 1
29784963 1517782 2
40375884 5278046 2
18593455 11778651 2
82230461 71720390 0
85109864 35958965 0
71477395 75711128 0
62289274 56539583 2
14324086 3795709...

output:

104248

result:

ok single line: '104248'

Test #72:

score: 0
Accepted
time: 547ms
memory: 18060kb

input:

100000
760 74151149 1
2527 11769413 1
3235 60163979 0
3791 585665 1
4850 82657513 0
5145 77731523 1
6299 68103368 0
6720 86481779 2
8979 62921419 0
12918 40863343 1
14143 66952703 1
16143 92241635 0
17866 55069238 2
18399 11769740 0
20861 64578962 1
22669 75102961 2
23060 83912741 0
23644 40578542 2...

output:

75770

result:

ok single line: '75770'

Test #73:

score: 0
Accepted
time: 451ms
memory: 17020kb

input:

80000
15578971 99411004 1
83783683 18895690 0
48755003 46669825 0
70805734 77405317 0
36387207 14505949 0
2258982 60977054 2
8174890 18214333 0
26524408 21038380 0
88018851 86214483 1
83367580 17288972 0
20390742 21909318 2
28025143 68976707 0
85021348 65108167 1
68960976 94187270 1
73070491 1396270...

output:

81280

result:

ok single line: '81280'

Test #74:

score: 0
Accepted
time: 538ms
memory: 18004kb

input:

100000
750 97032449 1
999 81897562 2
3420 93438724 2
3542 87485075 0
3632 69035041 0
4033 44309470 2
4919 58451967 2
6049 53571466 2
7348 68941493 0
8311 74669459 0
8436 55288125 0
10116 62187666 1
11377 73613274 0
11751 37142405 1
13308 75313297 2
14108 64400404 2
14405 70348029 2
15357 92873197 1
...

output:

71324

result:

ok single line: '71324'

Test #75:

score: 0
Accepted
time: 523ms
memory: 17668kb

input:

90000
96618932 50259832 0
3894849 98260679 0
1231211 89607863 1
55416166 43708513 2
98911937 19738669 2
72349590 34206461 0
24147984 73692425 1
51342651 41235617 2
8132465 96605290 1
47581285 50817105 0
18387971 24713985 2
27097593 9119874 0
53067922 94495560 0
39224864 88582678 2
60761375 11961812 ...

output:

85020

result:

ok single line: '85020'

Test #76:

score: 0
Accepted
time: 560ms
memory: 17968kb

input:

100000
97 39789956 1
1104 82964231 2
2355 86418320 0
3151 96149990 0
3245 10962721 2
3996 62542032 0
4295 46264884 2
4680 60611416 0
6561 35466290 1
6959 62631631 0
8438 47906172 0
9576 65684138 2
10393 90382208 0
12524 70611837 1
14133 13188700 2
16857 8094250 1
17815 92284075 2
18342 25120256 1
20...

output:

95828

result:

ok single line: '95828'

Test #77:

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

input:

99999
70943964 24384587 2
59039267 65903609 2
56800319 98567109 0
66378863 77107970 2
22331287 40353319 1
10900480 11409794 1
63386147 98466577 2
18608976 71393289 0
422362 95967585 0
10595200 46910956 2
34730360 4461630 2
35708670 80543053 2
89029247 87762893 0
24068086 42150417 2
22875460 21075558...

output:

38680

result:

ok single line: '38680'

Test #78:

score: 0
Accepted
time: 544ms
memory: 17816kb

input:

100000
699 51385708 2
1581 65675363 1
2392 86818804 2
4195 88104060 2
4951 41579157 0
6803 35096638 2
7341 29930347 1
8338 60504 2
8697 17387366 1
8962 78554652 0
8991 97879621 0
9469 70728575 1
13730 50789876 1
15529 77417608 1
19016 11190083 2
19155 61119294 0
19306 75035729 0
19812 51747901 2
198...

output:

45258

result:

ok single line: '45258'

Test #79:

score: 0
Accepted
time: 554ms
memory: 17984kb

input:

100000
69981042 13947622 2
67719851 73250128 2
14534479 80715324 2
1650689 71573020 2
55512166 19443059 1
35929641 96343466 1
2376966 50635632 1
84817716 13309032 2
86775666 85260582 2
78824050 4597614 1
99289453 90176388 1
79522922 33917583 1
48375765 96500538 1
63952248 71304798 1
54989322 6214841...

output:

25330

result:

ok single line: '25330'

Test #80:

score: 0
Accepted
time: 535ms
memory: 17824kb

input:

100000
93628219 18767207 2
40712045 39842389 1
13954007 61885438 1
70444003 97125704 1
32932874 87204318 2
543540 93889951 1
60022944 55199188 2
22646756 92184183 2
33664107 71564078 0
62179130 44880728 1
61759152 46015446 2
72293013 43578088 1
73903937 11715679 1
59810584 415336 1
30719917 63504049...

output:

47026

result:

ok single line: '47026'

Test #81:

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

input:

100000
85902438 97886291 1
79163956 51815367 2
64791969 14285353 1
75418219 20436004 2
58764330 82987854 2
83146696 12835593 0
49666411 31570405 1
14183158 93922022 1
48241203 37580999 1
47668881 39109132 1
74543521 8447501 1
31831621 27721969 0
3414094 71908467 0
22739400 66891270 1
57476640 508604...

output:

53682

result:

ok single line: '53682'

Test #82:

score: 0
Accepted
time: 564ms
memory: 17836kb

input:

100000
548 60322055 0
4218 92588766 1
8668 99474823 0
9069 30926551 1
13097 46026607 0
13618 37642419 0
14210 17071643 1
14378 1437374 0
14439 94749606 0
15918 48477060 0
17401 50475772 0
17889 13572116 2
19007 32981481 2
19217 3275456 2
21574 61643511 0
22229 28406392 0
23118 96017739 2
23602 86129...

output:

47656

result:

ok single line: '47656'

Test #83:

score: 0
Accepted
time: 538ms
memory: 18048kb

input:

100000
422 16893616 2
6112 85474919 2
6777 311484 1
7305 61528373 2
7760 87980612 1
10588 9046679 0
11100 76761694 1
11166 58392139 2
12247 35599242 1
13850 26156275 2
15110 90225031 0
15421 75579111 2
16290 28723073 0
16611 23684246 1
16670 16748934 1
17144 67330395 0
17972 92311616 2
18123 9140667...

output:

59750

result:

ok single line: '59750'

Test #84:

score: 0
Accepted
time: 255ms
memory: 16192kb

input:

55432
71422152 37563236 0
3905137 1918976 0
74444194 83405896 0
21408037 17806763 0
46995022 57915360 0
44394164 96072977 0
60231918 1097115 1
92089942 98056988 1
48533446 44846036 0
71761818 58630224 0
67292173 70208898 1
81745874 43339930 1
96533463 74309642 1
93103873 59048638 1
25654676 702044 1...

output:

1669488

result:

ok single line: '1669488'

Test #85:

score: 0
Accepted
time: 10ms
memory: 13960kb

input:

10
22176117 15652627 1
22819275 41872120 1
45296201 84771832 0
58691075 75951649 1
60355210 67754833 1
62695127 61085202 2
77226295 60933409 2
88681396 83274619 2
95054955 49183078 1
98810675 7696544 0

output:

82171112

result:

ok single line: '82171112'

Test #86:

score: 0
Accepted
time: 529ms
memory: 17896kb

input:

100000
22228259 97217039 1
47253875 21445524 0
15347399 11337113 1
62259254 45507933 1
15459485 82785403 1
12045890 41992379 1
33898265 77412657 1
54666083 40601293 1
47703959 1269870 0
48101404 97433784 1
73014643 41407129 1
68113213 88327682 1
7002524 6798406 0
30837151 96828036 1
13709869 1980623...

output:

663740

result:

ok single line: '663740'

Test #87:

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

input:

10
780532 49142367 2
13737410 75940184 1
17388989 47681952 0
30078324 8282746 1
30758986 24038335 1
31530434 51015513 2
43430614 87306265 1
47984591 90034467 1
51283658 10850565 1
69650142 60788600 1

output:

82237246

result:

ok single line: '82237246'

Test #88:

score: 0
Accepted
time: 7ms
memory: 13932kb

input:

150
6899027 8214584 1
17200451 87681883 1
76286745 3608304 2
26809481 1074331 1
18224495 73991326 1
45956601 93852902 1
8154976 59625797 1
63055803 47948303 1
19898754 41292732 2
21233688 90958411 1
86130192 9017875 1
95764917 24991275 2
68345754 80995217 2
845501 71694887 2
16674349 95387148 1
2102...

output:

6718084

result:

ok single line: '6718084'

Test #89:

score: 0
Accepted
time: 9ms
memory: 13908kb

input:

10
15347702 83605323 2
30307571 15310088 1
32174524 76466649 1
40990935 82416086 2
52178494 1025360 0
62190404 41914297 2
65189939 11340938 1
71125634 74325227 0
95138607 55069889 1
97316555 32923984 0

output:

94083938

result:

ok single line: '94083938'

Test #90:

score: 0
Accepted
time: 411ms
memory: 18000kb

input:

99997
61271547 29262284 2
90461416 30451279 2
20567202 65630245 2
97790078 43842466 2
43824940 29093987 2
42905763 64821331 2
95682201 47290509 2
70111451 48907552 2
36558300 49926316 2
57169034 80382497 2
32084616 78098007 2
53395295 82845403 2
91784564 77911784 2
88267033 93884034 2
56035214 54777...

output:

224732788

result:

ok single line: '224732788'

Test #91:

score: 0
Accepted
time: 10ms
memory: 13864kb

input:

10
4856272 30518673 2
11502189 34023529 1
13325752 38481106 1
31535243 41905395 0
54519345 58506407 2
60946920 66866093 2
79651112 5776426 1
87905121 33701937 0
89001647 56016686 0
90288752 53597027 2

output:

76131386

result:

ok single line: '76131386'

Test #92:

score: 0
Accepted
time: 429ms
memory: 18020kb

input:

99998
72504518 36009842 0
60814447 85685574 0
63583242 7274986 0
39590634 63678095 0
49590095 47584530 0
77633955 64272965 0
35041206 40840790 0
70909455 96024511 0
68506745 74804603 0
32711440 47820325 0
83219506 57769064 0
17993583 64987762 0
85686633 56643350 0
22875277 52698051 0
31597074 137356...

output:

205400356

result:

ok single line: '205400356'

Test #93:

score: 0
Accepted
time: 5ms
memory: 13868kb

input:

10
21153613 71426516 1
24617133 75653462 0
33173838 29521482 2
33184172 60675607 0
39236909 24224716 2
40072424 787773 0
48358257 63036183 1
60906280 65810536 0
83092904 48980260 1
96972065 87590037 1

output:

97398240

result:

ok single line: '97398240'

Test #94:

score: 0
Accepted
time: 442ms
memory: 17864kb

input:

99999
66611115 92301306 1
95965741 24919696 1
51344413 39155106 1
77599487 41530694 1
86455486 91265043 1
45835567 2079891 1
53942931 23190531 1
75783681 5961342 1
23054787 98973629 1
74504062 42873430 1
25370160 48588711 1
14841883 5812070 1
49445566 38817379 1
15236455 68799115 1
83665694 78193430...

output:

100620452

result:

ok single line: '100620452'