QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#84232#5583. Color TubesMaMengQiTL 232ms66012kbJava114.7kb2023-03-06 02:11:182023-03-06 02:11:19

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 145ms
memory: 57020kb

input:

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

output:

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

result:

ok correct

Test #2:

score: 0
Accepted
time: 126ms
memory: 52864kb

input:

1
0 0 0
1 1 1

output:

3
2 1
2 1
2 1

result:

ok correct

Test #3:

score: 0
Accepted
time: 129ms
memory: 53532kb

input:

2
2 1 0
2 1 0
2 1 0

output:

11
1 2
1 3
2 1
2 1
3 2
3 1
2 3
2 3
3 2
3 2
3 2

result:

ok correct

Test #4:

score: 0
Accepted
time: 119ms
memory: 55092kb

input:

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

output:

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

result:

ok correct

Test #5:

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

input:

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

output:

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

result:

ok correct

Test #6:

score: 0
Accepted
time: 113ms
memory: 55316kb

input:

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

output:

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

result:

ok correct

Test #7:

score: 0
Accepted
time: 138ms
memory: 54616kb

input:

6
0 0 0
1 2 3
1 2 3
1 2 3
4 5 6
4 5 6
4 5 6

output:

32
2 1
3 1
4 1
2 3
2 4
5 2
6 2
7 2
3 5
3 6
3 7
5 3
6 3
4 6
4 3
6 4
4 5
4 6
5 4
6 4
7 4
5 6
5 7
6 5
6 5
7 6
7 5
6 7
6 7
7 6
7 6
7 6

result:

ok correct

Test #8:

score: 0
Accepted
time: 153ms
memory: 55084kb

input:

6
0 0 0
1 5 6
1 2 6
1 2 3
4 2 3
4 5 3
4 5 6

output:

36
4 1
5 1
6 1
2 4
2 5
2 6
3 2
4 2
7 2
3 4
3 7
6 3
7 3
4 7
4 6
4 3
6 4
7 4
4 6
4 7
6 4
7 4
5 7
5 4
7 5
5 6
5 7
6 5
6 5
7 6
7 5
6 7
6 7
7 6
7 6
7 6

result:

ok correct

Test #9:

score: 0
Accepted
time: 122ms
memory: 57144kb

input:

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

output:

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

result:

ok correct

Test #10:

score: 0
Accepted
time: 117ms
memory: 54760kb

input:

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

output:

80
1 11
1 11
1 11
7 1
11 1
4 11
4 1
11 4
2 4
2 7
2 11
8 2
11 2
5 11
5 2
11 5
3 5
3 8
3 11
9 3
11 3
6 11
6 3
11 6
4 6
4 9
4 11
10 4
11 4
7 11
7 4
11 7
5 7
5 10
5 11
9 5
11 9
11 5
9 11
8 11
8 9
8 5
9 8
11 8
6 8
6 9
6 11
8 6
11 6
9 8
9 6
8 9
7 8
7 9
7 11
8 7
11 7
10 8
10 7
8 10
8 10
8 11
11 8
11 8
11 8...

result:

ok correct

Test #11:

score: 0
Accepted
time: 143ms
memory: 54420kb

input:

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

output:

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

result:

ok correct

Test #12:

score: 0
Accepted
time: 134ms
memory: 55224kb

input:

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

output:

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

result:

ok correct

Test #13:

score: 0
Accepted
time: 117ms
memory: 54832kb

input:

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

output:

96
1 14
1 14
1 14
9 1
14 1
5 14
5 1
14 5
2 5
2 9
2 14
10 2
14 2
6 14
6 2
14 6
3 6
3 10
3 14
11 3
14 3
7 14
7 3
14 7
4 7
4 11
4 14
12 4
14 4
8 14
8 4
14 8
5 8
5 12
5 14
13 5
14 5
9 14
9 5
14 9
6 9
6 13
6 14
12 6
14 12
14 6
12 14
10 14
10 12
10 6
12 10
14 10
7 10
7 12
7 14
8 7
14 7
11 8
11 7
8 11
8 11...

result:

ok correct

Test #14:

score: 0
Accepted
time: 129ms
memory: 54700kb

input:

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

output:

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

result:

ok correct

Test #15:

score: 0
Accepted
time: 115ms
memory: 53492kb

input:

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

output:

76
1 5
1 6
1 9
3 1
6 1
9 1
2 3
2 6
2 9
4 2
8 2
10 2
3 4
3 8
3 10
7 3
11 3
9 11
9 7
9 3
7 9
11 9
4 7
4 9
4 11
9 4
11 4
6 11
6 9
6 4
9 6
11 6
5 6
5 9
5 11
7 5
11 5
10 7
10 5
7 10
6 7
6 10
6 11
7 6
11 6
10 11
10 7
10 6
7 10
11 10
7 10
7 11
9 7
9 7
11 7
8 9
8 9
8 11
10 8
11 8
10 11
10 8
11 10
9 10
9 10
...

result:

ok correct

Test #16:

score: 0
Accepted
time: 158ms
memory: 55068kb

input:

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

output:

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

result:

ok correct

Test #17:

score: 0
Accepted
time: 133ms
memory: 55044kb

input:

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

output:

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

result:

ok correct

Test #18:

score: 0
Accepted
time: 124ms
memory: 59576kb

input:

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

output:

96
1 2
1 2
1 14
12 1
14 1
4 14
4 1
14 4
2 4
2 12
2 14
4 2
13 2
11 4
11 2
4 11
3 4
3 11
3 13
12 3
12 3
13 3
4 12
4 12
4 13
7 4
13 4
12 7
12 4
7 12
5 7
5 12
5 13
10 5
12 5
14 12
14 5
12 14
6 10
6 12
6 14
7 6
11 6
8 7
8 6
7 8
7 8
7 11
8 7
14 7
14 7
8 14
8 14
10 8
13 8
9 13
9 10
9 8
10 9
13 9
9 10
9 13
...

result:

ok correct

Test #19:

score: 0
Accepted
time: 190ms
memory: 57460kb

input:

99
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
1 2 3
4 5...

output:

568
1 100
1 100
1 100
2 1
35 1
68 1
2 35
2 68
3 2
36 2
69 2
3 36
3 69
4 3
37 3
70 3
4 37
4 70
5 4
38 4
71 4
5 38
5 71
6 5
39 5
72 5
6 39
6 72
7 6
40 6
73 6
7 40
7 73
8 7
41 7
74 7
8 41
8 74
9 8
42 8
75 8
9 42
9 75
10 9
43 9
76 9
10 43
10 76
11 10
44 10
77 10
11 44
11 77
12 11
45 11
78 11
12 45
12 78...

result:

ok correct

Test #20:

score: 0
Accepted
time: 177ms
memory: 57324kb

input:

100
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 1 2
...

output:

827
1 101
1 101
1 101
67 1
101 1
34 101
34 1
101 34
2 34
2 67
2 101
68 2
101 2
35 101
35 2
101 35
3 35
3 68
3 101
69 3
101 3
36 101
36 3
101 36
4 36
4 69
4 101
70 4
101 4
37 101
37 4
101 37
5 37
5 70
5 101
71 5
101 5
38 101
38 5
101 38
6 38
6 71
6 101
72 6
101 6
39 101
39 6
101 39
7 39
7 72
7 101
73...

result:

ok correct

Test #21:

score: 0
Accepted
time: 192ms
memory: 57516kb

input:

101
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

826
1 102
1 102
1 102
34 1
102 1
68 34
68 1
34 68
2 34
2 68
2 102
35 2
102 2
69 35
69 2
35 69
3 35
3 69
3 102
36 3
102 3
70 36
70 3
36 70
4 36
4 70
4 102
37 4
102 4
71 37
71 4
37 71
5 37
5 71
5 102
38 5
102 5
72 38
72 5
38 72
6 38
6 72
6 102
39 6
102 6
73 39
73 6
39 73
7 39
7 73
7 102
40 7
102 7
74 ...

result:

ok correct

Test #22:

score: 0
Accepted
time: 179ms
memory: 57036kb

input:

102
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

585
1 103
1 103
1 103
2 1
36 1
70 1
2 36
2 70
3 2
37 2
71 2
3 37
3 71
4 3
38 3
72 3
4 38
4 72
5 4
39 4
73 4
5 39
5 73
6 5
40 5
74 5
6 40
6 74
7 6
41 6
75 6
7 41
7 75
8 7
42 7
76 7
8 42
8 76
9 8
43 8
77 8
9 43
9 77
10 9
44 9
78 9
10 44
10 78
11 10
45 10
79 10
11 45
11 79
12 11
46 11
80 11
12 46
12 80...

