QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#333720#6537. One, Two, ThreeECqwqWA 58ms57208kbC++141.6kb2024-02-20 13:48:552024-02-20 13:48:55

Judging History

你现在查看的是最新测评结果

  • [2024-02-20 13:48:55]
  • 评测
  • 测评结果:WA
  • 用时:58ms
  • 内存:57208kb
  • [2024-02-20 13:48:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e4+5;
int n,a[maxn],ans,ansx,ansy;
int pos[4][maxn],num[4],vis[maxn];
vector<pair<int, int> > vec[maxn];
bool check(int x,int y)
{
	if(x+y>min(num[1],min(num[2],num[3]))) return 0;
	for(int i=1;i<=x;i++)
		vec[pos[3][num[3]-(x-i)]].push_back(make_pair(pos[1][i],0));
	for(int i=1;i<=y;i++)
		vec[pos[1][num[1]-(y-i)]].push_back(make_pair(pos[3][i],1));
	int p[2]={0,0},l,r,k,ret=1;
	for(int i=1;i<=n;i++)
	{
		r=i;
		for(int j=0;j<vec[i].size();j++)
		{
			l=vec[i][j].first,k=vec[i][j].second;
			if(l>r) ret=0;
			p[k]=max(p[k],l);
			while(p[k]<r && (vis[p[k]]==1 || a[p[k]]!=2)) p[k]++;
			if(vis[p[k]]==0 && a[p[k]]==2) vis[p[k]]=1;
			else ret=0;
			if(ret==0) break;
		}
		if(ret==0) break;
	}
	for(int i=1;i<=n;i++) vis[i]=0,vec[i].clear();
	return ret;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		pos[a[i]][++num[a[i]]]=i;
	}
	int y=0;
	for(int x=0;x<=n/3;x++)
	{
		while(check(x,y+1)) y++;
		if(check(x,y) && x+y>ans) ans=x+y,ansx=x,ansy=y;
	}
	cout<<ans<<'\n';
	for(int i=1;i<=ansx;i++)
		vec[pos[3][num[3]-(ansx-i)]].push_back(make_pair(pos[1][i],0));
	for(int i=1;i<=ansy;i++)
		vec[pos[1][num[1]-(ansy-i)]].push_back(make_pair(pos[3][i],1));
	int p[2]={0,0},l,r,k;
	for(int i=1;i<=n;i++)
	{
		r=i;
		for(int j=0;j<vec[i].size();j++)
		{
			l=vec[i][j].first,k=vec[i][j].second;
			p[k]=max(p[k],l);
			while(p[k]<r && (vis[p[k]]==1 || a[p[k]]!=2)) p[k]++;
			vis[p[k]]=1;
			cout<<l-1<<' '<<p[k]-1<<' '<<r-1<<'\n';
		}
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3920kb

input:

6
3 1 2 2 3 1

output:

2
1 2 4
0 3 5

result:

ok count=2

Test #2:

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

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

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

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:

499
5 14 2313
8 18 2314
9 20 2318
11 27 2320
15 29 2321
22 30 2323
23 39 2324
24 46 2325
31 51 2326
47 54 2327
48 60 2328
72 79 2329
77 84 2330
78 87 2331
81 92 2332
85 97 2333
88 99 2334
98 105 2335
117 128 2336
119 138 2337
120 144 2338
125 148 2339
132 162 2341
133 167 2347
145 168 2348
146 176 2...

result:

ok count=499

Test #4:

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

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:

1
0 1374 2901

result:

ok count=1

Test #5:

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

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:

1
1755 1756 2819

result:

ok count=1

Test #6:

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

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:

500
0 3 530
1 7 532
2 8 533
4 9 534
5 10 536
6 11 537
12 16 542
13 17 544
15 20 545
19 21 547
24 25 550
14 22 552
18 23 553
26 27 554
30 32 555
38 41 556
28 33 557
29 34 558
31 35 559
43 44 560
46 49 561
60 61 562
36 42 563
37 50 564
62 63 565
39 51 566
64 65 567
67 68 568
71 72 569
40 53 570
74 75 ...

result:

ok count=500

Test #7:

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

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:

1000
0 7 1887
1 11 1888
5 79 1889
2 122 1890
6 138 1891
3 139 1892
4 140 1893
8 141 1894
9 142 1895
12 143 1896
10 144 1897
14 145 1899
13 146 1900
18 147 1901
19 148 1902
21 149 1903
15 150 1904
16 151 1905
24 152 1906
25 153 1907
17 154 1908
20 155 1909
22 156 1910
26 157 1911
23 158 1912
27 159 1...

result:

ok count=1000

Test #8:

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

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:

1000
1 31 1598
4 32 1600
9 41 1606
12 51 1609
16 52 1610
17 53 1611
18 54 1617
19 55 1619
20 56 1621
23 57 1622
26 58 1623
28 59 1624
29 60 1627
33 61 1630
0 62 1632
2 63 1633
3 64 1634
5 65 1635
35 66 1636
6 67 1637
36 68 1638
37 69 1639
39 70 1640
7 71 1641
40 72 1642
42 73 1643
45 74 1644
46 75 1...

result:

ok count=1000

Test #9:

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

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:

999
0 2 1213
10 21 1215
12 26 1216
13 27 1217
15 30 1218
16 31 1220
1 3 1221
17 32 1222
4 33 1223
5 34 1224
6 35 1225
19 36 1226
7 37 1227
24 38 1228
8 39 1229
9 40 1230
11 41 1231
51 73 1232
52 74 1233
14 42 1234
18 43 1235
20 44 1236
22 45 1237
55 75 1238
57 76 1239
60 77 1240
61 78 1241
23 46 124...

result:

ok count=999

Test #10:

score: 0
Accepted
time: 22ms
memory: 3924kb

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:

998
0 2 1925
8 18 1926
1 4 1927
3 6 1928
5 7 1929
9 31 1930
14 39 1931
16 49 1932
17 51 1933
10 59 1934
11 61 1935
21 62 1936
26 63 1937
12 64 1938
27 65 1939
13 66 1940
28 67 1941
15 68 1942
19 69 1943
33 70 1944
35 71 1945
20 72 1946
22 73 1947
23 74 1948
38 75 1949
41 76 1950
24 77 1951
45 78 195...

result:

ok count=998

Test #11:

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

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:

1000
3 4 125
5 6 126
7 12 129
13 15 131
19 21 135
20 22 136
23 25 137
24 27 138
26 28 140
29 36 143
30 38 145
31 40 148
32 44 152
33 49 153
35 54 155
39 59 157
41 60 162
42 61 163
43 63 164
46 67 167
47 72 172
48 76 175
56 80 176
58 82 177
64 83 180
65 87 184
66 88 187
69 91 188
71 98 191
73 99 207
...

result:

ok count=1000

Test #12:

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

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:

673
2 4 1662
13 14 1668
19 21 1669
32 34 1670
44 46 1671
49 50 1672
54 55 1674
63 64 1675
73 74 1677
79 80 1678
83 86 1679
92 93 1683
3 5 1684
7 8 1685
20 22 1686
25 26 1687
33 35 1688
45 47 1689
97 98 1690
101 102 1691
103 105 1692
104 106 1693
108 109 1694
115 116 1695
51 52 1696
53 56 1697
118 11...

result:

ok count=673

Test #13:

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

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:

683
2 4 1641
3 6 1642
11 12 1643
13 14 1645
15 16 1648
21 22 1649
5 9 1650
7 10 1651
8 17 1652
19 20 1653
26 28 1654
27 31 1655
32 33 1656
29 35 1657
39 40 1658
49 50 1659
66 68 1660
30 36 1661
67 69 1662
71 72 1663
74 76 1664
34 37 1665
45 46 1666
75 77 1667
81 82 1668
91 93 1669
92 94 1670
99 100 ...

result:

ok count=683

Test #14:

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

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:

629
1 2 1652
3 5 1655
12 13 1656
20 21 1657
22 23 1658
34 35 1659
41 45 1661
43 46 1663
47 48 1665
56 57 1667
59 60 1668
70 71 1669
81 82 1670
83 84 1671
93 94 1672
103 104 1673
117 119 1683
118 120 1686
124 125 1688
135 136 1690
137 138 1695
141 142 1696
149 150 1697
154 155 1702
158 159 1703
162 1...

result:

ok count=629

Test #15:

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

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:

712
0 3 1635
1 6 1637
8 9 1639
15 18 1641
28 30 1643
44 46 1644
45 47 1645
51 52 1648
2 7 1649
4 10 1650
5 11 1651
58 61 1652
59 63 1653
16 19 1654
60 65 1655
17 20 1656
21 22 1657
62 66 1658
64 68 1659
67 75 1660
69 76 1661
71 77 1662
26 27 1663
74 78 1664
81 82 1665
29 32 1666
91 92 1667
96 97 166...

result:

ok count=712

Test #16:

score: 0
Accepted
time: 16ms
memory: 3932kb

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:

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 1020 2020
21 1021 2021
22 1022 2022
23 102...

result:

ok count=1000

Test #17:

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:

1
0 2 2999

result:

ok count=1

Test #18:

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

input:

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

output:

3
1 3 8
2 6 9
5 11 13

result:

ok count=3

Test #19:

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

input:

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

output:

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

result:

ok count=6

Test #20:

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

input:

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

output:

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

result:

ok count=5

Test #21:

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

input:

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

output:

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

result:

ok count=5

Test #22:

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

input:

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

output:

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

result:

ok count=6

Test #23:

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

input:

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

output:

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

result:

ok count=6

Test #24:

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

input:

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

output:

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

result:

ok count=6

Test #25:

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

input:

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

output:

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

result:

ok count=5

Test #26:

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

input:

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

output:

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

result:

ok count=6

Test #27:

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

input:

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

output:

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

result:

ok count=5

Test #28:

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

input:

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

output:

2
1 2 11
6 12 16

result:

ok count=2

Test #29:

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

input:

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

output:

1
9 10 14

result:

ok count=1

Test #30:

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

input:

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

output:

2
0 1 9
7 10 14

result:

ok count=2

Test #31:

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

input:

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

output:

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

result:

ok count=5

Test #32:

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

input:

6
1 2 3 2 3 1

output:

2
0 1 4
2 3 5

result:

ok count=2

Test #33:

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

input:

6
2 1 3 3 1 2

output:

0

result:

ok count=0

Test #34:

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

input:

6
3 1 2 2 3 1

output:

2
1 2 4
0 3 5

result:

ok count=2

Test #35:

score: -100
Wrong Answer
time: 58ms
memory: 57208kb

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:

3317

result:

wrong answer the number of matches is different