QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#172426#3506. Team Contestznstz#64 462ms8212kbC++201.5kb2023-09-09 19:17:592024-07-04 01:53:46

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 1ms
memory: 5680kb

input:

3
1 1 2
1 2 1
2 1 1

output:

6

result:

ok single line: '6'

Test #2:

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

input:

3
1 2 2
2 1 2
2 2 1

output:

-1

result:

ok single line: '-1'

Test #3:

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

input:

3
3 3 3
2 2 2
1 1 1

output:

-1

result:

ok single line: '-1'

Test #4:

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

input:

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

output:

8

result:

ok single line: '8'

Test #5:

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

input:

3
1 2 3
1 3 4
1 4 2

output:

-1

result:

ok single line: '-1'

Test #6:

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

input:

3
4 1 3
3 1 2
2 1 4

output:

-1

result:

ok single line: '-1'

Test #7:

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

input:

3
2 4 1
4 3 1
3 2 1

output:

-1

result:

ok single line: '-1'

Test #8:

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

input:

3
9 9 1
9 9 2
9 9 3

output:

-1

result:

ok single line: '-1'

Test #9:

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

input:

3
9 2 9
9 3 9
9 1 9

output:

-1

result:

ok single line: '-1'

Test #10:

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

input:

3
3 9 9
1 9 9
2 9 9

output:

-1

result:

ok single line: '-1'

Test #11:

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

input:

300
57761889 84542255 27050597
34660889 31001456 73541706
28145521 16239284 59747407
28301910 73147643 52729219
76934759 81682223 25122810
79313872 51831684 8459494
79291107 42746492 28469171
178085 36381730 88571483
88031596 68636497 47738858
78328954 72492907 81005026
20116327 27194915 29047676
15...

output:

298779499

result:

ok single line: '298779499'

Test #12:

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

input:

236
11541369 9792582 4713403
87402689 82538784 88522804
35622147 10769145 14518449
85768984 12580765 86992032
97843742 97233030 66564513
87402689 41237008 87442884
73770719 95022375 94286048
89771996 85187794 89890546
61271783 67426819 70494968
638822 67263206 68519784
53640982 58599424 55894005
414...

output:

116772345

result:

ok single line: '116772345'

Test #13:

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

input:

269
58136345 49561853 5443232
82513448 84993754 23134893
22936917 4757404 58572392
55675309 81607644 84281385
77118458 79792604 84221560
95665801 97753268 96965456
75900766 78524832 80967453
88062625 87328036 70262153
69366513 49346229 29658819
22352552 10391396 40033635
22375771 60866395 3431631
61...

output:

219417965

result:

ok single line: '219417965'

Test #14:

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

input:

300
8161981 27071802 32031373
8819234 23356530 24538586
10553392 11086093 9901019
2335958 33351071 36363483
4517467 7763984 8075958
5311696 5749790 6698515
90417492 2769387 90241112
61926281 51651765 54285034
996697 517518 2853812
61926281 51651765 44079327
78933588 9905743 78435105
5171396 24886452...

output:

-1

result:

ok single line: '-1'

Test #15:

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

input:

280
133 127 23
85 28 108
67 68 115
121 90 100
89 17 102
82 115 58
116 136 77
160 178 93
137 25 116
44 110 68
20 54 48
119 102 117
131 69 8
56 71 133
84 1 66
123 63 26
14 12 116
108 46 80
18 27 59
40 18 85
86 103 86
9 294 295
45 48 21
75 98 43
84 110 67
258 251 92
97 122 81
22 8 36
12 133 129
21 47 1...

output:

424

result:

ok single line: '424'

Test #16:

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

input:

300
29 36 16
22 13 41
10 60 40
27 25 47
41 58 12
91 108 114
40 11 26
28 39 51
62 79 69
34 44 1
6 23 32
43 2 22
43 28 28
15 47 29
16 44 39
41 2 13
3 11 3
26 25 2
33 23 8
4 2 13
29 50 49
35 114 123
10 59 47
29 40 40
36 62 4
19 50 2
9 4 43
25 31 35
22 39 30
13 15 47
9 33 40
107 107 60
43 54 51
43 12 26...

output:

159

result:

ok single line: '159'

Test #17:

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

input:

297
16 15 18
1 20 20
11 16 7
18 20 8
17 20 13
18 17 19
11 12 13
17 16 7
5 20 19
6 18 19
12 14 18
11 8 18
12 16 4
11 14 7
13 11 18
3 20 20
6 16 17
4 12 14
12 16 9
16 14 18
17 19 18
12 2 18
1 15 16
3 20 20
15 16 16
10 16 18
7 12 15
17 1 19
11 18 19
8 16 18
11 14 14
11 2 17
16 19 19
11 10 15
7 20 19
16...

output:

-1

result:

ok single line: '-1'

Test #18:

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

input:

294
97782065 49441237 40553674
9802414 49441237 40811934
97782065 49441237 5522754
97782065 2894174 40811934
16244848 49441237 40811934
97782065 9535463 40811934
97782065 42126153 40811934
97782065 49441237 40811934
97782065 49441237 26799076
97782065 49441237 35044643
97782065 49441237 3672688
7878...

output:

-1

result:

ok single line: '-1'

Test #19:

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

input:

285
35578202 31000569 36164852
81961944 76527075 82527820
88051400 86477050 89247199
94640648 92434215 94445703
94995965 93531084 95877794
89327002 87766145 90029250
92910262 91636154 93379830
2426096 3925994 6056288
35633423 31247563 36205265
15437571 12960237 21719331
76640285 69178877 77008765
39...

output:

-1

result:

ok single line: '-1'

Test #20:

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

input:

300
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451
97002072 78259156 57267451...

output:

-1

result:

ok single line: '-1'

Test #21:

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

input:

298
1 1 1
2 1 1
2 2 1
2 2 2
2 2 3
2 3 3
2 4 3
2 4 4
2 4 5
3 4 5
3 4 6
3 5 6
4 5 6
5 5 6
5 6 6
6 6 6
6 6 7
6 7 7
6 7 8
6 8 8
6 8 9
7 8 9
7 9 9
8 9 9
8 9 10
8 9 11
8 9 12
9 9 12
10 9 12
10 9 13
10 9 14
11 9 14
12 9 14
12 9 15
13 9 15
13 9 16
13 10 16
14 10 16
14 10 17
14 10 18
15 10 18
16 10 18
16 10 ...

output:

300

result:

ok single line: '300'

Test #22:

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

input:

298
2 2 2
2 3 2
2 3 3
3 3 3
3 4 3
4 4 3
5 4 3
5 5 3
6 5 3
7 5 3
7 5 4
8 5 4
8 6 4
8 7 4
9 7 4
10 7 4
11 7 4
11 8 4
12 8 4
13 8 4
13 8 5
13 9 5
13 10 5
13 11 5
13 11 6
13 11 7
13 12 7
13 13 7
13 13 8
14 13 8
14 13 9
15 13 9
15 14 9
15 15 9
15 15 10
16 15 10
16 15 11
16 16 11
16 17 11
16 18 11
16 18 1...

output:

6

result:

ok single line: '6'

Subtask #2:

score: 29
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 29
Accepted
time: 1ms
memory: 3692kb

input:

4000
69754624 40719054 25880627
45203696 74886668 48113236
40895239 84354151 84890376
580122 37101650 40004403
59771964 89650621 34494619
79179033 28652564 80985199
779920 79517242 92970610
20761904 89259959 69731542
65839528 15069115 60213981
5488382 94474806 56098782
90286260 33217627 87863760
862...

output:

299859551

result:

ok single line: '299859551'

Test #24:

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

input:

3976
73080835 73640233 17173988
38377905 54150225 29777426
22029226 17439133 72850346
61386107 40478181 4651975
16895999 51353691 43033018
57768480 23567989 60837577
61998151 26423316 14211198
51429621 26067062 75369957
29953695 1177407 26929816
27206543 15665697 52877584
20574799 48632736 58521973
...

output:

260736782

result:

ok single line: '260736782'

Test #25:

score: 0
Accepted
time: 19ms
memory: 3820kb

input:

3999
99927690 82478783 99894018
52462308 24076588 3853388
49684627 86270167 86956767
80151792 80384937 29911028
86472898 90557517 90991905
64083294 6483865 46599362
49160914 45527295 9784891
72907827 73209811 33536143
24783914 18011564 7818799
5695363 21346535 27147968
43452998 45734019 52114612
916...

output:

214455382

result:

ok single line: '214455382'

Test #26:

score: 0
Accepted
time: 33ms
memory: 3756kb

input:

3983
46849863 43395352 44177592
45657330 42981464 43171279
20939599 73900639 73101781
65057736 62457563 35356299
90533889 9436603 90283376
88644998 68106794 87666543
64635325 61721461 22520753
34122184 4775910 32524643
15121582 15343649 3341666
1623242 1912753 1243989
371131 459445 121013
62142487 5...

output:

-1

result:

ok single line: '-1'

Test #27:

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

input:

2669
1203 722 409
1256 1277 44
1914 1956 896
189 1258 1224
2033 2056 2069
2128 1129 2153
1270 1431 1390
1938 1977 1717
1426 1100 1439
971 1799 1811
1076 437 1
1785 424 1847
1442 1486 898
693 1166 523
614 1942 1961
967 1251 1218
1303 485 1307
935 1634 1631
1263 1287 1227
646 379 2
1809 1863 886
90 15...

output:

3670

result:

ok single line: '3670'

Test #28:

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

input:

3999
218 755 664
1366 474 1371
92 171 572
402 109 682
801 13 831
307 390 666
745 504 462
1408 920 1397
364 325 780
233 465 599
374 52 436
374 139 165
496 624 91
240 504 151
35 618 229
739 523 358
311 449 388
71 688 806
485 433 93
653 189 39
180 163 703
377 117 755
75 69 208
675 174 495
108 932 972
1...

output:

2433

result:

ok single line: '2433'

Test #29:

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

input:

4000
234 42 243
88 272 269
249 247 133
122 229 237
219 211 113
215 99 209
201 114 202
202 178 202
34 265 265
270 275 163
288 105 279
249 247 19
276 277 12
253 69 259
243 242 95
112 201 203
262 267 134
239 236 154
155 275 270
215 25 210
266 93 266
254 65 261
289 294 287
249 118 257
288 48 278
275 275...

output:

-1

result:

ok single line: '-1'

Test #30:

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

input:

3827
58082543 57688628 42141064
58082543 37790572 56085417
30971155 57688628 56085417
58082543 7542303 56085417
58082543 6153647 56085417
58082543 57688628 56085417
58082543 57688628 56085417
58082543 15627876 56085417
19305094 57688628 56085417
58082543 57688628 56085417
51215057 57688628 56085417
...

output:

-1

result:

ok single line: '-1'

Test #31:

score: 0
Accepted
time: 51ms
memory: 3704kb

input:

3994
22717165 23485128 24150090
58326041 59735236 60460260
99683380 99624257 99659578
32760370 34440574 34542189
15816729 16596399 16849315
10007699 10765273 11243538
36933127 38871347 38984815
84796877 86029328 86457916
90312082 90579793 91410302
24270836 24773451 25474600
81299206 82908771 8295564...

output:

-1

result:

ok single line: '-1'

Test #32:

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

input:

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

output:

900

result:

ok single line: '900'

Test #33:

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

input:

898
2 2 2
2 2 3
2 2 4
2 3 4
2 3 5
2 3 6
3 3 6
4 3 6
5 3 6
5 3 7
5 4 7
6 4 7
7 4 7
8 4 7
8 5 7
9 5 7
9 5 8
9 5 9
9 5 10
10 5 10
10 6 10
11 6 10
12 6 10
12 6 11
12 6 12
12 7 12
13 7 12
14 7 12
15 7 12
15 8 12
15 8 13
16 8 13
16 9 13
16 10 13
16 11 13
16 11 14
16 12 14
16 13 14
17 13 14
18 13 14
19 13 ...

output:

6

result:

ok single line: '6'

Test #34:

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

input:

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

output:

4002

result:

ok single line: '4002'

Test #35:

score: 0
Accepted
time: 17ms
memory: 3752kb

input:

4000
2 2 2
3 2 2
3 2 3
4 2 3
4 3 3
4 3 4
5 3 4
5 4 4
5 5 4
5 5 5
5 6 5
5 6 6
6 6 6
6 6 7
7 6 7
8 6 7
8 6 8
9 6 8
10 6 8
11 6 8
12 6 8
12 7 8
12 7 9
12 7 10
12 8 10
12 8 11
12 9 11
12 9 12
12 9 13
13 9 13
13 9 14
14 9 14
14 9 15
14 9 16
14 9 17
15 9 17
16 9 17
17 9 17
18 9 17
18 9 18
18 9 19
18 9 20
...

output:

6

result:

ok single line: '6'