result:

ok correct

Test #23:

score: 0
Accepted
time: 182ms
memory: 58632kb

input:

103
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

850
1 104
1 104
1 104
69 1
104 1
35 104
35 1
104 35
2 35
2 69
2 104
70 2
104 2
36 104
36 2
104 36
3 36
3 70
3 104
71 3
104 3
37 104
37 3
104 37
4 37
4 71
4 104
72 4
104 4
38 104
38 4
104 38
5 38
5 72
5 104
73 5
104 5
39 104
39 5
104 39
6 39
6 73
6 104
74 6
104 6
40 104
40 6
104 40
7 40
7 74
7 104
75...

result:

ok correct

Test #24:

score: 0
Accepted
time: 192ms
memory: 56052kb

input:

104
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

849
1 105
1 105
1 105
35 1
105 1
70 35
70 1
35 70
2 35
2 70
2 105
36 2
105 2
71 36
71 2
36 71
3 36
3 71
3 105
37 3
105 3
72 37
72 3
37 72
4 37
4 72
4 105
38 4
105 4
73 38
73 4
38 73
5 38
5 73
5 105
39 5
105 5
74 39
74 5
39 74
6 39
6 74
6 105
40 6
105 6
75 40
75 6
40 75
7 40
7 75
7 105
41 7
105 7
76 ...

result:

ok correct

Test #25:

score: 0
Accepted
time: 169ms
memory: 58028kb

input:

105
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

602
1 106
1 106
1 106
2 1
37 1
72 1
2 37
2 72
3 2
38 2
73 2
3 38
3 73
4 3
39 3
74 3
4 39
4 74
5 4
40 4
75 4
5 40
5 75
6 5
41 5
76 5
6 41
6 76
7 6
42 6
77 6
7 42
7 77
8 7
43 7
78 7
8 43
8 78
9 8
44 8
79 8
9 44
9 79
10 9
45 9
80 9
10 45
10 80
11 10
46 10
81 10
11 46
11 81
12 11
47 11
82 11
12 47
12 82...

result:

ok correct

Test #26:

score: 0
Accepted
time: 212ms
memory: 57496kb

input:

106
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

877
1 107
1 107
1 107
71 1
107 1
36 107
36 1
107 36
2 36
2 71
2 107
72 2
107 2
37 107
37 2
107 37
3 37
3 72
3 107
73 3
107 3
38 107
38 3
107 38
4 38
4 73
4 107
74 4
107 4
39 107
39 4
107 39
5 39
5 74
5 107
75 5
107 5
40 107
40 5
107 40
6 40
6 75
6 107
76 6
107 6
41 107
41 6
107 41
7 41
7 76
7 107
77...

result:

ok correct

Test #27:

score: 0
Accepted
time: 199ms
memory: 63796kb

input:

107
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

865
1 108
1 108
1 108
36 1
108 1
72 36
72 1
36 72
2 36
2 72
2 108
37 2
108 2
73 37
73 2
37 73
3 37
3 73
3 108
38 3
108 3
74 38
74 3
38 74
4 38
4 74
4 108
39 4
108 4
75 39
75 4
39 75
5 39
5 75
5 108
40 5
108 5
76 40
76 5
40 76
6 40
6 76
6 108
41 6
108 6
77 41
77 6
41 77
7 41
7 77
7 108
42 7
108 7
78 ...

result:

ok correct

Test #28:

score: 0
Accepted
time: 195ms
memory: 59132kb

input:

108
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

619
1 109
1 109
1 109
2 1
38 1
74 1
2 38
2 74
3 2
39 2
75 2
3 39
3 75
4 3
40 3
76 3
4 40
4 76
5 4
41 4
77 4
5 41
5 77
6 5
42 5
78 5
6 42
6 78
7 6
43 6
79 6
7 43
7 79
8 7
44 7
80 7
8 44
8 80
9 8
45 8
81 8
9 45
9 81
10 9
46 9
82 9
10 46
10 82
11 10
47 10
83 10
11 47
11 83
12 11
48 11
84 11
12 48
12 84...

result:

ok correct

Test #29:

score: 0
Accepted
time: 187ms
memory: 57504kb

input:

