QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#329155#4081. 하나 둘 셋Unknown1508150 ✓700ms4032kbC++202.1kb2024-02-16 14:16:252024-02-16 14:16:25

Judging History

This is the latest submission verdict.

  • [2024-02-16 14:16:25]
  • Judged
  • Verdict: 150
  • Time: 700ms
  • Memory: 4032kb
  • [2024-02-16 14:16:25]
  • Submitted

answer

#include <bits/stdc++.h>
#include "onetwothree.h"
using namespace std;

const int inf = 2e9;

namespace {
	vector<int> cnt(4, 0);
	vector<vector<int>> lst(4);
}

bool check(int x, int y, bool trace = false){
	// Find first x 1s and last x 3s
	// Find first y 3s and last y 1s
	
	if (x + y > cnt[1] || x + y > cnt[3]) return false;
	
	vector<int> L13, R13, L31, R31;
	
	for (int i = 0; i < x; i++) L13.push_back(lst[1][i]);
	for (int i = 0; i < x; i++) R13.push_back(lst[3].end()[-(i+1)]);

	for (int i = 0; i < y; i++) L31.push_back(lst[3][i]);
	for (int i = 0; i < y; i++) R31.push_back(lst[1].end()[-(i+1)]);

	reverse(R13.begin(), R13.end());
	reverse(R31.begin(), R31.end());

	// Check if valid
	for (int i = 0; i < x; i++){
		if (L13[i] > R13[i]) return false;
	}
	for (int i = 0; i < y; i++){
		if (L31[i] > R31[i]) return false;
	}

	int itl_13 = 0, itl_31 = 0;
	int itr_13 = 0, itr_31 = 0;

	for (auto pos: lst[2]){
		while (itr_13 < x && L13[itr_13] < pos){
			itr_13++;
		}
		while (itr_31 < y && L31[itr_31] < pos){
			itr_31++;
		}

		pair<int, int> choice = {inf, 0};
		if (itl_13 < itr_13){
			if (R13[itl_13] < pos) return false;
			choice = min(choice, pair{R13[itl_13], 1});
		}
		if (itl_31 < itr_31){
			if (R31[itl_31] < pos) return false;
			choice = min(choice, pair{R31[itl_31], 2});
		}

		if (choice.second == 1){
			if (trace){
				answer(L13[itl_13], pos, R13[itl_13]);
			}
			itl_13++;
		}
		else if (choice.second == 2){
			if (trace){
				answer(L31[itl_31], pos, R31[itl_31]);
			}
			itl_31++;
		}
	}

	return itl_13 == x && itl_31 == y;
}

void maximize(vector<int> A){
	int n = A.size();

	for (int i = 0; i < n; i++) cnt[A[i]]++;
	for (int i = 0; i < n; i++) lst[A[i]].push_back(i);

	int x = min(cnt[1], cnt[3]), y = 0;
	pair<int, int> opt = {0, 0};
	while (x >= 0){
		bool success = check(x, y);
		if (success){
			if (x + y > opt.first + opt.second) opt = {x, y};
			y++;
		}
		else{
			x--;
		}
	}

	// cout << "Answer: " << opt.first << " " << opt.second << endl;
	check(opt.first, opt.second, true);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 14
Accepted

Test #1:

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

input:

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

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
3
1 3 13
4 6 10
7 11 12

result:

ok 

Test #2:

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

input:

18
3 3 3 1 1 3 2 2 1 2 1 2 3 2 2 1 3 1

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
6
0 6 8
1 7 10
3 9 12
2 11 15
4 13 16
5 14 17

result:

ok 

Test #3:

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

input:

16
1 3 3 2 1 3 1 2 2 2 3 1 3 2 1 2

output:

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

result:

ok 

Test #4:

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

input:

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

output:

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

result:

ok 

Test #5:

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

input:

18
1 3 1 3 2 1 1 3 2 2 2 3 2 3 2 1 1 3

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
6
0 4 7
2 8 11
5 9 13
1 10 15
3 12 16
6 14 17

result:

ok 

Test #6:

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

input:

18
1 3 3 2 1 1 1 2 3 2 1 1 2 3 2 3 2 3

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
6
0 3 8
1 7 10
2 9 11
4 12 13
5 14 15
6 16 17

result:

ok 

Test #7:

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

input:

18
1 2 1 2 3 2 3 3 2 2 3 1 1 3 3 1 2 1

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
6
0 1 13
2 3 14
4 5 11
6 8 12
7 9 15
10 16 17

result:

ok 

Test #8:

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

input:

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

output:

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

result:

ok 

Test #9:

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

input:

18
3 2 1 2 1 3 3 1 1 3 2 1 2 3 2 1 2 3

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
6
0 1 8
2 3 9
5 10 11
4 12 13
6 14 15
7 16 17

result:

ok 

Test #10:

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

input:

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

output:

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

result:

ok 

Test #11:

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

input:

18
2 1 2 2 2 2 1 3 1 3 3 3 2 2 2 2 3 2

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2
1 2 11
6 12 16

result:

ok 

Test #12:

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

input:

17
1 2 2 2 2 1 1 1 1 3 2 2 1 2 1 2 2

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
0 1 9

result:

ok 

Test #13:

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

input:

16
1 2 2 2 2 3 3 1 3 3 2 2 2 2 3 2

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2
0 1 9
7 10 14

result:

ok 

Test #14:

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

input:

18
1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5
0 5 13
1 6 14
2 7 15
3 8 16
4 9 17

result:

ok 

Test #15:

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

input:

6
1 2 3 2 3 1

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2
0 1 4
2 3 5

result:

ok 

Test #16:

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

input:

6
2 1 3 3 1 2

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
0

result:

ok 

Test #17:

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

input:

6
3 1 2 2 3 1

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2
1 2 4
0 3 5

result:

ok 

Subtask #2:

score: 29
Accepted

Test #18:

score: 29
Accepted
time: 0ms
memory: 3528kb

input:

91
2 1 2 2 1 3 1 2 1 2 2 1 2 3 3 1 2 2 2 1 3 1 3 1 1 3 1 2 1 2 1 3 1 1 3 2 3 1 2 3 2 2 2 2 1 2 1 1 3 2 2 2 1 1 2 3 3 2 3 3 3 3 1 1 3 2 3 3 1 3 3 3 3 3 2 1 2 2 2 3 2 3 2 1 3 1 3 1 3 1 1

output:

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

result:

ok 

Test #19:

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

input:

92
3 1 3 3 3 3 3 1 3 2 1 3 3 3 1 1 1 2 2 1 2 1 2 2 2 3 2 1 3 3 2 3 3 2 3 3 2 3 3 2 2 1 2 2 3 3 2 2 2 3 2 1 3 2 1 2 1 1 1 1 1 3 1 3 1 2 1 1 2 2 2 2 3 1 1 3 2 1 1 1 1 1 1 3 1 2 2 3 3 2 2 2

output:

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

result:

ok 

Test #20:

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

input:

93
1 1 3 1 1 3 1 1 2 3 1 1 1 2 3 3 2 1 1 3 1 3 3 2 3 3 1 3 2 2 3 3 1 3 1 1 1 2 2 3 1 2 3 1 3 3 2 3 2 3 2 3 2 3 2 3 3 2 1 3 2 2 1 1 1 2 1 1 2 2 2 1 1 2 3 1 2 2 3 3 2 1 2 2 1 2 2 2 2 3 3 2 2

output:

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

result:

ok 

Test #21:

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

input:

94
3 3 1 1 3 2 1 3 2 1 2 1 1 2 2 2 2 3 2 2 1 1 3 1 2 1 2 3 3 3 2 2 1 3 2 1 2 2 1 2 3 1 2 1 2 1 3 1 3 1 3 3 2 2 2 1 1 3 2 2 3 3 3 2 2 3 3 3 2 3 2 1 2 2 1 1 2 1 1 1 3 2 2 1 3 3 1 3 1 3 3 3 2 1

output:

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

result:

ok 

Test #22:

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

input:

94
3 2 3 2 1 2 1 3 3 2 1 3 2 3 1 3 2 1 2 2 2 3 3 1 3 3 1 2 1 1 1 2 3 2 1 2 2 2 2 2 3 1 3 3 2 3 3 3 1 1 1 2 1 1 1 3 3 3 1 1 3 1 3 1 2 3 3 2 1 1 2 3 2 1 2 2 3 1 3 3 1 1 1 3 2 3 1 2 2 2 2 3 1 1

output:

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

result:

ok 

Test #23:

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

input:

96
2 3 2 1 1 1 1 3 3 2 2 1 2 1 3 3 3 2 3 2 1 3 2 1 2 3 2 2 3 2 1 2 2 1 1 3 1 2 3 3 3 3 3 1 1 2 1 1 2 2 2 1 3 3 1 1 3 2 3 1 1 3 2 1 1 1 2 1 3 2 2 3 3 2 2 3 3 1 1 1 3 1 3 3 3 3 1 3 3 2 2 2 1 1 1 2

output:

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

result:

ok 

Test #24:

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

input:

98
2 3 2 1 2 2 1 3 3 3 2 1 3 1 1 2 2 2 2 1 1 2 2 1 2 1 3 2 1 3 3 1 2 1 2 1 1 3 2 1 2 3 1 2 3 3 3 3 2 2 3 1 3 2 1 1 1 3 3 1 3 2 2 1 3 1 3 3 3 1 1 2 1 1 2 3 2 3 2 1 3 1 1 2 3 1 3 3 2 3 3 1 3 1 3 1 3 2

output:

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

result:

ok 

Test #25:

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

input:

100
1 3 1 3 1 1 2 3 1 2 2 2 1 3 3 3 3 1 2 3 1 1 3 2 2 2 3 3 2 1 1 3 1 3 2 2 1 1 1 3 1 3 2 3 2 2 2 1 3 3 1 1 1 1 1 3 2 2 2 3 3 2 1 3 2 3 3 1 1 1 2 2 2 2 2 1 1 3 2 3 2 3 1 3 1 1 3 3 2 1 2 2 3 3 3 3 1 1 3 1

output:

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

result:

ok 

Test #26:

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

input:

100
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 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 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:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
0 29 58

result:

ok 

Test #27:

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

input:

100
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 1 2 2 2 2 2 2

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
29 30 93

result:

ok 

Test #28:

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

input:

99
1 1 3 3 2 1 2 2 2 2 1 2 1 3 1 3 3 1 3 3 2 2 2 1 2 2 2 2 2 2 1 2 1 2 3 2 3 2 1 2 1 3 1 2 2 1 2 3 2 2 1 3 2 1 2 3 2 2 1 2 3 1 1 3 3 3 3 3 3 1 1 3 1 3 1 1 1 3 1 1 3 1 3 3 1 3 3 3 2 1 1 3 3 2 3 3 1 2 1

output:

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

result:

ok 

Test #29:

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

input:

96
3 2 1 2 3 1 2 1 2 1 2 2 1 1 2 2 3 2 1 3 2 2 1 2 3 2 1 2 3 3 3 3 1 2 2 2 2 2 1 1 1 1 3 1 2 1 1 3 3 1 3 3 1 3 3 1 1 1 3 3 3 1 3 1 1 3 3 1 3 3 3 3 2 1 2 3 2 3 2 3 2 1 2 1 2 3 2 3 2 1 2 3 2 1 2 1

output:

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

result:

ok 

Test #30:

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

input:

99
3 2 1 2 1 1 1 3 2 3 1 2 1 2 3 3 3 1 3 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 1 3 1 1 1 1 1 1 3 2 3 2 3 2 2 3 1 2 2 2 2 3 2 1 1 1 3 2 3 2 2 2 3 1 3 2 1 2 3 2 2 2 2 2 2 2 1 1 3 1 1 3 3 2 3 2 2 2 3 2 2 3 1 3 1

output:

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

result:

ok 

Test #31:

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

input:

93
3 2 3 2 3 2 1 2 3 2 3 2 3 2 3 1 3 1 3 1 1 1 3 3 1 3 3 3 1 1 3 1 1 1 3 3 1 3 3 1 2 2 3 1 1 2 3 2 1 3 3 1 3 2 2 2 2 2 2 2 3 2 3 3 1 1 1 3 1 2 2 3 1 2 1 2 1 2 3 2 2 1 1 2 2 2 2 2 3 1 1 1 1

output:

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

result:

ok 

Test #32:

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

input:

90
3 3 3 3 2 2 2 2 3 2 1 2 3 2 3 2 1 1 2 2 3 3 2 2 1 3 2 2 1 2 1 1 3 1 3 2 3 3 3 1 1 1 3 1 3 2 3 1 1 3 1 2 1 1 3 3 3 1 2 1 1 2 1 3 3 3 1 1 3 1 2 2 1 2 1 3 2 3 2 2 3 1 2 1 2 1 2 1 2 3

output:

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

result:

ok 

Test #33:

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

input:

100
2 1 2 2 2 3 2 2 1 2 1 2 2 1 2 2 2 2 1 2 2 3 2 2 2 2 2 1 2 2 2 3 3 1 1 1 1 1 1 1 3 3 3 1 1 3 1 1 1 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 3 3 2 3 2 2 1 2 2 3 2 2 2 2 2 2 3 1 2 1 1 1 1 2 2 3 2 2 3 2 2 2 2 1 2 2

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
20
1 2 56
5 6 60
8 9 59
10 11 61
13 14 63
18 19 64
21 22 62
27 28 65
33 66 67
31 68 70
34 69 73
35 71 80
32 72 81
40 74 83
41 75 84
42 76 85
45 77 86
36 78 89
37 79 92
50 82 97

result:

ok 

Test #34:

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

input:

99
2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 2 3 2 2 2 2 2 3 2 1 2 3 2 2 2 2 2 2 1 1 1 1 1 3 3 1 1 3 3 1 1 3 1 1 3 3 1 1 1 3 3 1 1 3 1 1 1 3 3 3 3 3 2 2 3 3 1 2 3 2 2 2 1 2 1 3 1 1 2 1 2 1 1 1 2 3 2 2 2 2 2 1 1 2

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
18
7 8 64
9 10 65
16 17 77
22 23 79
24 25 66
26 27 81
33 67 69
34 68 70
35 72 73
36 74 80
38 75 82
39 76 84
42 78 86
43 83 87
46 85 88
37 89 90
49 91 96
50 92 97

result:

ok 

Test #35:

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

input:

98
3 2 2 2 2 2 2 3 3 2 2 2 1 2 1 2 2 2 2 2 2 3 1 3 1 3 2 3 2 1 2 2 1 1 1 3 3 3 3 1 3 1 1 1 3 3 1 3 3 3 1 3 1 3 3 1 3 3 1 1 3 3 3 3 2 2 2 2 2 2 2 2 2 1 3 2 2 2 3 2 2 2 2 3 2 1 2 2 2 2 2 2 2 2 2 2 2 1

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
15
0 1 52
7 9 55
8 10 58
12 13 57
14 15 60
21 26 59
22 28 61
24 30 62
29 31 63
23 64 73
32 65 74
33 66 78
34 67 83
25 68 85
27 69 97

result:

ok 

Test #36:

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

input:

97
2 2 1 3 2 2 1 2 2 2 1 2 1 1 1 1 2 2 3 2 3 1 2 2 2 3 2 3 3 2 2 2 1 3 1 1 1 1 1 1 1 1 3 3 3 1 3 1 1 1 1 3 1 1 1 3 1 3 1 3 1 1 3 1 2 2 1 2 1 2 2 2 2 2 1 3 2 2 1 3 1 2 3 1 2 2 1 2 2 2 2 3 3 2 2 1 1

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
21
2 4 43
3 5 68
6 7 44
10 11 46
12 16 51
13 17 55
14 19 57
15 22 59
21 23 62
18 24 74
20 26 78
25 29 80
27 30 83
28 31 86
32 64 75
34 65 79
35 67 82
36 69 91
37 70 92
33 71 95
42 72 96

result:

ok 

Test #37:

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

input:

99
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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

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

result:

ok 

Test #38:

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

input:

99
3 2 3 3 1 2 1 1 1 1 2 2 3 1 3 1 3 3 2 3 3 2 3 3 1 2 3 3 1 1 1 2 1 1 1 1 3 1 1 2 1 2 1 2 3 3 2 3 1 2 2 1 2 3 3 3 1 3 2 2 2 2 2 2 2 2 3 3 1 2 2 2 1 3 3 1 3 2 2 3 2 2 3 2 1 2 1 3 1 3 3 1 2 1 1 3 1 3 1

output:

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

result:

ok 

Test #39:

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

input:

96
3 3 3 2 2 1 2 3 1 3 3 1 3 2 1 2 1 3 2 1 2 1 2 1 2 2 2 1 1 1 3 2 3 3 3 3 1 2 3 3 1 1 3 2 3 1 3 1 2 3 1 3 2 2 2 1 1 1 2 2 1 1 2 3 3 2 1 2 2 1 2 2 2 3 3 3 1 3 3 2 2 3 1 3 2 1 2 3 1 1 2 3 1 1 1 3

output:

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

result:

ok 

Subtask #3:

score: 53
Accepted

Test #40:

score: 53
Accepted
time: 18ms
memory: 3644kb

input:

3000
2 3 2 3 3 1 2 3 1 3 2 1 1 2 3 2 2 2 3 1 2 1 3 2 3 2 1 2 3 3 2 1 3 3 3 3 3 3 2 1 1 2 2 1 1 2 3 1 1 2 2 3 3 1 2 2 3 2 1 1 1 3 1 2 2 3 3 1 1 1 3 2 1 2 1 3 2 2 1 1 2 3 3 3 3 2 3 1 2 2 3 2 3 1 3 3 3 3 1 3 2 2 2 2 1 3 2 2 2 1 2 2 3 2 2 1 1 1 1 1 2 3 2 1 2 3 3 3 2 3 3 3 3 2 3 2 2 2 2 1 3 3 1 1 1 1 2 3...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
999
1 2 2860
5 6 129
8 10 130
11 13 131
12 15 132
3 16 2861
4 17 2864
19 20 134
21 23 140
7 25 2865
26 27 141
9 30 2873
31 38 147
39 41 152
40 42 153
43 45 154
44 49 155
47 50 160
48 54 163
53 55 166
14 57 2875
58 63 170
59 64 171
60 71 179
62 73 181
67 76 1...

result:

ok 

Test #41:

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

input:

2997
1 3 1 3 2 1 3 3 2 2 2 1 1 2 3 3 3 1 3 2 3 3 2 1 2 3 1 2 2 2 2 1 3 3 2 1 2 2 3 2 2 2 2 1 3 1 3 3 3 3 1 3 3 1 3 1 3 2 3 1 2 3 1 2 2 3 3 1 3 3 3 3 3 3 1 1 1 3 3 1 3 3 1 1 1 3 2 3 3 2 3 3 3 1 3 3 2 1 1 1 2 1 1 1 1 3 3 3 3 2 3 1 3 3 2 1 3 1 3 1 1 3 2 1 2 3 1 2 2 2 3 1 3 2 2 3 2 3 3 3 1 2 3 2 1 1 3 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
995
0 4 121
2 8 125
5 9 130
1 10 2854
11 13 132
12 19 135
17 22 137
23 24 138
26 27 139
3 28 2855
6 29 2856
7 30 2859
31 34 142
35 36 146
14 37 2860
15 39 2861
16 40 2862
18 41 2863
20 42 2865
43 57 149
45 60 152
50 63 154
53 64 155
55 86 157
59 89 164
62 96...

result:

ok 

Test #42:

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

input:

3000
1 1 1 1 1 3 1 1 3 3 1 3 1 1 2 3 1 1 2 1 2 1 3 3 3 1 1 2 1 2 2 3 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 3 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 3 1 1 1 1 3 3 2 1 3 1 1 2 3 1 2 3 1 1 1 2 1 1 1 1 2 3 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 3 1 3 3 1 1 1 1 3 1 1 2 1 1 1 3 3 1 1 1 1 2 1 1 1 1 1 2 3 3 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
499
0 14 47
1 18 48
2 20 72
3 27 77
4 29 78
6 30 81
7 39 85
10 46 88
12 51 98
13 54 117
16 60 119
17 67 120
19 71 125
21 79 132
25 84 133
26 87 145
28 92 146
32 97 151
33 99 164
34 105 171
35 113 180
36 128 184
37 138 191
38 144 192
40 148 193
41 162 199
42 ...

result:

ok 

Test #43:

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

input:

3000
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 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
0 1374 2901

result:

ok 

Test #44:

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

input:

3000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
1755 1756 2819

result:

ok 

Test #45:

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

input:

1500
1 1 1 2 1 1 1 2 2 2 2 2 1 1 3 1 2 2 3 1 2 2 2 2 1 2 1 2 1 1 3 1 2 2 2 2 1 1 3 1 1 2 2 3 2 1 3 1 1 2 2 2 1 2 2 2 2 2 1 2 3 2 3 2 3 2 1 3 2 1 2 3 2 2 3 2 3 1 1 3 1 3 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 1 1 1 3 1 3 1 3 3 1 1 1 3 1 1 3 1 1 1 1 1 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 3 1 3 1 1 1 3 1 3 1 1 1 1 3 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
500
0 3 521
1 7 524
2 8 526
4 9 527
5 10 529
6 11 530
12 16 532
13 17 533
15 20 534
19 21 536
14 22 561
18 23 562
24 25 537
26 27 542
28 32 544
29 33 545
31 34 547
30 35 565
36 41 550
37 42 554
39 44 557
40 49 558
45 50 559
47 51 563
48 53 564
52 54 566
38 5...

result:

ok 

Test #46:

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

input:

3000
3 1 1 1 1 3 3 2 1 1 1 2 3 1 3 3 3 3 1 1 3 1 3 3 1 1 1 1 1 3 3 1 1 1 1 3 1 3 1 1 3 3 3 3 1 3 1 3 1 3 1 3 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 3 1 1 1 1 3 1 1 1 3 3 1 2 3 3 1 3 3 3 3 3 3 3 1 1 1 1 3 1 3 1 3 3 3 3 1 3 1 1 3 3 1 1 1 3 3 1 3 3 1 3 1 3 1 3 2 3 1 3 1 1 3 1 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1000
1 7 1877
2 11 1878
3 79 1884
4 122 1885
8 138 1888
9 139 1890
10 140 1892
13 141 1893
18 142 1894
19 143 1895
21 144 1897
0 145 1899
24 146 1900
25 147 1901
26 148 1902
27 149 1903
5 150 1904
6 151 1905
28 152 1906
31 153 1907
12 154 1908
14 155 1909
15...

result:

ok 

Test #47:

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

input:

3000
1 3 1 1 3 1 1 1 1 3 1 1 3 1 1 1 3 3 3 3 3 1 1 3 1 1 3 1 3 3 1 2 2 3 1 3 3 3 1 3 3 2 3 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 3 1 1 1 1 3 1 1 1 3 1 1 1 1 1 3 3 3 3 3 1 3 3 3 1 1 1 3 1 1 3 1 1 3 1 3 3 3 1 1 1 3 3 3 3 3 1 1 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1000
0 31 1618
1 32 1619
2 41 1620
4 51 1621
9 52 1622
12 53 1623
16 54 1624
3 55 1625
5 56 1626
17 57 1627
6 58 1628
7 59 1629
18 60 1630
8 61 1631
10 62 1632
11 63 1633
13 64 1634
14 65 1635
19 66 1636
15 67 1637
20 68 1638
23 69 1639
26 70 1640
21 71 1641...

result:

ok 

Test #48:

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

input:

2997
3 1 2 2 1 1 1 1 1 1 3 1 3 3 1 3 3 3 1 3 1 2 1 1 3 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 1 1 3 1 3 1 1 3 3 1 3 1 3 3 3 1 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 1 3 1 1 1 1 1 3 3 3 1 3 1 1 3 3 3 1 3 3 1 1 1 3 1 1 3 1 1 3 2 3 3 3 2 3 2 3 1 2 1 1 3 1 1 3 2 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
999
1 2 1205
0 3 1226
4 21 1206
5 26 1207
6 27 1208
7 30 1209
8 31 1214
9 32 1219
11 33 1221
14 34 1223
18 35 1224
20 36 1225
22 37 1227
10 38 1228
23 39 1229
25 40 1230
28 41 1231
12 42 1232
13 43 1233
29 44 1234
15 45 1238
16 46 1239
17 47 1240
19 48 1241
...

result:

ok 

Test #49:

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

input:

2994
1 1 2 1 2 1 2 2 3 1 3 3 3 3 1 3 1 1 2 3 3 1 3 3 3 3 1 1 1 3 3 2 3 1 3 1 3 3 1 2 3 1 3 3 3 1 3 1 3 2 3 2 1 1 3 1 1 1 3 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 2 3 3 3 3 3 3 1 3 1 3 1 1 2 1 3 3 3 2 2 3 2 1 3 3 3 1 2 1 1 2 3 3 1 3 2 2 2 2 2 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
998
0 2 1914
1 4 1915
3 6 1916
5 7 1922
9 18 1924
14 31 1925
16 39 1927
17 49 1928
21 51 1929
26 59 1930
27 61 1931
28 62 1932
33 63 1933
35 64 1936
38 65 1937
41 66 1939
45 67 1941
8 68 1942
10 69 1943
47 70 1944
52 71 1945
11 72 1946
12 73 1947
13 74 1948
...

result:

ok 

Test #50:

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

input:

3000
1 1 1 3 2 3 2 3 1 1 1 1 2 3 1 2 1 2 1 3 3 2 2 3 3 2 3 2 2 3 3 3 3 3 1 3 2 1 2 3 2 3 3 3 2 1 3 3 3 2 1 1 1 1 2 1 3 1 3 2 2 2 1 2 3 3 3 2 1 3 1 3 2 3 1 3 2 3 3 1 2 1 2 2 3 1 3 2 2 1 1 2 3 1 1 3 1 3 2 2 3 2 2 1 3 2 2 2 3 3 2 3 1 2 2 1 1 1 2 3 2 1 3 2 1 1 1 3 3 1 3 1 3 2 2 1 1 1 1 2 1 2 3 1 2 1 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1000
0 4 149
1 6 158
2 12 159
8 15 160
9 17 166
10 21 168
11 22 169
14 25 171
16 27 178
18 28 179
34 36 182
37 38 186
3 40 2851
5 44 2856
45 49 189
50 54 194
51 59 197
52 60 201
53 61 202
55 63 204
57 67 206
62 72 212
68 76 213
70 80 216
74 82 223
79 83 226
...

result:

ok 

Test #51:

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

input:

3000
2 2 1 3 2 2 2 3 2 2 2 2 2 1 2 2 2 2 2 1 3 2 2 2 2 3 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 1 2 3 2 3 1 2 2 3 2 3 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 3 2 2 1 2 3 2 1 3 3 2 3 2 2 2 3 1 2 2 2 2 1 2 3 3 1 2 1 1 2 2 2 1 2 2 2 2 2 2 1 2 3 1 2 1 2 2 3 2 2 2 2 2 2 2 2 2 3 1 2 2 2 2 3 2 3 3 1 2 2 1 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
673
2 4 1661
3 5 1685
7 8 1686
13 14 1662
19 21 1668
20 22 1687
25 26 1688
32 34 1669
33 35 1689
44 46 1670
45 47 1696
49 50 1671
51 52 1697
54 55 1672
53 56 1699
57 58 1702
59 60 1707
63 64 1674
73 74 1675
76 77 1708
79 80 1677
81 82 1710
83 86 1678
84 88 1...

result:

ok 

Test #52:

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

input:

2999
2 2 3 3 2 1 2 1 1 2 2 3 2 3 2 3 2 2 2 1 2 3 2 2 2 2 1 3 2 3 3 2 1 2 3 2 2 2 2 1 2 2 2 2 2 3 2 2 3 1 2 2 2 3 2 2 2 3 3 2 2 2 3 3 3 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 3 2 2 3 3 3 1 1 2 2 3 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 3 3 1 1 2 2 2 2 1 1 2 2 3 2 3 2 3 2 2 2 3 2 2 2 1 2 1 3 2 3 2 2 2 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
683
2 4 1641
3 6 1642
5 9 1650
7 10 1651
11 12 1643
13 14 1645
15 16 1648
8 17 1652
19 20 1653
21 22 1649
26 28 1654
27 31 1655
32 33 1656
29 35 1657
30 36 1661
34 37 1665
39 40 1658
45 46 1666
49 50 1659
48 51 1672
53 54 1676
57 59 1680
58 60 1682
62 65 168...

result:

ok 

Test #53:

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

input:

2998
2 1 2 1 3 2 2 2 2 2 2 2 1 2 2 2 2 3 3 2 1 2 1 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 3 1 3 2 2 1 2 2 2 3 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 3 2 1 2 3 2 2 3 3 2 2 2 2 1 2 1 2 2 2 2 3 2 3 3 3 1 2 2 2 2 2 3 2 2 2 1 2 2 2 2 2 2 2 3 2 2 3 3 2 1 1 2 2 3 3 2 1 2 2 2 2 2 2 2 2 3 2 1 2 1 2 2 3 1 2 3 2 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
629
1 2 1648
3 5 1650
4 6 1712
12 13 1652
17 19 1713
20 21 1655
22 23 1656
18 24 1716
25 26 1720
34 35 1657
41 45 1658
43 46 1659
47 48 1661
42 49 1721
44 50 1725
51 52 1726
56 57 1663
59 60 1665
68 69 1727
70 71 1667
72 73 1728
75 77 1729
76 78 1732
81 82 1...

result:

ok 

Test #54:

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

input:

2997
1 1 3 2 3 3 2 2 1 2 2 2 2 2 2 1 3 3 2 2 2 3 2 2 2 2 3 2 1 3 2 3 2 3 2 3 3 2 2 2 2 2 2 2 1 1 2 2 3 3 2 1 2 2 3 3 2 2 1 1 1 2 1 2 1 2 2 1 2 1 3 1 3 3 1 2 2 2 2 2 2 1 2 2 2 3 2 2 3 2 2 1 2 2 3 2 1 2 2 2 3 2 2 1 3 1 2 2 2 1 3 2 2 1 2 3 2 3 1 3 2 2 3 2 2 2 2 1 2 2 2 1 1 2 3 2 2 2 3 2 3 1 2 2 3 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
712
0 3 1635
1 6 1637
2 7 1649
8 9 1639
4 10 1650
5 11 1651
15 18 1641
16 19 1654
17 20 1656
21 22 1657
26 27 1663
28 30 1643
29 32 1666
31 34 1670
33 37 1671
35 38 1675
36 39 1685
44 46 1644
45 47 1645
48 50 1686
51 52 1648
49 53 1687
54 56 1692
55 57 1693
...

result:

ok 

Test #55:

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

input:

3000
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 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1000
0 1000 2000
1 1001 2001
2 1002 2002
3 1003 2003
4 1004 2004
5 1005 2005
6 1006 2006
7 1007 2007
8 1008 2008
9 1009 2009
10 1010 2010
11 1011 2011
12 1012 2012
13 1013 2013
14 1014 2014
15 1015 2015
16 1016 2016
17 1017 2017
18 1018 2018
19 1019 2019
20 ...

result:

ok 

Test #56:

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

input:

3000
1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
0 2 2999

result:

ok 

Subtask #4:

score: 54
Accepted

Test #57:

score: 54
Accepted
time: 691ms
memory: 3888kb

input:

15000
2 1 3 1 1 2 3 1 3 1 1 1 3 2 2 2 1 3 2 3 3 3 3 2 1 1 2 2 1 1 1 1 1 1 3 3 3 3 3 1 3 1 2 1 1 1 1 1 2 1 2 1 2 1 3 3 3 3 3 2 2 1 1 2 3 3 3 2 3 2 1 2 1 1 1 1 1 3 2 3 2 1 1 2 1 1 1 1 3 2 1 2 1 1 2 1 2 1 2 1 3 3 2 3 2 3 1 2 1 3 3 1 2 2 3 1 2 3 2 3 3 1 1 1 3 3 2 2 2 2 2 1 3 3 3 2 2 1 2 1 3 3 3 3 2 2 1 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
4997
1 5 489
3 13 498
4 14 504
7 15 506
9 18 510
10 23 512
11 26 513
16 27 516
24 42 518
25 48 520
28 50 521
29 52 525
30 59 527
31 60 528
32 63 529
33 67 531
39 69 537
41 71 539
43 78 541
44 80 543
45 83 546
46 89 549
47 91 550
49 94 551
51 96 553
53 98 557...

result:

ok 

Test #58:

score: 0
Accepted
time: 700ms
memory: 4032kb

input:

15000
3 1 3 3 2 1 1 3 1 2 2 3 1 2 1 2 1 2 1 1 2 2 1 2 3 2 3 2 3 3 1 1 2 1 2 2 3 3 3 2 3 2 1 1 3 2 2 3 1 2 1 3 1 3 1 3 2 1 1 1 3 3 2 2 3 3 1 2 3 2 3 2 2 2 1 2 3 2 2 1 1 3 3 2 1 3 3 3 2 2 1 1 3 1 3 2 2 3 3 1 2 2 2 3 1 1 2 1 1 1 1 1 2 2 1 2 1 3 3 3 3 3 2 3 1 1 1 1 1 1 2 1 1 2 3 2 1 3 3 3 2 1 1 3 2 1 1 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
4999
1 4 182
5 9 184
6 10 185
8 13 187
12 15 192
14 17 194
16 20 196
18 21 199
19 23 204
22 25 206
0 27 14858
30 32 209
31 34 211
33 35 217
2 39 14865
3 41 14868
42 45 219
43 46 223
48 49 228
50 56 233
52 62 236
54 63 248
57 67 250
58 69 253
59 71 254
66 72 ...

result:

ok 

Test #59:

score: 0
Accepted
time: 692ms
memory: 3832kb

input:

15000
1 2 1 3 2 3 2 3 2 3 3 1 3 3 1 1 3 1 2 3 1 1 3 2 1 2 1 2 1 1 2 1 1 1 3 3 1 2 3 3 3 1 3 3 2 1 3 3 3 3 1 3 2 3 3 1 3 2 3 1 3 3 1 2 2 2 1 3 3 2 3 2 3 3 2 3 2 1 1 3 2 3 3 1 1 1 3 1 3 1 2 1 3 2 2 1 2 1 2 3 3 1 1 2 1 1 3 3 3 3 1 1 2 2 3 1 2 1 3 1 1 3 2 3 1 2 1 3 1 1 3 3 3 1 3 3 3 1 2 2 2 1 2 1 3 2 3 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
4998
0 1 218
2 4 223
3 6 14734
5 8 14735
11 18 224
14 23 227
15 25 232
17 27 233
20 30 234
21 37 236
24 44 240
26 52 245
28 57 247
29 63 248
31 64 256
32 65 258
33 69 259
36 71 261
41 74 262
45 76 265
50 80 270
55 90 273
59 93 274
62 94 278
66 96 280
77 98 2...

result:

ok 

Test #60:

score: 0
Accepted
time: 324ms
memory: 3976kb

input:

15000
1 2 1 1 1 2 3 1 2 3 3 3 2 2 1 2 1 3 3 2 3 2 1 1 2 3 3 1 1 2 1 3 2 3 1 1 2 2 2 1 3 1 2 3 3 2 2 1 2 3 3 2 2 2 2 3 3 3 2 3 3 2 1 2 3 3 1 3 3 1 1 3 3 3 2 3 2 1 3 1 1 2 1 3 1 2 1 1 2 1 2 3 2 2 3 3 2 2 1 3 3 2 3 1 2 2 3 3 2 3 1 3 1 1 3 1 3 3 1 3 1 2 2 2 1 3 1 3 2 2 2 2 3 2 1 2 2 3 3 1 2 3 1 1 3 1 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
0 1 264
2 5 268
3 8 278
4 12 279
7 13 280
14 15 283
16 19 284
6 21 14709
22 24 285
23 29 286
27 32 289
28 36 290
30 37 291
34 38 293
35 42 295
39 45 296
41 46 300
47 48 301
9 51 14710
10 52 14714
11 53 14716
17 54 14719
18 58 14723
20 61 14725
62 63 312...

result:

ok 

Test #61:

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

input:

15000
3 3 1 1 1 1 3 3 3 3 3 1 3 1 3 1 1 3 1 3 3 3 3 1 2 3 3 3 3 3 3 3 3 3 3 1 3 1 1 3 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 3 1 1 3 2 1 1 1 1 3 3 1 3 3 1 3 1 3 1 1 3 1 3 3 1 1 1 1 1 3 1 1 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 1 3 3 3 2 1 3 2 3 1 1 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
0 24 5295
1 41 5296
6 42 5299
7 43 5302
8 44 5303
9 46 5306
10 47 5308
12 48 5309
14 49 5310
17 50 5311
19 51 5314
2 52 5315
20 53 5316
3 54 5317
4 55 5318
21 56 5319
22 57 5320
5 58 5321
11 59 5322
25 60 5323
26 61 5324
13 62 5325
27 63 5326
28 64 5327...

result:

ok 

Test #62:

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

input:

15000
3 1 3 1 3 3 1 1 1 1 3 3 3 3 3 3 1 1 3 1 1 3 3 3 3 3 3 3 3 3 2 3 1 3 3 3 3 3 3 1 3 1 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 1 1 1 3 1 1 3 1 1 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 1 1 1 3 1 1 1 3 3 3 3 1 1 1 1 3 1 3 1 1 3 1 2 1 2 1 3 1 3 1 1 1 1 3 3 3 3 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
1 30 6127
3 42 6128
6 43 6129
7 45 6130
8 46 6133
9 47 6135
16 48 6136
17 49 6137
19 50 6139
20 51 6140
32 52 6147
39 53 6148
41 54 6151
0 55 6218
2 56 6219
4 57 6220
5 58 6221
10 59 6222
11 60 6225
12 61 6231
13 62 6232
14 63 6233
15 64 6235
18 65 6236...

result:

ok 

Test #63:

score: 0
Accepted
time: 214ms
memory: 3856kb

input:

15000
3 3 1 1 1 1 3 3 3 1 3 1 3 1 3 1 3 3 3 3 1 3 3 1 1 1 3 1 1 1 1 3 1 1 3 3 1 1 1 3 1 3 1 3 3 1 1 1 3 1 3 3 3 3 3 3 3 1 3 3 3 1 3 1 3 3 3 3 3 3 3 3 3 1 1 1 1 3 3 1 3 3 3 1 3 3 1 3 3 1 3 3 3 3 1 1 1 1 3 3 1 3 1 3 3 1 3 1 1 3 1 3 1 3 3 3 1 1 1 1 3 3 3 3 1 3 1 3 1 1 3 1 1 1 3 1 1 1 3 2 3 3 3 3 1 1 1 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
0 139 6955
1 444 6958
6 472 6960
7 474 6961
2 475 6962
3 476 6963
8 477 6964
4 478 6965
10 479 6966
5 480 6967
12 481 6968
14 482 6969
9 483 6970
16 484 6971
17 485 6972
11 486 6973
13 487 6974
18 488 6975
19 489 6976
15 490 6977
21 491 6978
20 492 6979...

result:

ok 

Test #64:

score: 0
Accepted
time: 34ms
memory: 3904kb

input:

6000
1 3 1 1 3 3 3 1 1 1 1 1 3 1 1 1 3 1 3 3 3 1 3 1 1 1 3 3 3 3 1 1 3 1 3 1 3 3 3 3 3 3 3 3 3 3 1 3 1 3 1 1 1 1 3 3 3 1 1 1 1 3 1 3 1 3 1 3 1 1 1 1 3 3 1 3 3 3 1 3 3 3 1 3 3 3 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2000
1 89 2529
4 90 2533
5 91 2537
6 92 2542
12 93 2543
16 94 2544
18 95 2545
19 96 2546
20 97 2547
22 98 2551
26 99 2553
27 100 2555
28 101 2556
29 102 2558
32 103 2561
0 104 2564
2 105 2566
3 106 2567
7 107 2568
8 108 2569
34 109 2570
9 110 2571
10 111 257...

result:

ok 

Test #65:

score: 0
Accepted
time: 79ms
memory: 3780kb

input:

9000
1 1 1 1 1 1 1 1 1 3 1 1 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 3 2 1 3 3 1 3 3 2 3 2 3 2 2 2 2 2 2 2 2 2 3 3 3 3 1 3 3 1 3 1 3 1 1 3 2 3 3 1 3 1 1 1 1 3 3 1 1 1 3 3 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 1 1 3 3 3 1 1 1 3 1 3 3 1 1 3 3 3 1 3 1 1 3 3 1 1 1 1 3 1 3 1 1...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
3000
9 13 4192
0 14 4217
1 16 4218
2 17 4219
3 18 4220
4 19 4221
5 20 4222
6 21 4224
7 22 4225
8 23 4227
10 24 4230
11 25 4232
12 26 4234
15 27 4235
28 32 4193
31 39 4194
34 41 4197
35 43 4200
37 44 4205
38 45 4206
40 46 4208
42 47 4210
29 48 4238
30 49 4239...

result:

ok 

Test #66:

score: 0
Accepted
time: 145ms
memory: 3788kb

input:

12000
3 3 3 3 3 1 3 1 3 1 1 3 1 1 3 1 3 3 3 1 1 1 3 1 1 1 1 3 3 3 2 1 1 1 3 3 3 3 1 3 1 3 1 1 1 1 1 3 3 1 1 3 3 1 1 1 2 1 3 3 1 1 1 1 1 1 1 3 1 3 3 1 3 1 3 3 1 1 1 3 3 3 1 1 1 3 3 1 3 3 1 3 3 3 1 1 3 1 1 1 3 1 1 3 3 1 1 1 1 1 3 3 1 3 1 3 3 1 1 3 1 3 1 3 3 3 3 3 3 1 1 1 1 1 3 1 1 1 3 1 3 1 3 3 3 3 1 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
4000
5 30 6531
7 56 6535
9 233 6538
10 270 6539
12 309 6540
13 334 6541
15 335 6542
19 339 6543
20 342 6547
21 343 6550
0 344 6553
23 345 6554
1 346 6555
2 347 6556
3 348 6557
24 349 6558
4 350 6559
25 351 6560
26 352 6561
31 353 6562
6 354 6563
8 355 6564
1...

result:

ok 

Test #67:

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

input:

15000
3 3 1 3 3 2 3 2 1 1 2 1 3 1 1 3 1 2 2 2 2 1 2 2 2 2 2 2 2 2 1 1 2 3 2 2 1 1 1 1 1 1 1 3 3 3 1 1 3 1 3 1 1 3 3 3 1 3 1 3 1 1 1 3 3 1 3 1 3 1 2 1 3 1 3 1 1 1 1 3 3 3 3 3 3 1 3 1 3 3 1 3 3 1 1 1 1 1 1 3 1 1 1 1 3 3 3 3 2 3 3 3 1 3 1 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
2 5 5410
0 7 5452
8 10 5412
9 17 5417
11 18 5420
13 19 5422
14 20 5423
16 22 5425
21 23 5426
1 24 5456
3 25 5460
4 26 5461
6 27 5462
12 28 5465
15 29 5476
30 32 5427
31 34 5429
33 35 5477
36 70 5430
37 108 5432
38 118 5438
39 119 5440
40 120 5442
41 121...

result:

ok 

Test #68:

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

input:

15000
3 3 3 3 1 1 1 3 1 1 1 3 1 1 1 3 1 3 3 3 3 3 1 1 3 1 1 3 3 3 1 1 1 3 1 1 3 1 1 1 1 1 1 1 1 3 3 3 1 3 3 2 3 1 1 3 3 3 3 3 1 1 1 3 3 2 3 1 1 3 3 3 3 1 3 3 3 1 1 1 1 3 3 3 1 3 3 1 1 2 3 1 1 1 3 3 1 1 3 3 3 3 1 3 3 1 1 3 1 3 3 1 1 1 3 3 1 1 1 3 1 2 1 1 2 1 1 1 2 3 3 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
4 51 6947
5 65 6948
6 89 6949
8 121 6952
9 124 6954
10 128 6955
12 132 6956
0 133 6957
1 134 6958
2 135 6959
13 136 6960
14 137 6961
3 138 6962
16 139 6963
22 140 6964
23 141 6965
7 142 6966
25 143 6967
26 144 6968
11 145 6969
15 146 6970
17 147 6971
18...

result:

ok 

Test #69:

score: 0
Accepted
time: 202ms
memory: 3824kb

input:

15000
3 3 1 3 3 1 1 2 1 1 3 1 1 3 1 3 1 1 1 3 3 1 3 3 1 3 1 1 1 1 3 3 3 2 2 1 2 3 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 3 1 3 3 3 3 1 1 3 3 3 1 3 3 1 1 1 1 1 1 3 1 1 1 3 3 1 1 3 1 3 1 1 3 1 1 1 1 3 3 3 3 3 1 3 3 3 1 1 3 3 1 1 3 1 3 3 3 3 3 3 3 1 3 1 3 1 1 1 3 3 3 1 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
2 7 6104
5 33 6106
6 34 6107
8 36 6109
9 39 6112
11 40 6113
12 41 6115
14 42 6118
16 43 6119
17 44 6120
18 45 6121
21 46 6124
24 47 6128
26 48 6135
27 49 6138
28 50 6139
29 51 6142
35 52 6144
38 53 6148
0 54 6188
1 55 6189
3 56 6190
4 57 6192
10 58 6194...

result:

ok 

Test #70:

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

input:

15000
1 2 2 1 2 2 3 2 2 2 2 1 2 1 3 2 2 2 2 3 2 2 2 2 1 2 2 1 2 2 2 2 3 2 2 2 2 3 2 2 2 2 1 1 2 2 2 1 1 3 2 2 2 2 3 2 2 1 2 2 2 1 3 2 1 2 2 2 2 2 2 3 2 2 3 2 2 3 2 1 2 2 2 2 2 3 2 2 2 2 2 3 3 1 2 1 2 2 2 2 3 2 1 1 2 2 2 2 2 1 2 2 2 2 2 3 2 2 1 2 3 3 2 2 2 1 2 2 2 2 3 2 2 2 2 2 3 3 3 2 1 2 1 2 1 2 3 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
3267
0 1 8346
3 4 8348
6 7 8357
11 12 8349
13 15 8350
14 16 8358
19 20 8359
24 25 8355
27 28 8360
32 33 8361
37 38 8362
42 44 8363
43 45 8367
49 50 8364
47 51 8370
48 52 8374
54 55 8365
57 58 8375
62 63 8366
61 65 8376
64 66 8381
71 72 8368
74 75 8369
77 78 ...

result:

ok 

Test #71:

score: 0
Accepted
time: 159ms
memory: 3884kb

input:

15000
1 2 2 2 1 2 2 2 2 2 1 2 2 2 1 3 2 1 1 2 2 1 2 2 2 2 2 2 2 2 2 1 3 2 1 1 2 3 3 1 2 1 1 1 3 2 2 1 2 2 2 2 2 2 2 2 3 2 1 2 2 3 1 2 2 1 1 3 2 2 3 2 2 3 3 2 3 2 2 1 2 2 3 2 2 2 2 2 3 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 3 2 3 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 1 2 2 2 2 3 2 1 2 2 1 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
3340
0 1 8367
4 5 8369
10 11 8370
15 16 8300
14 19 8371
17 20 8372
18 22 8373
21 23 8374
32 33 8301
31 36 8377
37 40 8306
38 45 8307
44 46 8308
34 48 8378
35 49 8379
39 50 8382
41 51 8383
42 52 8386
43 53 8387
47 54 8388
56 57 8312
58 59 8390
61 63 8313
62 6...

result:

ok 

Test #72:

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

input:

14000
1 2 1 2 1 2 2 3 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 2 2 3 2 2 2 3 1 3 1 1 2 2 2 2 1 3 2 2 1 2 2 2 1 2 3 2 2 1 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 3 2 2 3 1 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 3 3 1 1 2 2 2 1 2 2 3 1 2 2 2 2 2 2 2 3 2 2 2 1 2 1 3 2 3 2 2 3 2 2 2 1 1 3 2 2 2 1 2 2 2 2 2 1 2 1 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
3042
0 1 7684
2 3 7685
4 5 7686
7 8 7863
10 11 7687
24 26 7691
25 27 7864
31 32 7866
36 40 7692
38 41 7696
39 42 7697
35 43 7869
44 46 7698
37 47 7873
48 49 7699
45 50 7875
52 53 7700
54 55 7877
57 58 7702
63 64 7706
69 70 7708
75 76 7880
79 80 7709
78 81 78...

result:

ok 

Test #73:

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

input:

13000
2 2 3 3 2 2 2 1 2 3 2 1 2 1 2 3 1 3 3 1 2 1 2 1 2 3 2 2 2 2 2 2 1 2 2 1 3 3 3 1 2 2 3 2 3 2 1 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 2 3 3 2 2 2 2 1 2 3 2 2 3 2 2 1 2 1 2 2 2 1 2 2 1 1 2 3 1 2 2 1 2 1 2 2 2 2 1 3 2 2 2 2 2 2 2 1 1 2 3 2 2 2 2 2 2 2 1 2 1 2 2 3 1 2 2 3 1 2 2 2 1 2 3 3 2 2 1 1 1 2 3 1 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2941
2 4 7231
3 5 7234
7 8 7145
9 10 7235
11 12 7149
13 14 7154
16 20 7155
19 22 7159
21 24 7161
23 26 7164
15 27 7236
17 28 7239
18 29 7240
25 30 7241
32 33 7166
35 40 7167
39 41 7172
36 43 7253
37 45 7254
46 47 7173
38 48 7255
42 49 7258
44 50 7260
51 52 7...

result:

ok 

Test #74:

score: 0
Accepted
time: 83ms
memory: 3816kb

input:

11000
2 2 2 3 2 2 2 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 3 2 2 2 2 1 2 1 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 3 2 1 1 2 2 2 2 1 2 2 3 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 3 2 2 3 2 1 3 2 2 2 2 1 2 2 3 2 2 3 2 2 2 2 2 2 2 3 2 1 2 2 3 1 2 2 3 2 2 3 2 3 2 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2460
3 4 6157
11 12 6042
13 14 6044
18 19 6045
29 30 6046
37 38 6159
42 43 6047
44 46 6049
45 47 6160
64 66 6051
67 69 6052
68 70 6054
63 71 6162
65 72 6163
73 74 6056
76 77 6165
79 80 6058
85 86 6062
93 95 6063
94 96 6072
104 105 6167
107 108 6172
109 111 6...

result:

ok 

Test #75:

score: 0
Accepted
time: 79ms
memory: 3816kb

input:

11000
2 2 3 1 2 1 2 2 2 3 2 2 2 2 2 3 2 1 2 2 1 2 3 2 1 2 3 2 2 1 2 2 2 2 2 2 3 3 2 2 2 2 2 1 2 1 2 2 1 1 2 1 1 2 2 3 2 2 2 2 2 2 2 1 2 2 3 1 1 2 2 1 3 2 1 2 3 2 3 1 2 2 2 1 2 2 2 2 3 2 2 2 3 1 2 1 2 2 2 2 3 2 1 2 2 1 3 2 3 3 2 2 2 1 2 2 2 2 2 3 1 2 2 1 2 2 3 2 2 3 2 2 2 2 1 3 2 2 2 2 2 1 2 2 3 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2423
2 4 5989
3 6 6207
5 7 6210
9 10 5993
15 16 5995
17 18 6211
20 21 6213
22 23 5998
24 25 6214
26 27 6000
29 30 6215
36 38 6003
37 39 6004
43 44 6218
45 46 6219
48 50 6221
49 53 6224
51 54 6225
55 56 6005
52 57 6226
63 64 6230
66 69 6006
67 70 6233
72 73 6...

result:

ok 

Test #76:

score: 0
Accepted
time: 78ms
memory: 3948kb

input:

11000
2 1 1 3 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 3 2 2 2 3 2 1 2 1 2 1 2 2 2 2 3 2 2 2 2 2 2 3 2 1 2 3 1 3 2 2 3 2 2 3 2 1 3 1 3 2 2 2 2 2 2 1 3 2 2 2 2 1 2 2 2 2 3 2 2 3 3 1 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 2 2 2 3 2 2 1 1 2 3 3 2 3 1 1 3 1 2 2 2 3 2 1 2 2 2 3 3 3 2 1 2 2 2 3 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2372
1 4 6168
2 5 6170
3 6 6174
9 10 6175
25 26 6171
32 33 6176
36 37 6177
38 39 6172
40 41 6173
42 43 6180
47 48 6178
54 55 6179
56 57 6181
58 61 6182
60 62 6183
59 64 6184
63 65 6188
66 67 6190
68 72 6185
70 73 6186
69 74 6191
71 75 6192
78 80 6187
79 81 6...

result:

ok 

Test #77:

score: 0
Accepted
time: 85ms
memory: 3832kb

input:

11000
2 2 1 2 3 2 2 1 2 2 2 3 1 2 2 2 2 2 2 2 3 2 2 1 2 2 2 2 2 3 2 2 1 1 2 3 2 3 2 2 2 2 2 2 2 2 1 3 2 3 3 2 2 2 3 2 2 2 1 2 2 1 3 3 2 2 2 3 2 2 2 2 3 2 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 3 2 2 2 2 2 1 2 2 2 2 2 2 2 1 3 1 1 2 3 3 2 2 2 2 2 1 2 2 2 2 1 2 2 1 2 3 2 2 2 2 2 1 1 3 2 2 1 2 3 2 2 2 1 1 2 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
2490
2 3 6084
4 5 6106
7 8 6085
12 13 6087
11 14 6110
20 21 6116
23 24 6088
29 30 6119
32 34 6089
33 36 6090
35 38 6120
37 39 6123
46 48 6091
47 51 6125
49 52 6127
50 53 6128
54 55 6130
58 59 6092
61 64 6097
62 65 6132
63 66 6133
67 68 6134
72 73 6135
74 76 ...

result:

ok 

Test #78:

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

input:

15000
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:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
7734 8258 14999

result:

ok 

Test #79:

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

input:

15000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
5343 5344 8595

result:

ok 

Test #80:

score: 0
Accepted
time: 67ms
memory: 3828kb

input:

15000
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:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
5000
0 5000 10000
1 5001 10001
2 5002 10002
3 5003 10003
4 5004 10004
5 5005 10005
6 5006 10006
7 5007 10007
8 5008 10008
9 5009 10009
10 5010 10010
11 5011 10011
12 5012 10012
13 5013 10013
14 5014 10014
15 5015 10015
16 5016 10016
17 5017 10017
18 5018 100...

result:

ok 

Test #81:

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

input:

15000
1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
1
0 1 14999

result:

ok 

Test #82:

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

input:

15000
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:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
3000
0 6000 12000
1 6001 12001
2 6002 12002
3 6003 12003
4 6004 12004
5 6005 12005
6 6006 12006
7 6007 12007
8 6008 12008
9 6009 12009
10 6010 12010
11 6011 12011
12 6012 12012
13 6013 12013
14 6014 12014
15 6015 12015
16 6016 12016
17 6017 12017
18 6018 120...

result:

ok 

Test #83:

score: 0
Accepted
time: 68ms
memory: 3984kb

input:

14997
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:

asnfasbfkjsafkajsdnsandjaksndjsankasnfjas
4977
0 4977 10020
1 4978 10021
2 4979 10022
3 4980 10023
4 4981 10024
5 4982 10025
6 4983 10026
7 4984 10027
8 4985 10028
9 4986 10029
10 4987 10030
11 4988 10031
12 4989 10032
13 4990 10033
14 4991 10034
15 4992 10035
16 4993 10036
17 4994 10037
18 4995 100...

result:

ok