Subtask #3:

score: 9
Accepted

Test #36:

score: 9
Accepted
time: 13ms
memory: 7916kb

input:

150000
3 3 1
2 5 5
1 3 5
4 3 5
3 4 4
4 4 2
4 3 5
5 1 2
5 4 1
2 3 3
4 4 5
3 3 5
2 4 3
1 3 2
5 2 4
4 5 3
2 5 1
5 4 3
3 2 5
1 1 4
3 2 5
2 3 5
3 3 4
1 3 4
2 4 3
1 5 4
2 1 4
1 4 4
5 4 3
4 5 3
2 1 2
5 4 5
4 5 4
5 1 2
1 4 1
3 1 4
2 5 2
3 5 3
3 4 2
5 1 4
5 2 1
1 2 2
1 3 2
5 4 3
5 4 5
3 2 4
5 5 2
5 3 3
3 4 4...

output:

15

result:

ok single line: '15'

Test #37:

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

input:

99999
1 1 2
2 4 1
2 4 5
3 4 5
1 5 5
4 2 5
1 1 2
2 4 2
2 4 4
3 4 2
4 4 5
2 4 4
1 2 2
1 1 2
1 2 1
1 5 5
1 1 1
5 3 5
2 4 1
1 4 4
2 5 5
1 1 2
3 4 4
2 4 2
4 2 5
3 3 4
1 2 2
4 5 3
3 4 2
4 5 3
2 4 5
1 1 1
3 4 4
2 4 1
1 1 1
3 5 5
3 4 1
2 4 2
3 4 5
1 2 2
1 2 1
4 4 4
1 1 1
2 1 4
1 4 5
3 5 5
2 4 5
3 4 5
3 3 4
...

output:

8

result:

ok single line: '8'

Test #38:

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

input:

123456
1 1 1
1 1 1
3 3 1
3 1 3
2 1 1
1 1 1
1 1 1
1 1 1
1 1 1
2 1 1
1 1 1
2 1 1
1 1 1
3 3 1
2 1 1
1 1 1
2 1 1
2 1 1
1 1 1
2 1 1
2 3 3
2 1 1
1 1 1
1 1 1
3 1 2
2 1 1
1 1 1
1 1 1
2 1 1
1 1 1
1 1 1
2 1 1
2 1 1
2 1 1
1 1 1
5 3 3
2 1 1
1 1 1
2 1 1
2 1 1
2 1 1
1 1 1
1 1 1
5 4 2
2 1 1
2 1 1
1 1 1
2 1 1
1 1 1...

output:

7

result:

ok single line: '7'

Test #39:

score: 0
Accepted
time: 17ms
memory: 7640kb

input:

149999
2 3 4
5 2 5
1 5 5
4 4 5
5 2 4
5 2 4
2 4 5
5 5 4
4 2 4
3 5 5
4 4 2
5 1 4
3 2 4
5 2 5
5 4 1
3 3 1
3 1 4
5 2 5
1 2 4
3 1 4
1 5 5
3 4 4
3 4 5
1 2 4
4 1 4
1 2 4
3 3 3
3 3 3
3 4 4
3 4 4
3 3 3
5 2 5
5 3 5
4 2 4
3 3 4
5 4 4
5 4 5
4 4 1
3 2 3
1 2 4
4 1 4
5 5 1
3 2 2
3 1 4
5 3 5
5 4 1
4 4 1
2 4 4
5 4 2...

output:

-1

result:

ok single line: '-1'

Test #40:

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

input:

150000
2 4 3
2 4 2
2 4 2
2 2 5
1 4 5
1 4 5
2 4 5
2 4 5
2 4 3
1 4 5
2 4 5
2 1 5
1 4 5
2 4 4
2 4 5
2 1 5
1 4 5
2 3 5
2 2 5
2 4 4
2 3 5
1 4 5
2 3 5
2 4 5
1 4 5
1 4 5
1 4 5
2 4 4
1 4 5
1 4 5
1 4 5
1 4 5
2 4 1
1 4 5
1 4 5
2 4 3
2 2 5
2 4 5
1 4 5
2 3 5
1 4 5
2 2 5
2 4 5
2 1 5
2 4 5
2 4 4
2 1 5
1 4 5
2 4 5...

output:

-1

result:

ok single line: '-1'

Test #41:

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

input:

150000
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1...

output:

-1

result:

ok single line: '-1'

Subtask #4:

score: 9
Accepted

Dependency #3:

100%
Accepted

Test #42:

score: 9
Accepted
time: 1ms
memory: 3724kb

input:

2000
13 12 20
6 1 11
17 1 9
5 19 14
5 12 15
14 20 17
18 16 2
13 11 18
9 12 2
10 15 1
9 8 3
4 12 8
6 9 3
4 16 8
8 13 13
10 20 14
15 13 17
4 2 1
8 3 16
7 8 9
15 20 10
8 17 6
1 13 16
5 18 1
5 9 17
19 19 11
10 11 4
3 5 14
6 13 11
15 5 10
8 2 16
16 2 10
16 12 14
15 6 9
17 20 16
7 4 7
17 12 3
18 18 20
12 ...

output:

60

result:

ok single line: '60'

Test #43:

score: 0
Accepted
time: 20ms
memory: 8100kb

input:

150000
15 14 20
19 11 19
12 8 5
8 18 20
14 5 7
12 2 11
3 10 12
12 20 2
18 5 17
8 14 20
3 1 11
17 17 7
5 7 18
14 2 14
17 19 4
12 19 7
12 8 5
1 7 18
12 20 1
5 4 1
11 15 3
2 17 1
4 5 7
3 5 16
20 1 18
8 9 1
2 17 13
2 4 1
13 12 10
12 15 12
12 14 20
11 2 7
16 10 15
13 18 14
3 17 17
1 18 17
3 2 4
3 2 14
6 ...

output:

60

result:

ok single line: '60'

Test #44:

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

input:

146357
4 4 5
2 7 5
8 6 3
1 6 5
8 1 1
2 7 7
11 3 12
5 5 7
5 6 2
6 2 4
5 8 7
14 18 20
8 6 5
2 1 7
19 18 10
1 8 2
1 6 2
17 16 19
7 7 8
7 1 8
4 6 8
8 15 18
2 8 1
3 4 8
8 1 3
16 19 20
4 5 1
6 2 6
16 17 10
3 3 7
5 3 3
2 3 3
2 13 15
8 5 3
3 5 4
6 7 7
7 2 1
6 4 7
7 4 5
8 1 8
12 1 14
8 7 4
4 1 1
2 4 4
16 3 1...

output:

27

result:

ok single line: '27'

Test #45:

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

input:

108561
14 13 9
3 5 5
14 8 16
12 1 12
5 3 7
1 4 6
3 12 14
10 6 10
11 5 11
2 10 10
14 9 15
7 14 16
8 3 9
13 7 13
14 11 2
14 10 16
4 13 16
12 10 2
9 17 18
13 10 1
7 10 12
1 4 7
3 4 4
7 2 4
2 2 6
15 14 9
9 4 9
7 4 7
1 2 3
17 17 10
3 7 9
13 4 12
10 3 10
4 2 1
12 10 13
2 1 2
13 10 2
18 18 4
3 2 6
16 16 9
...

output:

22

result:

ok single line: '22'

Test #46:

score: 0
Accepted
time: 57ms
memory: 8076kb

input:

149670
3 19 19
10 14 2
9 9 9
13 17 7
17 18 10
4 18 15
10 11 9
7 8 8
19 9 19
3 11 9
16 17 17
6 9 6
20 20 4
13 16 5
13 14 9
7 11 2
20 2 19
13 16 3
20 1 19
20 12 19
15 18 13
5 17 14
6 12 9
13 3 10
15 18 10
7 15 9
12 17 14
2 10 8
8 5 9
2 15 9
14 18 17
12 15 9
4 18 19
10 7 9
8 17 10
13 2 12
10 14 4
3 14 ...

output:

-1

result:

ok single line: '-1'

Test #47:

score: 0
Accepted
time: 17ms
memory: 7376kb

input:

149992
4 12 3
2 12 6
1 12 6
4 12 1
4 7 6
4 12 2
4 10 6
4 12 6
4 12 2
4 12 6
4 12 2
4 12 1
4 5 6
4 12 5
4 1 6
4 12 2
4 12 4
4 12 6
1 12 6
1 12 6
4 12 6
4 2 6
4 12 6
4 12 6
4 11 6
4 9 6
4 9 6
4 12 5
4 5 6
4 12 6
2 12 6
4 12 6
4 12 4
4 12 1
4 4 6
3 12 6
3 12 6
4 12 6
4 12 2
4 5 6
4 12 5
4 12 6
4 12 6
1...

output:

-1

result:

ok single line: '-1'

Subtask #5:

score: 9
Accepted

Dependency #4:

100%
Accepted

Test #48:

score: 9
Accepted
time: 19ms
memory: 6972kb

input:

142857
68 39 191
69 19 83
255 92 215
13 119 166
298 33 23
113 269 103
133 115 148
146 287 209
123 2 189
63 159 178
239 180 127
73 231 212
242 197 179
212 186 291
41 197 274
298 82 172
69 147 298
218 52 257
162 77 274
206 109 217
290 300 131
272 227 145
161 11 283
276 83 256
77 240 36
3 79 189
222 3 ...

output:

900

result:

ok single line: '900'

Test #49:

score: 0
Accepted
time: 330ms
memory: 7756kb

input:

135792
6 12 24
89 61 15
4 150 128
244 86 228
150 8 116
184 157 116
8 101 9
55 98 19
142 220 209
24 69 113
126 133 126
95 20 99
264 146 255
258 284 282
222 290 285
118 282 279
139 103 124
147 60 95
154 148 103
51 129 118
202 100 189
141 71 15
38 246 235
145 43 31
48 135 141
139 78 39
289 289 78
10 15...

output:

550

result:

ok single line: '550'

Test #50:

score: 0
Accepted
time: 462ms
memory: 8100kb

input:

150000
12 66 60
60 65 116
31 65 31
48 104 127
287 218 282
160 173 120
56 146 27
96 109 123
138 102 21
288 288 149
46 14 32
62 69 108
59 129 32
75 86 64
63 151 21
120 72 75
225 257 259
4 16 96
12 117 68
54 208 179
82 78 40
60 76 42
14 167 136
46 63 76
137 21 60
67 31 77
219 218 117
50 115 39
139 141 ...

output:

441

result:

ok single line: '441'

Test #51:

score: 0
Accepted
time: 423ms
memory: 7360kb

input:

148610
52 183 169
113 300 297
156 190 181
247 246 248
212 2 222
218 56 224
239 190 242
203 223 98
173 220 216
163 194 75
234 261 246
202 187 216
227 243 124
27 271 266
183 205 97
215 165 222
216 233 209
158 190 140
247 79 247
225 94 229
170 200 109
195 214 25
180 35 194
184 206 81
252 268 31
48 197 ...

output:

-1

result:

ok single line: '-1'

Test #52:

score: 0
Accepted
time: 18ms
memory: 7888kb

input:

146573
289 145 57
289 237 35
289 181 57
289 47 57
289 212 57
289 237 57
289 237 8
289 33 57
289 237 44
289 237 42
289 184 57
182 237 57
289 237 44
289 95 57
289 93 57
289 164 57
289 237 57
289 68 57
289 237 41
88 237 57
289 237 53
289 237 19
289 21 57
114 237 57
289 108 57
289 150 57
289 127 57
289 ...

output:

-1

result:

ok single line: '-1'

Test #53:

score: 0
Accepted
time: 61ms
memory: 6420kb

input:

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

output:

-1

result:

ok single line: '-1'

Subtask #6:

score: 0
Time Limit Exceeded

Dependency #5:

100%
Accepted

Test #54:

score: 9
Accepted
time: 17ms
memory: 7172kb

input:

149996
3691 1395 3862
2765 3538 3498
128 964 337
3450 3294 2440
889 1498 3948
3770 898 1144
690 3900 643
730 738 162
1403 2635 885
3176 2916 3274
3734 2476 3312
2364 3574 319
2984 2748 1599
341 1349 3576
3040 423 2932
3050 3639 3437
184 48 3489
3660 2148 1115
2171 7 1939
2415 854 461
1900 3796 507
1...

output:

12000

result:

ok single line: '12000'

Test #55:

score: -9
Time Limit Exceeded

input:

149997
1936 2010 380
3368 416 3333
641 2952 2917
2112 716 2179
2970 36 2973
812 3153 3113
2697 622 2720
1973 2180 2184
3313 332 3281
2450 2068 2499
2923 2319 2929
24 2860 2847
2608 3284 3260
2523 2582 46
2875 1094 2885
2065 2131 772
3467 3464 3230
3591 3574 2358
3301 1963 3273
2521 1147 2559
883 131...

output:


result:


Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

0%