99
56 58 25
72 12 78
42 77 34
5 85 95
94 27 66
15 39 71
20 93 99
48 13 57
37 18 96
18 73 81
22 38 29
91 36 83
68 72 0
21 63 35
8 14 51
76 15 87
67 89 34
55 78 86
10 22 46
31 11 16
54 61 79
87 30 76
4 66 28
53 59 49
43 75 89
2 51 25
97 26 46
1 30 64
37 44 81
65 78 0
60 11 90
58 75 99
67 28 38
79 80 9...

output:

771
1 13
1 30
1 73
10 1
29 1
91 1
2 10
2 29
2 91
7 2
32 2
97 2
3 7
3 32
3 97
11 3
50 3
50 3
4 11
4 50
4 50
40 4
59 4
55 40
55 4
40 55
5 40
5 55
5 59
59 5
61 5
75 5
6 59
6 61
6 75
47 6
55 6
52 47
52 6
47 52
7 47
7 52
7 55
43 7
48 7
55 7
8 43
8 48
8 55
55 8
77 8
95 8
9 55
9 77
9 95
38 9
52 9
76 9
10 3...

result:

ok correct

Test #30:

score: 0
Accepted
time: 185ms
memory: 57480kb

input:

100
46 58 24
18 45 95
23 53 100
95 49 73
10 30 6
77 84 82
86 93 62
8 55 64
43 68 51
2 39 65
45 16 92
98 40 72
56 22 50
11 53 7
19 75 3
19 80 48
22 15 84
79 88 95
42 6 28
20 33 40
99 15 91
9 97 26
57 31 96
48 38 63
83 21 55
1 90 38
7 44 68
39 85 67
35 86 57
16 60 43
93 48 76
67 75 83
23 60 93
17 66 4...

output:

766
1 61
1 96
1 101
23 1
53 1
79 1
2 23
2 53
2 79
68 2
79 2
59 79
59 2
79 59
3 59
3 68
3 79
80 3
92 3
53 92
53 3
92 53
4 53
4 80
4 92
18 4
23 4
92 4
5 18
5 23
5 92
100 5
101 5
74 101
74 5
101 74
6 74
6 100
6 101
67 6
80 6
99 80
99 6
80 99
7 67
7 80
7 99
68 7
81 7
14 81
14 7
81 14
8 14
8 68
8 81
81 8...

result:

ok correct

Test #31:

score: 0
Accepted
time: 177ms
memory: 56592kb

input:

101
76 55 83
14 69 72
23 74 94
12 60 16
25 15 90
90 36 54
80 25 56
28 39 97
47 77 54
18 48 65
19 76 58
31 58 94
8 74 84
48 50 58
41 52 17
44 69 70
78 50 57
89 41 57
34 93 78
46 63 100
85 87 30
12 47 100
7 44 82
42 99 64
3 49 74
79 88 66
72 52 37
38 25 101
2 13 26
13 15 99
22 95 0
6 60 96
77 14 35
55...

output:

785
1 31
1 56
1 93
3 1
12 1
74 1
2 3
2 12
2 74
15 2
41 2
99 41
99 2
41 99
3 15
3 41
3 99
37 3
99 3
45 37
45 3
37 45
4 37
4 45
4 99
27 4
83 4
66 27
66 4
27 66
5 27
5 66
5 83
11 5
14 5
12 11
12 5
11 12
6 11
6 12
6 14
14 6
27 6
59 6
7 14
7 27
7 59
27 7
83 7
28 27
28 7
27 28
8 27
8 28
8 83
45 8
76 8
32 ...

result:

ok correct

Test #32:

score: 0
Accepted
time: 184ms
memory: 57436kb

input:

102
32 51 93
71 58 82
13 25 64
47 50 79
39 64 70
59 3 68
37 43 69
41 54 95
61 87 10
6 86 63
76 96 35
30 66 57
97 75 49
22 58 72
23 91 0
16 14 0
12 82 9
5 40 76
83 76 100
35 46 63
9 23 26
56 70 84
91 5 75
13 13 64
38 87 50
40 34 95
58 44 36
14 94 0
74 11 83
30 68 90
17 89 45
8 28 96
3 46 98
98 41 85
...

output:

808
1 15
1 16
1 28
59 1
103 1
8 103
8 1
103 8
2 8
2 59
2 103
12 2
63 2
100 63
100 2
63 100
3 12
3 63
3 100
12 3
24 3
5 24
5 3
24 5
4 5
4 12
4 24
12 4
25 4
40 25
40 4
25 40
5 12
5 25
5 40
40 5
83 5
42 40
42 5
40 42
6 40
6 42
6 83
45 6
83 6
101 6
7 45
7 83
7 101
25 7
54 7
22 54
22 7
54 22
8 22
8 25
8 ...

result:

ok correct

Test #33:

score: 0
Accepted
time: 192ms
memory: 57060kb

input:

103
52 24 7
3 10 31
23 40 84
6 11 52
101 30 65
6 34 44
5 5 50
54 21 95
76 91 62
62 67 80
19 55 30
55 41 61
25 14 76
77 60 101
53 8 0
3 45 48
17 33 100
83 28 38
36 94 60
59 26 98
8 24 48
33 59 0
1 102 15
97 69 99
27 78 54
84 95 83
34 29 75
103 56 94
75 61 91
90 23 68
79 16 56
18 18 71
3 87 16
12 99 4...

output:

838
1 15
1 22
1 88
41 1
46 1
51 1
2 41
2 46
2 51
42 2
87 2
93 2
3 42
3 87
3 93
22 3
36 3
21 36
21 3
36 21
4 21
4 22
4 36
20 4
92 4
97 92
97 4
92 97
5 20
5 92
5 97
24 5
86 5
34 24
34 5
24 34
6 24
6 34
6 86
36 6
86 6
69 36
69 6
36 69
7 36
7 69
7 86
69 7
86 7
58 86
58 7
86 58
8 58
8 69
8 86
25 8
86 8
8...

result:

ok correct

Test #34:

score: 0
Accepted
time: 232ms
memory: 66012kb

input:

104
101 15 94
20 103 12
94 68 0
57 64 0
67 46 95
14 67 101
104 70 91
34 37 64
51 95 73
31 40 26
28 4 100
47 90 28
36 44 96
94 104 18
74 61 88
43 60 1
34 76 8
86 13 36
41 53 63
13 44 61
86 15 90
59 71 2
26 93 19
69 46 0
99 8 48
23 88 32
33 69 98
11 7 23
83 95 33
32 48 96
55 7 76
8 63 85
49 78 79
12 1...

output:

790
1 3
1 4
1 24
27 1
71 1
88 1
2 27
2 71
2 88
6 2
24 2
52 2
3 6
3 24
3 52
19 3
59 3
32 19
32 3
19 32
4 19
4 32
4 59
59 4
66 4
35 66
35 4
66 35
5 35
5 59
5 66
40 5
68 5
45 40
45 5
40 45
6 40
6 45
6 68
45 6
66 6
49 45
49 6
45 49
7 45
7 49
7 66
49 7
67 7
93 67
93 7
67 93
8 49
8 67
8 93
31 8
95 8
17 95...

result:

ok correct

Test #35:

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

input:

105
9 71 30
93 42 82
84 3 103
9 22 58
45 63 44
78 94 103
65 47 87
8 93 104
15 21 66
21 41 25
39 85 42
1 9 59
52 44 80
45 59 79
25 102 53
58 67 81
7 38 1
66 6 100
17 26 72
85 54 46
11 77 37
79 105 54
86 12 33
42 27 15
18 101 97
84 62 101
29 73 87
16 72 105
43 53 92
103 61 74
35 71 90
68 33 94
53 16 7...

output:

783
1 42
1 60
1 91
38 1
65 1
10 65
10 1
65 10
2 10
2 38
2 65
22 2
82 2
20 82
20 2
82 20
3 20
3 22
3 82
33 3
56 3
102 56
102 3
56 102
4 33
4 56
4 102
91 4
102 4
12 102
12 4
102 12
5 12
5 91
5 102
16 5
99 5
49 16
49 5
16 49
6 16
6 49
6 99
10 6
34 6
41 34
41 6
34 41
7 10
7 34
7 41
34 7
95 7
48 34
48 7
...

result:

ok correct

Test #36:

score: 0
Accepted
time: 155ms
memory: 55292kb

input:

