QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#424940#6537. One, Two, ThreeBronyaWA 4ms26396kbC++202.3kb2024-05-29 20:03:112024-05-29 20:03:11

Judging History

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

  • [2024-05-29 20:03:11]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:26396kb
  • [2024-05-29 20:03:11]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
int n;
int a[1000006];
int A[10],last[10];
int op,b[10][1000005];
int u[1000005],v[1000005],w[1000005],cnt2;
int id[1000005];
bool Solve(int x,int y){
    bool pd=false;cnt2=0;//cerr<<x<<' '<<y<<endl;
    if(x+y>min({A[2],A[1],A[3]}))return true;
    for(int j=1;j<=x;j++){
        int X=A[3]-x+j;//cerr<<x<<" "<<y<<" "<<b[1][j] <<" "<<b[3][X]<<endl;
        if(b[1][j]>b[3][X])return true;
        u[++cnt2]=b[1][j],v[cnt2]=b[3][X];
    }
    for(int j=1;j<=y;j++){
        int X=A[1]-y+j;
        if(b[3][j]>b[1][X])return true;
        u[++cnt2]=b[3][j],v[cnt2]=b[1][X];
    }
    // cerr<<x<<" "<<y<<" "<<pd<<endl;
    return false;
}
bool cmp(int x,int y){
    return v[x]<v[y];
}
int lans[600005][3],now[600005][3];
bool check(){
    for(int i=1;i<=cnt2;i++)id[i]=i;
    sort(id+1,id+1+cnt2,cmp);
    set<int>st;
    for(int i=1;i<=A[2];i++)st.insert(b[2][i]);
    for(int i=1;i<=cnt2;i++){
        auto it=st.lower_bound(u[id[i]]);
        // cerr<<u[id[i]] <<" "<<v[id[i]]<<endl;
        if(it==st.end()||*it>v[id[i]])return false;
        lans[i][0]=u[id[i]];
        lans[i][1]=*it;
        lans[i][2]=v[id[i]];
        st.erase(it);
    }
    return true;
}
int cnt[600005][4];
int main(){
    // freopen("triples.in","r",stdin);
    // freopen("triples.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]),A[a[i]]++,b[a[i]][A[a[i]]]=i;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=3;j++)cnt[i][j]=cnt[i-1][j];
        cnt[i][a[i]]++;
    }
    int last=0,lima=n,limb=n,limab=n;
    for(int i=1;i<=n;i++){
        lima=min(lima,last+cnt[i][2]-cnt[i][3]+A[3]);
        last=min(last,cnt[i][1]-cnt[i][2]);
    }
    last=0;
    for(int i=1;i<=n;i++){
        limb=min(limb,last+cnt[i][2]-cnt[i][1]+A[1]);
        last=min(last,cnt[i][3]-cnt[i][2]);
    }
    last=0;
    for(int i=1;i<=n;i++){
        limab=min(limab,last+cnt[i][2]-cnt[i][1]+A[1]+A[3]-cnt[i][3]);
        last=min(last,cnt[i][1]+cnt[i][3]-cnt[i][2]);
    }
    lima=min(lima,limab);
    limb=min(limb,limab-lima);
    Solve(lima,limb);
    check();
    printf("%d\n",cnt2);
    for(int i=1;i<=cnt2;i++)printf("%d %d %d\n",lans[i][0]-1,lans[i][1]-1,lans[i][2]-1);
    return 0;
}

詳細信息

Test #1:

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

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: 2ms
memory: 14304kb

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

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

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
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 167 217
43 168 218
44 176 220
45 181 223
4...

result:

ok count=499

Test #4:

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

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: 0ms
memory: 22676kb

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: 0ms
memory: 22276kb

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 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
24 25 537
26 27 542
28 32 544
29 33 545
31 34 547
36 41 550
37 42 554
39 44 557
40 49 558
45 50 559
14 22 561
18 23 562
47 51 563
48 53 564
30 35 565
52 54 566
38 55 567
43 56 568
46 57 569
58 59 570
60 61 ...

result:

ok count=500

Test #7:

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

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
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 156 1910
32 157 1911
16 158 1912
33 159 1...

result:

ok count=1000

Test #8:

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

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
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
28 72 1642
29 73 1643
33 74 1644
35 75 16...

result:

ok count=1000

Test #9:

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

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
1 2 1205
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
0 3 1226
22 37 1227
10 38 1228
23 39 1229
25 40 1230
28 41 1231
12 42 1232
13 43 1233
29 44 1234
50 73 1235
53 74 1236
54 75 1237
15 45 1238
16 46 1239
17 47 1240
19 48 1241
56 76 124...

result:

ok count=999

Test #10:

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

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 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
53 75 1949
55 76 1950
15 77 1951
56 78 195...

result:

ok count=998

Test #11:

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

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
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
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
81 87 228
85 88 232
89 91 233
90 98 234
93 99 240
94 101 249
9...

result:

ok count=1000

Test #12:

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

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

result:

ok count=673

Test #13:

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

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: 0ms
memory: 22612kb

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

result:

ok count=629

Test #15:

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

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: 0ms
memory: 22252kb

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: 4ms
memory: 22412kb

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: 22232kb

input:

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

output:

3
4 6 10
7 11 12
1 3 13

result:

ok count=3

Test #19:

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

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: 22208kb

input:

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

output:

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

result:

ok count=5

Test #21:

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

input:

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

output:

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

result:

ok count=5

Test #22:

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

input:

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

output:

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

result:

ok count=6

Test #23:

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

input:

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

output:

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

result:

ok count=6

Test #24:

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

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: 22164kb

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: 22300kb

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: 22108kb

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: 22292kb

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: -100
Wrong Answer
time: 2ms
memory: 14044kb

input:

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

output:

0

result:

wrong answer the number of matches is different