QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#35860#1881. Roads of the EmpireZhaoZiLongWA 8ms3848kbC++17712b2022-06-20 10:39:552022-06-20 10:39:57

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3756kb

input:

4
5 1 2
8 2 5
7 7 2
6 2 5

output:

1
1
-1
2

result:

ok 4 number(s): "1 1 -1 2"

Test #2:

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

input:

1
88 14 2

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

input:

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

output:

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

result:

ok 20 numbers

Test #4:

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

input:

2000
8 2 7
2 2 1
64 37 21
77 30 25
84 39 62
3 3 1
34 15 32
62 41 60
99 8 96
22 9 17
89 1 19
26 6 15
26 14 25
22 15 17
99 99 30
89 41 29
52 16 38
95 58 69
31 23 10
65 24 21
67 25 7
79 3 65
62 30 20
90 75 62
62 14 56
55 38 50
4 1 3
76 18 59
58 34 5
61 21 13
98 34 89
38 33 16
83 29 46
46 6 5
28 25 8
46...

output:

-1
-1
-1
4
-1
-1
8
13
-1
5
2
2
7
4
-1
8
5
-1
9
-1
4
8
8
-1
3
-1
-1
4
3
4
6
3
5
3
4
-1
3
-1
-1
6
-1
-1
1
4
4
-1
-1
1
-1
0
4
7
-1
6
-1
3
-1
-1
-1
6
-1
-1
-1
-1
-1
4
2
5
-1
4
9
4
3
4
3
2
5
1
7
-1
10
-1
-1
-1
4
0
-1
-1
5
-1
-1
6
5
1
3
-1
0
8
11
2
-1
0
-1
12
-1
-1
5
6
0
-1
-1
1
8
0
-1
-1
2
6
0
5
-1
11
2
...

result:

ok 2000 numbers

Test #5:

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

input:

2000
41 34 1
96 31 46
63 47 55
57 48 48
40 26 20
13 11 11
100 85 67
97 34 80
98 48 23
56 20 56
25 15 10
6 1 5
82 22 82
99 37 28
69 10 14
90 29 77
10 8 3
99 3 57
93 42 32
78 73 66
53 7 30
5 5 4
10 8 9
72 68 14
12 2 5
95 21 70
95 63 57
73 53 8
60 4 28
58 14 11
81 16 41
77 2 1
81 67 51
76 72 60
86 1 10...

output:

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

result:

ok 2000 numbers

Test #6:

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

input:

100
1000000000000000000 598516350819009339 542438584254998413
1000000000000000000 109838532021251582 379790121599700364
1000000000000000000 368467904350174727 837836655562279882
1000000000000000000 384947108507418205 746463050934324258
1000000000000000000 915458376254369143 144866558378401506
100000...

output:

-1
-1
-1
-1
-1
-1
-1
40
-1
-1
-1
35
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
44
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
49
-1
38
-1
-1
-1
-1
-1
-1
39
-1
-1
-1
-1
-1
-1
-1
-1
45
-1
-1
-1
-1
-1
-1
-1
-1
43
-1
-1
-1
47
-1
-1
-1
-1
-1
-1
-1
-1
44
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 100 numbers

Test #7:

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

input:

10
1048542 482154 861514
1048576 173379 221961
1048553 1010572 492127
1048546 783961 145631
1048554 415111 834632
1048530 481123 85225
1048525 1030012 643596
1048514 123116 470946
1048517 306849 999653
1048569 675655 118546

output:

27
17
-1
39
16
15
20
20
34
21

result:

ok 10 numbers

Test #8:

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

input:

10
1048565 409750 195091
1048531 809674 908605
1048516 108712 434707
1048509 34483 602464
1048548 134635 597102
1048556 190949 789193
1048523 932405 138003
1048509 5037 951088
1048564 67954 767070
1048500 131775 282607

output:

-1
25
21
-1
13
24
-1
13
-1
-1

result:

ok 10 numbers

Test #9:

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

input:

1000
231820 38198 137549
527971 283885 328727
417401 283448 307118
968014 443531 641351
412666 141654 393231
917969 319656 603656
423656 340598 226803
608158 369744 80085
402359 322007 101459
952415 707 522903
46712 22624 13121
464263 146534 416536
905743 626978 728064
692410 268960 461126
752817 14...

output:

21
23
25
17
-1
26
20
-1
15
15
16
17
-1
21
16
-1
22
21
31
10
-1
15
21
12
20
-1
21
18
24
-1
18
26
14
-1
-1
24
-1
-1
21
16
-1
24
14
9
19
23
18
21
-1
-1
23
28
-1
13
17
15
21
21
16
-1
-1
15
21
16
-1
15
-1
17
-1
17
-1
-1
14
15
27
25
-1
24
16
12
11
-1
21
5
-1
16
-1
-1
20
18
20
24
-1
25
15
16
-1
-1
16
17
-1...

result:

ok 1000 numbers

Test #10:

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

input:

1000
675447 224808 204909
810871 716096 725074
389783 111938 246958
366893 282725 273738
298804 156838 230945
128723 107951 121199
494288 77417 139728
529214 308172 333374
678715 361128 528604
274918 54596 163598
915213 894799 498885
977922 613679 516887
874146 317225 434868
314021 93559 62085
48501...

output:

25
32
22
32
11
18
15
-1
21
-1
-1
-1
24
24
18
22
14
-1
26
19
12
19
19
21
-1
-1
-1
-1
20
14
43
17
12
24
-1
-1
23
28
-1
-1
-1
-1
12
14
-1
21
-1
8
-1
19
-1
9
-1
23
15
-1
27
16
-1
16
-1
-1
-1
-1
-1
20
-1
17
17
18
-1
-1
23
-1
21
24
25
14
-1
13
19
-1
32
14
-1
24
25
28
-1
-1
21
7
18
-1
-1
13
-1
31
22
24
-1
...

result:

ok 1000 numbers

Test #11:

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

input:

1000
114589 90676 69788
110292 59797 100350
503698 350481 258655
277851 19804 132976
702498 401745 638524
203134 6826 136077
534458 216619 279289
220596 101850 154920
661632 213782 467181
93894 54330 19442
643862 182800 429416
609323 603706 499990
699858 657620 378150
377577 52753 290537
868924 5932...

output:

-1
-1
-1
24
18
15
20
12
-1
17
-1
-1
-1
-1
20
19
20
25
26
22
19
13
-1
-1
17
20
-1
32
11
-1
-1
15
22
19
36
24
10
21
14
-1
25
16
35
-1
17
-1
-1
18
-1
9
14
-1
24
19
20
18
11
19
17
17
23
30
-1
-1
-1
28
14
15
21
21
22
15
18
15
17
14
25
21
27
14
-1
10
24
26
-1
-1
21
22
25
-1
21
18
19
17
20
-1
-1
27
15
-1
2...

result:

ok 1000 numbers

Test #12:

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

input:

1000
311335 217168 239175
396302 263676 352057
453862 81994 355876
694523 259578 37436
654802 343762 544251
708293 391752 517999
359424 96780 312587
459524 452926 180504
131954 21300 20738
637329 99770 285668
495184 4843 396581
338214 264310 225093
297258 184596 202691
466999 373259 248910
631089 27...

output:

-1
-1
16
27
20
30
-1
23
11
-1
10
23
-1
25
14
20
-1
-1
22
20
-1
-1
23
24
30
-1
-1
12
-1
33
-1
21
23
14
28
11
-1
15
13
29
20
25
-1
18
21
22
25
26
-1
14
12
-1
-1
-1
18
-1
13
-1
-1
19
24
-1
-1
-1
27
11
-1
-1
-1
21
-1
-1
23
19
17
-1
16
12
11
12
16
29
10
17
28
-1
-1
29
18
22
16
24
19
-1
26
24
27
-1
14
-1
...

result:

ok 1000 numbers

Test #13:

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

input:

1000
4696040372734 1744402913926 439511374423
5632529210757 3162117777952 5473055836675
2974896874347 1871184306231 246731637224
7585555864433 3909537418115 5445238043962
4171871503769 4068250202289 3922183921355
2236798025150 741506409673 266356757254
9461302590843 2391994412386 7594766849953
72147...

output:

-1
45
51
46
-1
-1
50
-1
-1
-1
50
53
53
32
-1
-1
47
62
-1
42
53
61
49
58
50
48
61
70
44
59
50
42
49
61
47
51
48
-1
43
33
68
62
54
51
-1
51
43
50
50
44
43
36
45
55
-1
-1
-1
-1
56
41
41
-1
41
52
61
66
68
56
48
37
44
49
47
60
-1
49
46
53
50
50
38
32
-1
-1
57
52
39
51
59
-1
-1
41
-1
53
-1
63
52
38
46
52
...

result:

ok 1000 numbers

Test #14:

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

input:

1000
1470312127616 1323373514034 1318379171497
5476426741266 2305068759036 3280485537006
1454258580644 761927071628 115953218965
4611233645382 4148138858854 2687712723610
9318585569247 3288727703488 1352043612110
56292272649 9316968353 45187976761
247732729358 167027674216 154734713877
1044715795237...

output:

41
52
-1
-1
45
-1
41
43
47
-1
32
-1
53
57
45
45
47
52
59
52
-1
52
46
37
39
44
-1
-1
51
-1
-1
-1
41
50
66
-1
-1
44
-1
-1
55
-1
47
62
-1
54
-1
67
44
71
53
46
57
46
52
37
43
42
63
68
-1
-1
-1
61
-1
47
35
-1
39
-1
54
-1
50
-1
53
54
-1
45
32
61
47
33
-1
64
39
55
35
51
38
-1
47
-1
62
60
-1
48
-1
57
47
65
...

result:

ok 1000 numbers

Test #15:

score: -100
Wrong Answer
time: 8ms
memory: 3764kb

input:

1000
576460752303423444 463797735070352698 264140172914711817
576460752303423454 362322993895798237 516254587697712482
576460752303423418 130935038313106816 206312032672405389
576460752303423445 262489127375858098 381444243925922941
576460752303423450 222076471762947958 224181900682515458
5764607523...

output:

83
87
59
78
57
66
71
40
-1
72
66
83
-1
82
83
84
80
75
-1
-1
83
-1
71
69
-1
85
66
62
69
82
86
-1
-1
-1
-1
81
79
92
75
63
82
-1
73
-1
-1
72
-1
51
-1
75
65
70
81
64
-1
-1
79
74
84
-1
-1
71
-1
65
-1
61
80
-1
81
-1
60
66
-1
76
65
-1
86
81
76
74
72
80
56
-1
63
-1
-1
-1
89
86
-1
68
-1
70
79
72
67
74
59
81
...

result:

wrong answer 9th numbers differ - expected: '94', found: '-1'