106
17 28 62
67 7 61
11 56 40
54 89 67
48 41 86
97 8 54
10 99 14
26 4 6
35 66 47
50 81 73
23 43 32
92 17 105
50 68 46
2 10 31
83 3 74
90 102 27
12 22 16
75 53 65
59 79 0
85 61 97
47 26 100
41 71 39
17 63 85
67 79 85
36 38 13
15 96 98
60 64 60
94 95 105
77 34 91
103 8 22
70 106 33
15 15 28
68 82 50
9...

output:

811
1 19
1 36
1 65
79 1
87 1
93 87
93 1
87 93
2 79
2 87
2 93
31 2
38 2
107 38
107 2
38 107
3 31
3 38
3 107
13 3
54 3
61 54
61 3
54 61
4 13
4 54
4 61
6 4
61 4
75 4
5 6
5 61
5 75
75 5
82 5
102 5
6 75
6 82
6 102
20 6
102 6
105 6
7 20
7 102
7 105
66 7
81 7
102 7
8 66
8 81
8 102
37 8
105 8
14 105
14 8
10...

result:

ok correct

Test #37:

score: 0
Accepted
time: 205ms
memory: 65352kb

input:

107
74 20 48
20 53 81
107 85 101
8 69 33
62 55 59
50 90 96
101 48 26
76 49 61
47 66 50
78 13 43
77 17 67
38 98 97
1 42 43
75 95 29
77 81 24
13 60 25
86 28 8
15 25 57
3 7 32
24 8 24
48 36 37
95 86 63
5 16 89
70 35 0
91 28 75
45 40 103
44 81 90
31 34 39
51 42 72
53 30 22
15 106 76
63 73 102
6 41 77
41...

output:

841
1 24
1 54
1 72
18 1
46 1
104 1
2 18
2 46
2 104
42 2
58 2
107 2
3 42
3 58
3 107
54 3
104 3
80 54
80 3
54 80
4 54
4 80
4 104
17 4
104 4
20 17
20 4
17 20
5 17
5 20
5 104
19 5
57 5
77 57
77 5
57 77
6 19
6 57
6 77
9 6
77 6
108 6
7 9
7 77
7 108
27 7
57 7
79 7
8 27
8 57
8 79
20 8
60 8
104 60
104 8
60 1...

result:

ok correct

Test #38:

score: 0
Accepted
time: 183ms
memory: 57240kb

input:

108
59 96 71
44 68 34
5 45 58
20 105 83
38 1 76
8 75 0
16 37 25
21 2 26
12 101 36
15 16 52
32 81 81
89 11 68
35 100 34
8 50 30
7 79 107
70 11 77
22 78 84
19 6 74
25 76 23
68 69 91
6 5 17
28 108 66
15 55 49
39 72 7
14 42 73
17 58 94
91 64 71
67 14 54
33 37 62
25 27 29
10 97 48
105 16 83
29 98 46
72 4...

output:

843
1 6
1 86
1 98
40 1
97 1
109 1
2 40
2 97
2 109
51 2
82 2
88 2
3 51
3 82
3 88
81 3
88 3
21 88
21 3
88 21
4 21
4 81
4 88
31 4
41 4
67 41
67 4
41 67
5 31
5 41
5 67
34 5
51 5
26 51
26 5
51 26
6 26
6 34
6 51
26 6
27 6
82 27
82 6
27 82
7 26
7 27
7 82
36 7
75 7
107 75
107 7
75 107
8 36
8 75
8 107
68 8
7...

result:

ok correct

Test #39:

score: -100
Time Limit Exceeded

input:

999
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30
31 32 33
34 35 36
37 38 39
40 41 42
43 44 45
46 47 48
49 50 51
52 53 54
55 56 57
58 59 60
61 62 63
64 65 66
67 68 69
70 71 72
73 74 75
76 77 78
79 80 81
82 83 84
85 86 87
88 89 90
91 92 93
94 95 96
97 98 99
100 101 ...

output:

5668
1 1000
1 1000
1 1000
2 1
335 1
668 1
2 335
2 668
3 2
336 2
669 2
3 336
3 669
4 3
337 3
670 3
4 337
4 670
5 4
338 4
671 4
5 338
5 671
6 5
339 5
672 5
6 339
6 672
7 6
340 6
673 6
7 340
7 673
8 7
341 7
674 7
8 341
8 674
9 8
342 8
675 8
9 342
9 675
10 9
343 9
676 9
10 343
10 676
11 10
344 10
677 10...

result: