QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#849416#3224. DirectionsHuangHanShengAC ✓114ms38708kbC++141.7kb2025-01-09 15:14:502025-01-09 15:14:50

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 43ms
memory: 12748kb

input:

200000
-1 -1 1
1 1 1
0 1 1
1 0 1
1 -1 1
1 1 1
1 1 1
-1 1 1
1 -1 1
0 1 1
0 0 1
0 0 1
1 -1 1
-1 -1 1
0 0 1
1 0 1
-1 1 1
-1 1 1
1 1 1
1 1 1
-1 1 1
0 -1 1
1 -1 1
-1 0 1
1 0 1
1 -1 1
0 -1 1
1 0 1
-1 1 1
1 0 1
-1 0 1
1 1 1
1 0 1
-1 -1 1
-1 1 1
-1 -1 1
0 -1 1
0 -1 1
1 1 1
1 -1 1
0 1 1
1 1 1
-1 1 1
1 -1 1
0...

output:

3

result:

ok single line: '3'

Test #2:

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

input:

200000
-1 -1 2
1 0 1
1 0 2
1 -1 2
1 0 1
-1 1 1
-1 -1 2
1 1 1
0 -1 2
-1 -1 1
0 1 2
0 -1 2
-1 0 2
0 0 2
-1 1 1
1 1 1
-1 0 1
1 -1 2
1 0 1
0 0 1
1 0 2
0 -1 1
0 1 1
0 -1 2
-1 1 2
0 1 2
-1 1 2
0 1 1
0 1 1
1 1 2
1 1 1
1 0 2
1 1 2
-1 1 2
-1 1 1
0 1 2
0 -1 2
1 0 2
0 1 1
0 -1 1
1 -1 1
1 0 2
0 -1 1
-1 0 1
0 -1...

output:

3

result:

ok single line: '3'

Test #3:

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

input:

200000
1 0 555860533
-1 1 633479355
0 0 411890838
-1 -1 411764668
0 0 324117889
1 1 147426106
1 0 41681213
1 -1 169580394
1 -1 204074237
-1 1 265787176
1 -1 204010614
0 -1 582574240
0 -1 98238758
1 1 489573021
-1 1 747647275
1 -1 933893240
0 -1 663924164
0 0 470849190
1 -1 479419247
-1 -1 53695974
0...

output:

95355

result:

ok single line: '95355'

Test #4:

score: 0
Accepted
time: 44ms
memory: 13836kb

input:

200000
-1 0 1
-2 2 1
0 0 1
1 1 1
2 -2 1
0 2 1
-1 -1 1
0 0 1
1 1 1
2 1 1
0 1 1
-2 -1 1
-1 -1 1
-2 2 1
-1 -2 1
0 0 1
-2 0 1
2 1 1
1 -2 1
1 -2 1
-1 -2 1
0 1 1
0 -1 1
1 -2 1
0 1 1
2 0 1
-1 1 1
1 0 1
2 -2 1
-1 2 1
-2 1 1
-1 0 1
2 1 1
0 1 1
-1 -1 1
0 2 1
2 2 1
2 -2 1
1 -2 1
-2 0 1
-2 -2 1
-2 1 1
1 2 1
2 -...

output:

3

result:

ok single line: '3'

Test #5:

score: 0
Accepted
time: 45ms
memory: 14044kb

input:

200000
-2 1 2
2 1 2
1 -1 2
1 2 2
-1 2 1
1 -1 2
1 -1 2
-2 -1 2
1 2 1
2 -1 2
0 1 2
1 -1 1
-2 2 1
-2 1 2
-1 0 2
2 0 1
1 -2 2
-1 1 1
1 -2 1
-2 1 2
-1 1 2
2 -2 1
-2 1 2
-2 1 1
-2 2 1
0 -2 1
2 -2 2
0 2 2
2 2 2
2 2 2
0 2 2
-2 2 2
1 -2 1
1 0 2
-1 -2 1
-2 1 2
0 -1 1
2 0 1
-1 -1 2
1 -2 1
-2 -2 1
1 -1 2
-2 2 1...

output:

3

result:

ok single line: '3'

Test #6:

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

input:

200000
-1 -2 29368112
2 -1 24391896
0 -2 58495223
0 1 266081519
-2 -2 381375524
2 1 738559870
2 -2 407460939
-1 1 562555301
-2 2 185971753
2 -1 886154605
1 1 842679105
1 0 300033644
2 1 430527773
-1 -1 295205658
-1 2 903654949
-2 2 674980542
2 -2 725974565
0 1 924537846
-2 1 828956777
0 2 145229295
...

output:

50007

result:

ok single line: '50007'

Test #7:

score: 0
Accepted
time: 45ms
memory: 13488kb

input:

200000
-1 1 1
2 0 1
-2 2 1
-2 -2 1
-1 -1 1
1 0 1
1 -1 1
1 -1 1
2 0 1
2 -2 1
-3 -1 1
-1 3 1
0 0 1
2 3 1
-2 -1 1
3 0 1
-1 -3 1
-1 -1 1
-3 1 1
-1 0 1
-1 -3 1
-1 0 1
2 3 1
-3 3 1
-1 2 1
-3 0 1
3 2 1
-2 1 1
-2 -2 1
2 3 1
2 3 1
-3 -3 1
2 3 1
1 -1 1
-1 -2 1
1 1 1
-3 1 1
-2 0 1
-1 -3 1
1 -2 1
-2 0 1
1 -1 1
...

output:

3

result:

ok single line: '3'

Test #8:

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

input:

200000
-1 3 2
-2 -2 2
1 -3 2
3 0 2
3 -3 1
2 1 1
-1 -3 2
0 0 2
1 0 2
1 0 1
-1 -1 2
1 2 2
-1 1 2
0 2 1
0 3 2
3 0 2
-1 -2 1
-3 -2 2
0 0 1
-3 -2 2
3 1 2
3 0 1
-2 2 1
-1 0 2
3 3 1
0 3 2
1 -1 1
-2 0 1
1 -1 2
2 3 2
-3 -3 1
2 0 2
0 -2 2
3 0 1
3 -2 2
-1 2 1
-1 0 2
1 2 1
2 1 1
1 -1 2
1 -1 1
-2 -1 2
0 -3 2
-1 ...

output:

3

result:

ok single line: '3'

Test #9:

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

input:

200000
1 -3 518137122
2 0 834424887
-3 -2 231423111
1 -2 504370653
0 -1 410088110
1 -3 604634228
0 -1 778458743
-2 0 372225547
-3 -3 213186092
-1 3 217495508
-1 0 897781531
-1 3 890144466
0 0 174193369
2 -2 392192299
3 -3 664301085
-1 2 394866190
3 -2 923710269
-1 -1 601337929
1 -3 519383120
0 -1 18...

output:

55780

result:

ok single line: '55780'

Test #10:

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

input:

200000
-6 7 1
1 -5 1
-5 -5 1
-1 3 1
-4 5 1
9 0 1
-2 -10 1
6 9 1
9 8 1
8 -3 1
0 3 1
-7 -7 1
1 9 1
3 -3 1
-5 -6 1
-9 5 1
-9 0 1
8 8 1
-2 -9 1
0 8 1
-10 2 1
1 -5 1
6 -7 1
4 3 1
4 -6 1
-9 10 1
-2 -1 1
9 8 1
-8 7 1
3 -6 1
0 10 1
0 10 1
-10 6 1
3 -9 1
8 -10 1
-5 6 1
-1 6 1
0 2 1
-1 -5 1
6 8 1
1 -9 1
8 4 1...

output:

3

result:

ok single line: '3'

Test #11:

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

input:

200000
6 -8 2
-5 9 2
0 -4 2
-2 -9 1
7 8 2
10 8 2
-5 5 2
4 3 1
-8 -7 2
-1 0 1
-2 -3 1
-9 -6 1
10 7 2
1 -8 2
-3 -4 2
-8 9 1
5 -3 2
-10 -5 2
-8 10 2
2 -7 2
7 -8 1
-9 -1 2
-4 6 2
-2 10 2
3 0 1
-7 2 1
-2 10 2
9 4 2
-9 9 2
9 -5 1
4 -4 1
8 2 1
-1 8 1
6 -9 2
-1 7 1
-8 7 1
-6 7 1
-6 -4 1
4 8 1
-9 8 2
-7 -8 1...

output:

3

result:

ok single line: '3'

Test #12:

score: 0
Accepted
time: 60ms
memory: 12640kb

input:

200000
1 -9 868328714
1 -2 169338841
2 -3 522935877
7 4 846334853
6 3 95747102
2 8 683463453
-3 10 674070722
7 5 879124379
9 7 411799557
-6 5 452823389
10 0 460945667
-5 -10 384988883
-4 10 944711005
-8 -6 540403661
6 0 804621844
-5 9 121613673
10 -3 854883852
7 -5 776415902
0 9 555825703
-6 -5 2637...

output:

49548

result:

ok single line: '49548'

Test #13:

score: 0
Accepted
time: 112ms
memory: 38708kb

input:

200000
-712994576 681957216 1
742214757 -749366118 1
643431902 -900788690 1
490499102 469176533 1
274934881 224980485 1
66532381 -860911586 1
776002355 -154470536 1
837312330 -571543374 1
971536663 -630853477 1
116903881 442223660 1
667716471 -828182152 1
336272958 -251409255 1
503068146 763971728 1...

output:

3

result:

ok single line: '3'

Test #14:

score: 0
Accepted
time: 109ms
memory: 38480kb

input:

200000
-602008984 693387889 1
897189880 -803134494 1
35887395 374199573 1
97436871 -310842124 2
-317640064 -574779803 1
-295972377 43817547 2
340192254 370024590 1
-78314559 -497366938 2
664758677 345537889 2
-631188522 -421590323 2
916801468 87978323 2
-392373838 89334600 1
993337752 798186512 2
-6...

output:

3

result:

ok single line: '3'

Test #15:

score: 0
Accepted
time: 88ms
memory: 38512kb

input:

200000
624731001 -756312895 732418025
-723028405 454048115 884229821
657008140 -126241037 451702065
-299325474 365545215 62086888
694524222 901018738 927667060
-806668501 548329101 564050553
162465309 -226915270 370979883
357761925 4184566 129493846
718751910 -547636756 397742261
-413240751 -9747541...

output:

31001

result:

ok single line: '31001'

Test #16:

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

input:

1
0 0 1

output:

-1

result:

ok single line: '-1'

Test #17:

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

input:

1
1 0 2

output:

-1

result:

ok single line: '-1'

Test #18:

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

input:

1
0 -1 463167712

output:

-1

result:

ok single line: '-1'

Test #19:

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

input:

1
0 -2 1

output:

-1

result:

ok single line: '-1'

Test #20:

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

input:

1
0 -1 2

output:

-1

result:

ok single line: '-1'

Test #21:

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

input:

1
1 0 918809706

output:

-1

result:

ok single line: '-1'

Test #22:

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

input:

1
0 -1 1

output:

-1

result:

ok single line: '-1'

Test #23:

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

input:

1
3 1 1

output:

-1

result:

ok single line: '-1'

Test #24:

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

input:

1
-3 3 104127434

output:

-1

result:

ok single line: '-1'

Test #25:

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

input:

1
-8 5 1

output:

-1

result:

ok single line: '-1'

Test #26:

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

input:

1
5 -9 2

output:

-1

result:

ok single line: '-1'

Test #27:

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

input:

1
-7 7 716743621

output:

-1

result:

ok single line: '-1'

Test #28:

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

input:

1
357462890 848080022 1

output:

-1

result:

ok single line: '-1'

Test #29:

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

input:

1
887520827 -701989688 2

output:

-1

result:

ok single line: '-1'

Test #30:

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

input:

1
-170868300 -940219117 849841157

output:

-1

result:

ok single line: '-1'

Test #31:

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

input:

2
1 0 1
1 0 1

output:

-1

result:

ok single line: '-1'

Test #32:

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

input:

2
-1 -1 2
0 1 2

output:

-1

result:

ok single line: '-1'

Test #33:

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

input:

2
0 0 913090376
-1 -1 541928148

output:

-1

result:

ok single line: '-1'

Test #34:

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

input:

2
-2 1 1
-1 -1 1

output:

-1

result:

ok single line: '-1'

Test #35:

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

input:

2
2 -2 2
2 0 1

output:

-1

result:

ok single line: '-1'

Test #36:

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

input:

2
0 -1 705463868
-2 1 130111370

output:

-1

result:

ok single line: '-1'

Test #37:

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

input:

2
0 -3 1
-3 2 1

output:

-1

result:

ok single line: '-1'

Test #38:

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

input:

2
-3 2 1
3 -2 1

output:

-1

result:

ok single line: '-1'

Test #39:

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

input:

2
2 2 122302093
-2 -2 828026820

output:

-1

result:

ok single line: '-1'

Test #40:

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

input:

2
-5 10 1
-5 2 1

output:

-1

result:

ok single line: '-1'

Test #41:

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

input:

2
1 -5 2
9 5 1

output:

-1

result:

ok single line: '-1'

Test #42:

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

input:

2
-10 -5 31542690
-5 3 129473093

output:

-1

result:

ok single line: '-1'

Test #43:

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

input:

2
266809570 381130972 1
-890632596 454834668 1

output:

-1

result:

ok single line: '-1'

Test #44:

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

input:

2
236002924 544226705 1
-8930666 633728962 1

output:

-1

result:

ok single line: '-1'

Test #45:

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

input:

2
-997831104 237273816 438836317
-754753844 -855592460 577498221

output:

-1

result:

ok single line: '-1'

Test #46:

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

input:

3
1 -1 1
-1 -1 1
0 1 1

output:

3

result:

ok single line: '3'

Test #47:

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

input:

3
0 1 1
0 0 1
1 -1 2

output:

-1

result:

ok single line: '-1'

Test #48:

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

input:

3
1 1 364170638
0 1 112013377
-1 0 644196224

output:

-1

result:

ok single line: '-1'

Test #49:

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

input:

3
2 -1 1
2 0 1
1 -2 1

output:

-1

result:

ok single line: '-1'

Test #50:

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

input:

3
-2 -1 2
1 -2 2
-2 0 2

output:

-1

result:

ok single line: '-1'

Test #51:

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

input:

3
1 -1 367635035
0 -1 501995671
1 0 122350696

output:

-1

result:

ok single line: '-1'

Test #52:

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

input:

3
3 3 1
-3 -2 1
3 2 1

output:

-1

result:

ok single line: '-1'

Test #53:

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

input:

3
-1 -2 2
-1 0 2
1 3 1

output:

-1

result:

ok single line: '-1'

Test #54:

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

input:

3
2 -1 871260078
0 0 48868055
-2 3 678301346

output:

-1

result:

ok single line: '-1'

Test #55:

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

input:

3
-6 -4 1
-9 -3 1
2 -7 1

output:

-1

result:

ok single line: '-1'

Test #56:

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

input:

3
-4 9 1
-2 -5 1
-10 -5 1

output:

-1

result:

ok single line: '-1'

Test #57:

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

input:

3
-7 -7 869722287
3 4 494803269
1 -1 992571956

output:

2357097512

result:

ok single line: '2357097512'

Test #58:

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

input:

3
-289202947 -933105008 1
854736853 695493895 1
-839793012 321062172 1

output:

3

result:

ok single line: '3'

Test #59:

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

input:

3
-997919395 -44651903 2
-575930672 881718329 1
10157454 -725678725 2

output:

-1

result:

ok single line: '-1'

Test #60:

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

input:

3
-153974995 -733280733 18571221
-700358990 851291676 383127291
-97978411 -351707387 499070162

output:

-1

result:

ok single line: '-1'

Test #61:

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

input:

4
1 0 1
1 1 1
-1 1 1
0 0 1

output:

-1

result:

ok single line: '-1'

Test #62:

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

input:

4
1 -1 1
0 1 1
0 -1 1
1 1 2

output:

-1

result:

ok single line: '-1'

Test #63:

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

input:

4
1 0 424912797
1 1 20014826
-1 1 236445860
-1 0 945826160

output:

-1

result:

ok single line: '-1'

Test #64:

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

input:

4
0 -1 1
0 2 1
-1 -1 1
2 1 1

output:

3

result:

ok single line: '3'

Test #65:

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

input:

4
-2 2 2
1 1 2
0 0 2
1 1 1

output:

-1

result:

ok single line: '-1'

Test #66:

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

input:

4
-1 0 876759264
2 -1 829927108
1 0 639182840
2 -1 873348938

output:

-1

result:

ok single line: '-1'

Test #67:

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

input:

4
-1 3 1
0 -3 1
0 0 1
-2 0 1

output:

-1

result:

ok single line: '-1'

Test #68:

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

input:

4
2 3 2
3 2 1
-3 -2 1
0 -2 2

output:

5

result:

ok single line: '5'

Test #69:

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

input:

4
-1 1 479709005
0 0 629128474
-1 -2 401828193
1 -3 859823602

output:

-1

result:

ok single line: '-1'

Test #70:

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

input:

4
-10 3 1
5 3 1
-8 -4 1
-4 4 1

output:

-1

result:

ok single line: '-1'

Test #71:

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

input:

4
8 10 2
9 7 2
8 -7 2
-8 3 2

output:

6

result:

ok single line: '6'

Test #72:

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

input:

4
-9 -10 981747466
-2 5 628608354
-6 -3 507929909
3 -5 357833106

output:

1494371369

result:

ok single line: '1494371369'

Test #73:

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

input:

4
40409828 -930958911 1
-306359436 -568724956 1
-381156596 909241901 1
-515918651 -353432539 1

output:

-1

result:

ok single line: '-1'

Test #74:

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

input:

4
57108381 -484752235 2
-669727261 -84683717 1
-753877938 -825438490 2
-542675079 289658193 2

output:

-1

result:

ok single line: '-1'

Test #75:

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

input:

4
137296340 112516375 713084296
-848344371 240288422 940588554
161989482 -447300590 247982323
-190935573 -60214699 103730734

output:

1064797353

result:

ok single line: '1064797353'

Test #76:

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

input:

5
0 -1 1
-1 1 1
-1 -1 1
0 -1 1
0 0 1

output:

-1

result:

ok single line: '-1'

Test #77:

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

input:

5
0 0 1
0 1 2
1 1 2
0 -1 1
1 0 2

output:

-1

result:

ok single line: '-1'

Test #78:

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

input:

5
1 1 909578372
-1 -1 797960423
0 0 919126291
-1 -1 984885911
0 0 467926433

output:

-1

result:

ok single line: '-1'

Test #79:

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

input:

5
2 0 1
2 -1 1
2 0 1
1 -1 1
-2 -2 1

output:

-1

result:

ok single line: '-1'

Test #80:

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

input:

5
-2 -1 2
2 -1 2
0 0 1
-2 -2 1
0 2 2

output:

5

result:

ok single line: '5'

Test #81:

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

input:

5
-2 -2 319653153
0 -1 872033505
2 1 383729842
-2 -2 17774667
-1 0 165152683

output:

566657192

result:

ok single line: '566657192'

Test #82:

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

input:

5
1 0 1
0 2 1
-3 -3 1
-1 1 1
0 2 1

output:

3

result:

ok single line: '3'

Test #83:

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

input:

5
2 0 1
1 -1 2
2 -3 1
2 0 2
-2 2 2

output:

4

result:

ok single line: '4'

Test #84:

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

input:

5
0 -2 711372153
2 -3 347595781
1 0 677079331
-2 3 848024951
1 1 178959083

output:

1738356187

result:

ok single line: '1738356187'

Test #85:

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

input:

5
-8 2 1
3 -9 1
3 -9 1
8 -9 1
-2 9 1

output:

3

result:

ok single line: '3'

Test #86:

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

input:

5
9 -6 2
2 5 2
1 5 2
3 -1 1
-2 8 1

output:

-1

result:

ok single line: '-1'

Test #87:

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

input:

5
-1 -8 571622347
-9 7 961921376
3 -9 609024960
-5 4 431471558
10 -1 739516883

output:

1742610788

result:

ok single line: '1742610788'

Test #88:

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

input:

5
241093338 761753689 1
-219177331 443645520 1
-739588414 -501966547 1
207658970 81022336 1
-91883013 679905226 1

output:

3

result:

ok single line: '3'

Test #89:

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

input:

5
19632632 658860759 2
877417220 -905289388 1
-855267998 214883245 1
-3901737 559283581 2
-17163160 512580778 1

output:

3

result:

ok single line: '3'

Test #90:

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

input:

5
509963035 -856536742 441345314
959711404 -4160027 589498865
-793188395 775088773 18649416
12978049 631750823 723999149
2585751 -382304178 609044806

output:

1049493595

result:

ok single line: '1049493595'

Test #91:

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

input:

6
-1 -1 1
-1 -1 1
-1 0 1
1 -1 1
1 0 1
0 1 1

output:

3

result:

ok single line: '3'

Test #92:

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

input:

6
0 0 1
0 -1 2
-1 -1 2
1 1 2
1 -1 1
0 1 2

output:

5

result:

ok single line: '5'

Test #93:

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

input:

6
0 -1 764268751
0 -1 129079919
1 1 380199209
0 1 256579616
1 -1 490977212
1 0 662123675

output:

-1

result:

ok single line: '-1'

Test #94:

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

input:

6
-2 1 1
-1 0 1
2 2 1
1 -1 1
2 1 1
1 -2 1

output:

3

result:

ok single line: '3'

Test #95:

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

input:

6
2 1 2
-1 2 2
2 1 2
0 0 1
-1 0 2
2 2 1

output:

-1

result:

ok single line: '-1'

Test #96:

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

input:

6
0 -1 881987471
2 -2 783402192
1 -2 810766466
-2 0 138592311
-2 -1 922394100
2 -2 50644647

output:

-1

result:

ok single line: '-1'

Test #97:

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

input:

6
-3 -3 1
-3 3 1
1 1 1
2 3 1
0 2 1
-3 -3 1

output:

-1

result:

ok single line: '-1'

Test #98:

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

input:

6
-2 1 1
-3 2 2
0 0 1
2 2 1
1 -3 1
-2 3 2

output:

3

result:

ok single line: '3'

Test #99:

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

input:

6
1 2 308964686
-3 3 539845608
0 2 428873525
-2 -2 559765548
-1 -1 230919598
1 1 579221044

output:

-1

result:

ok single line: '-1'

Test #100:

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

input:

6
4 -10 1
2 -10 1
-4 -10 1
-4 -7 1
10 -3 1
-1 8 1

output:

3

result:

ok single line: '3'

Test #101:

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

input:

6
-10 -10 2
8 4 2
5 5 2
-6 3 1
-4 -10 2
-1 -4 2

output:

5

result:

ok single line: '5'

Test #102:

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

input:

6
10 3 358045696
3 6 690825516
-4 7 34937545
-10 7 780224907
4 -10 112724666
-3 3 36700085

output:

505707907

result:

ok single line: '505707907'

Test #103:

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

input:

6
631629425 846478667 1
-38551900 620286355 1
-212085538 377796842 1
-556455437 -564322785 1
-372351569 -224033061 1
-793464907 457684656 1

output:

-1

result:

ok single line: '-1'

Test #104:

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

input:

6
734737825 -194536234 1
850360651 161538691 2
406589698 -457745554 2
840721672 109116201 1
-329569741 94200402 1
-186533965 393325015 2

output:

4

result:

ok single line: '4'

Test #105:

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

input:

6
910571417 -792067175 309531353
658887 714765192 377241199
-548462164 777244559 929591595
-65121734 301037581 507959808
28494698 -388896274 388857123
-872526474 -756310299 25205020

output:

711977572

result:

ok single line: '711977572'

Test #106:

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

input:

7
1 1 1
-1 0 1
-1 0 1
0 0 1
1 0 1
1 0 1
-1 0 1

output:

-1

result:

ok single line: '-1'

Test #107:

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

input:

7
0 -1 1
0 0 1
0 0 2
0 0 1
-1 -1 2
-1 1 2
1 -1 2

output:

-1

result:

ok single line: '-1'

Test #108:

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

input:

7
-1 -1 126734705
1 0 456838175
1 0 604936582
0 1 353268033
1 0 193350950
1 -1 386750602
1 -1 794864868

output:

673353688

result:

ok single line: '673353688'

Test #109:

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

input:

7
-2 -2 1
1 -2 1
-2 2 1
-1 -2 1
2 -2 1
2 0 1
2 1 1

output:

3

result:

ok single line: '3'

Test #110:

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

input:

7
0 -1 1
2 -2 2
2 -2 1
-1 -2 1
-2 0 1
2 0 2
2 -1 2

output:

-1

result:

ok single line: '-1'

Test #111:

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

input:

7
0 -2 248752882
-1 -2 809054551
-2 -1 63768205
2 0 695280890
1 1 323099724
2 -1 79193533
-1 -2 27856316

output:

414724245

result:

ok single line: '414724245'

Test #112:

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

input:

7
3 1 1
-2 2 1
2 -1 1
2 -2 1
3 -1 1
-1 3 1
-1 3 1

output:

-1

result:

ok single line: '-1'

Test #113:

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

input:

7
2 -3 1
-3 -3 1
2 2 1
2 0 2
-2 2 1
-1 1 1
-3 -2 2

output:

3

result:

ok single line: '3'

Test #114:

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

input:

7
-1 3 376526364
0 -1 939812591
-1 -3 364426462
3 0 415248420
-3 -3 294272091
3 0 584853925
3 2 380662756

output:

1051461211

result:

ok single line: '1051461211'

Test #115:

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

input:

7
-6 1 1
8 0 1
-3 -7 1
4 -7 1
-6 1 1
-3 9 1
2 1 1

output:

3

result:

ok single line: '3'

Test #116:

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

input:

7
-4 6 2
5 0 2
7 -1 1
9 6 2
-6 10 2
6 -2 1
-9 1 2

output:

5

result:

ok single line: '5'

Test #117:

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

input:

7
-2 8 621165465
-8 -3 329988587
1 3 982256096
0 -6 33073065
-2 -7 722144131
-2 4 882874592
-4 6 382922701

output:

1345317748

result:

ok single line: '1345317748'

Test #118:

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

input:

7
180990270 115505587 1
-700613575 -812184477 1
705538957 -326173259 1
-917835754 780520450 1
922204369 -485230436 1
273925737 -152489135 1
-104309396 60308019 1

output:

3

result:

ok single line: '3'

Test #119:

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

input:

7
-417588433 671860276 2
-19532823 -482328001 1
-294288879 201981051 1
38614869 -253378476 1
-815684198 -849534525 1
-477235959 -809328416 2
-855164265 -342810819 1

output:

-1

result:

ok single line: '-1'

Test #120:

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

input:

7
171235563 -948584388 601763028
-961365148 509806420 507150356
369593500 449286028 293562123
435509367 538687357 12309779
215511899 582018059 850138139
806193922 -825507684 855522044
-266279026 -326323559 697946324

output:

1003818226

result:

ok single line: '1003818226'

Test #121:

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

input:

8
-1 1 1
-1 1 1
0 1 1
0 0 1
0 -1 1
1 -1 1
1 1 1
0 1 1

output:

3

result:

ok single line: '3'

Test #122:

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

input:

8
1 -1 2
-1 1 2
-1 -1 1
0 1 1
-1 1 1
1 -1 1
-1 0 2
-1 -1 1

output:

3

result:

ok single line: '3'

Test #123:

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

input:

8
1 0 856195455
1 0 321301749
-1 1 347202904
1 1 909283093
1 -1 737079937
-1 -1 333038120
-1 1 289220133
0 0 301678131

output:

943560002

result:

ok single line: '943560002'

Test #124:

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

input:

8
2 2 1
-2 0 1
-1 2 1
1 2 1
0 -2 1
0 2 1
0 -2 1
2 -2 1

output:

3

result:

ok single line: '3'

Test #125:

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

input:

8
-2 1 2
1 1 2
-2 2 1
-2 0 2
0 1 1
1 2 1
-2 0 1
1 1 2

output:

-1

result:

ok single line: '-1'

Test #126:

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

input:

8
2 0 403644331
-2 2 948454220
0 0 720705070
0 1 365120179
1 1 492394743
-1 -1 256547471
-2 1 490158565
-1 -1 783865342

output:

1025311981

result:

ok single line: '1025311981'

Test #127:

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

input:

8
-2 1 1
2 0 1
3 -1 1
1 -1 1
3 -2 1
-1 3 1
3 3 1
3 2 1

output:

3

result:

ok single line: '3'

Test #128:

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

input:

8
-3 -1 1
0 0 1
0 -3 1
-2 -3 2
-2 -2 2
1 0 1
-3 1 2
-1 1 1

output:

3

result:

ok single line: '3'

Test #129:

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

input:

8
-3 1 536806767
0 2 482676744
-1 0 810123600
-1 1 487744202
1 -2 947243048
-3 -1 300668782
-2 2 622754152
-3 1 52837387

output:

1482757179

result:

ok single line: '1482757179'

Test #130:

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

input:

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

output:

3

result:

ok single line: '3'

Test #131:

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

input:

8
-9 1 1
7 -2 1
1 9 1
-5 1 2
-2 5 1
-5 8 2
-8 -6 2
7 -6 2

output:

3

result:

ok single line: '3'

Test #132:

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

input:

8
-1 -9 258849710
-3 -8 274950904
8 4 631872025
10 -1 346678754
-4 4 260599909
7 -6 491290245
-4 0 584601719
2 4 52479951

output:

571929570

result:

ok single line: '571929570'

Test #133:

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

input:

8
-296513607 -36356257 1
-946458951 827127709 1
-454941692 -647198667 1
650665895 251330036 1
520501640 -75369357 1
-524803122 -101266475 1
-710669740 942989346 1
-275931781 314903242 1

output:

3

result:

ok single line: '3'

Test #134:

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

input:

8
501150275 -82771389 2
300720855 910296012 1
-837725073 84644636 2
-209927997 702035419 2
-817487020 -429373496 2
38773867 -260683439 2
-355079479 79732475 2
624700094 186259454 1

output:

4

result:

ok single line: '4'

Test #135:

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

input:

8
-513892242 -178835815 86121451
135791905 492925177 320745354
338024641 766819910 391592579
879718185 -546846271 888476193
462004729 -544291904 538231969
321953102 -42325323 920462130
658862216 501309828 326967677
988194778 368385603 648512611

output:

945098774

result:

ok single line: '945098774'

Test #136:

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

input:

9
-1 1 1
1 1 1
1 0 1
0 1 1
-1 1 1
-1 -1 1
0 -1 1
1 1 1
-1 0 1

output:

3

result:

ok single line: '3'

Test #137:

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

input:

9
1 1 2
0 -1 1
0 0 1
-1 -1 1
0 0 2
-1 1 2
1 -1 2
0 0 1
0 -1 1

output:

5

result:

ok single line: '5'

Test #138:

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

input:

9
-1 -1 325988137
-1 0 164678477
0 -1 76477551
-1 1 744260723
-1 0 314219908
-1 -1 659875452
-1 0 942901618
1 0 942657371
0 1 481545275

output:

1665358674

result:

ok single line: '1665358674'

Test #139:

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

input:

9
-2 0 1
-2 2 1
1 2 1
1 2 1
0 1 1
1 -1 1
2 1 1
0 -2 1
1 2 1

output:

3

result:

ok single line: '3'

Test #140:

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

input:

9
-1 -2 2
0 1 2
2 2 1
-1 1 1
-1 2 2
1 -1 1
-1 0 1
0 2 2
2 2 1

output:

3

result:

ok single line: '3'

Test #141:

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

input:

9
-2 -1 479941863
0 0 742156344
0 -1 232567920
1 1 913764783
-1 2 954398268
-2 -2 829752908
0 0 970668331
2 0 18343575
0 2 83869371

output:

582154809

result:

ok single line: '582154809'

Test #142:

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

input:

9
1 1 1
-3 -1 1
0 -2 1
-1 -1 1
-1 1 1
-3 -3 1
3 -3 1
2 2 1
2 -1 1

output:

3

result:

ok single line: '3'

Test #143:

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

input:

9
0 -2 2
3 -2 2
0 0 2
-3 1 1
3 3 2
0 -2 2
1 2 1
3 3 2
-3 1 1

output:

4

result:

ok single line: '4'

Test #144:

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

input:

9
-2 0 638345532
-2 2 652036986
2 -2 523001057
2 1 781144607
-1 -2 137801412
0 3 279106481
1 -3 252601279
-2 -1 40004719
-2 -1 116655824

output:

571712479

result:

ok single line: '571712479'

Test #145:

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

input:

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

output:

3

result:

ok single line: '3'

Test #146:

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

input:

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

output:

4

result:

ok single line: '4'

Test #147:

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

input:

9
-9 -1 970686602
3 -10 492786358
-4 -5 19520470
5 4 966132333
-8 -9 444450780
-8 -1 648645523
-3 -9 634663450
6 4 184915309
1 -9 48327650

output:

853081302

result:

ok single line: '853081302'

Test #148:

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

input:

9
-95168449 713874523 1
515358289 -458300819 1
-544906661 188627322 1
-432769366 -184657522 1
599406366 576260621 1
-643517633 446293161 1
329298806 611076571 1
78629415 957630505 1
870803436 -221479498 1

output:

3

result:

ok single line: '3'

Test #149:

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

input:

9
-156608366 -22366059 2
-879870094 4468233 2
109874410 877806337 1
-596045931 484880657 2
225417477 282986075 2
-757884453 367068538 2
-313568005 321266033 1
-630158997 209282111 1
-695629642 15292531 1

output:

-1

result:

ok single line: '-1'

Test #150:

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

input:

9
-219006262 -950871210 860845130
71630343 538522894 282198416
480257618 -271726780 228075128
-859497876 457390370 768839238
374608019 50211708 855527759
326090115 824099159 170844423
349925585 49058713 338599177
634257528 -987980195 30519672
-213209613 -250594508 830484940

output:

970203333

result:

ok single line: '970203333'

Test #151:

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

input:

10
-1 1 1
0 1 1
0 -1 1
0 0 1
0 0 1
1 -1 1
-1 1 1
0 1 1
1 0 1
-1 0 1

output:

3

result:

ok single line: '3'

Test #152:

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

input:

10
0 -1 2
0 1 1
-1 -1 1
-1 0 2
-1 0 2
0 0 1
-1 -1 2
0 1 1
1 -1 1
0 1 1

output:

3

result:

ok single line: '3'

Test #153:

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

input:

10
0 0 430215529
1 -1 86508049
-1 1 824978512
1 0 928401251
0 0 663611159
-1 -1 951994205
-1 1 563308741
1 0 844786305
-1 -1 273660414
-1 1 187306241

output:

1305752960

result:

ok single line: '1305752960'

Test #154:

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

input:

10
-2 -1 1
2 -2 1
1 1 1
-2 -2 1
1 1 1
1 2 1
0 1 1
2 2 1
0 2 1
-1 2 1

output:

3

result:

ok single line: '3'

Test #155:

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

input:

10
1 2 1
-1 -1 1
-1 0 2
0 0 2
0 -1 2
0 -1 1
-1 0 2
-1 -2 1
-2 0 2
-2 -1 1

output:

3

result:

ok single line: '3'

Test #156:

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

input:

10
2 -1 594835698
2 -2 482214447
-2 -2 812143071
1 0 276115024
2 2 924686904
1 1 812777111
-1 -2 823025374
0 -1 554290571
2 1 505489217
0 0 946546378

output:

-1

result:

ok single line: '-1'

Test #157:

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

input:

10
-1 1 1
1 1 1
0 0 1
-3 -1 1
3 -2 1
3 -1 1
2 2 1
0 1 1
-3 3 1
-1 1 1

output:

3

result:

ok single line: '3'

Test #158:

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

input:

10
0 2 2
-3 -3 1
3 -1 2
1 -3 2
1 1 2
-2 0 1
-3 1 1
3 3 2
3 2 2
2 1 1

output:

3

result:

ok single line: '3'

Test #159:

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

input:

10
3 -2 442510282
-3 1 292017520
3 -3 198813566
-1 -3 516987589
3 2 817380568
-1 2 279370749
3 2 480476960
2 1 72909767
2 -3 723582915
-1 0 204694244

output:

476417577

result:

ok single line: '476417577'

Test #160:

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

input:

10
7 -7 1
-8 10 1
1 5 1
5 3 1
3 -8 1
0 5 1
2 2 1
-2 -1 1
0 9 1
-3 -6 1

output:

3

result:

ok single line: '3'

Test #161:

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

input:

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

output:

4

result:

ok single line: '4'

Test #162:

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

input:

10
-8 8 486752258
8 8 831916972
7 10 951227401
-8 -6 225956882
5 -2 723980943
-10 8 975950523
-4 3 267000627
2 0 987518712
7 -6 222663145
3 -10 342386898

output:

935372285

result:

ok single line: '935372285'

Test #163:

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

input:

10
-612186542 -370572416 1
-453694885 302455107 1
254656715 315792908 1
-141190663 -836809528 1
-960345352 491483066 1
-118198086 656019305 1
-232618431 716336160 1
-611851837 963796662 1
526529961 -933918543 1
738071614 -916264010 1

output:

3

result:

ok single line: '3'

Test #164:

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

input:

10
-479210245 724912705 1
513056145 -952262855 2
858830088 -469318059 2
-391105259 431384860 2
-227852486 -799024491 2
-730954900 -733943671 2
-102477564 852288412 1
387414957 633257958 1
-568682576 465074950 1
176964030 250521542 1

output:

4

result:

ok single line: '4'

Test #165:

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

input:

10
-761346368 606901351 173408615
340888476 696158702 363808656
208293784 683782 398984614
15235166 -830495835 497966967
822622097 390874775 635582575
982297785 -4746618 820588710
-836329 31025498 242024708
262467482 -487015966 954440688
913996650 -979773986 257978321
31963768 253882979 239511840

output:

670898776

result:

ok single line: '670898776'

Test #166:

score: 0
Accepted
time: 114ms
memory: 38372kb

input:

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

output:

1000000002

result:

ok single line: '1000000002'

Test #167:

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

input:

4
1000000000 -999999999 1
-999999999 1 1
-1000000000 2 1
1000000000 3 1

output:

3

result:

ok single line: '3'

Test #168:

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

input:

200000
1 0 999999999
1 1 1000000000
1 -1 1000000000
-1 0 1000000000
1 0 999999999
1 1 1000000000
1 -1 1000000000
-1 0 1000000000
1 0 999999999
1 1 1000000000
1 -1 1000000000
-1 0 1000000000
1 0 999999999
1 1 1000000000
1 -1 1000000000
-1 0 1000000000
1 0 999999999
1 1 1000000000
1 -1 1000000000
-1 0...

output:

3000000000

result:

ok single line: '3000000000'

Test #169:

score: 0
Accepted
time: 94ms
memory: 38556kb

input:

200000
1000000000 -100000 1000000000
1000000000 -99999 1000000000
1000000000 -99998 1000000000
1000000000 -99997 1000000000
1000000000 -99996 1000000000
1000000000 -99995 1000000000
1000000000 -99994 1000000000
1000000000 -99993 1000000000
1000000000 -99992 1000000000
1000000000 -99991 1000000000
10...

output:

3000000000

result:

ok single line: '3000000000'

Test #170:

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

input:

6
2 0 1
1 2 3
-1 2 2
-2 0 4
-1 -2 100
1 -2 5

output:

12

result:

ok single line: '12'

Test #171:

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

input:

7
0 3 1
0 3 2
1 -1 2
0 0 1
-2 4 1
-4 0 1
2 1 2

output:

4

result:

ok single line: '4'

Test #172:

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

input:

2
1 2 3
4 5 6

output:

-1

result:

ok single line: '-1'