QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#330181#6537. One, Two, ThreelmeowdnAC ✓1485ms26344kbC++143.2kb2024-02-17 13:28:162024-02-17 13:28:17

Judging History

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

  • [2024-02-17 13:28:17]
  • 评测
  • 测评结果:AC
  • 用时:1485ms
  • 内存:26344kb
  • [2024-02-17 13:28:16]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define fi first
#define se second
#define eb emplace_back

using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vp;
void chmax(int &x,int y) {x=(x<y?y:x);}

int read() {
  int x=0,w=1; char c=getchar();
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+c-'0'; c=getchar();}
  return x*w;
}

const int N=6e5+5;
int n,a[N],m1,m2,m3,p1[N],p2[N],p3[N],ans,gi,gj,pa[N],pb[N],qa[N],qb[N];

namespace Brute {
  bool check(int A,int B) {
    if(A+B>min(m1,min(m2,m3))) return 0;
    rep(i,1,n) pa[i]=pb[i]=0;
    rep(i,1,A) {
      int l=p1[i], r=p3[m3-A+i];
      if(l>r) return 0;
      pa[l]=r;
    }
    rep(i,1,B) {
      int l=p3[i], r=p1[m1-B+i];
      if(l>r) return 0;
      pb[l]=r;
    }
    static int q1[N],q2[N];
    int l1=1,r1=0,l2=1,r2=0;
    rep(i,1,n) {
      if(a[i]==1) {
        if(pa[i]) q1[++r1]=pa[i];
      } else if(a[i]==3) {
        if(pb[i]) q2[++r2]=pb[i];
      } else {
        if(l1>r1&&l2>r2) continue;
        else if(l2>r2||(l1<=r1&&q1[l1]<q2[l2])) {
          if(q1[l1]<i) return 0;
          else qa[q1[l1]]=i, ++l1;
        } else {
          if(q2[l2]<i) return 0;
          else qb[q2[l2]]=i, ++l2;
        }
      }
    }
    if(l1<=r1||l2<=r2) return 0;
    return 1;
  }
  void solve() {
    int z=min(m1,min(m2,m3)), j=z;
    rep(i,0,z) {
      while(j>=0&&!check(i,j)) --j;
      if(j>=0) {
        if(ans<i+j) {
          ans=i+j;
          gi=i, gj=j;
        }
      }
    }
    printf("%d\n",ans);
    if(!ans) return;
    check(gi,gj);
    rep(i,1,n) {
      if(pa[i]) printf("%d %d %d\n",i-1,qa[pa[i]]-1,pa[i]-1);
      else if(pb[i]) printf("%d %d %d\n",i-1,qb[pb[i]]-1,pb[i]-1);
    }
  }
}

namespace Donut {
  void solve() {
    int z=min(m1,min(m2,m3)), j=z;
    for(int x=0,y=z,p=0,q=z;x<=y;) {
      int i=(x+y)>>1, j=-1;
      for(int l=p,r=q;l<=r;) {
        int w=(l+r)>>1;
        if(Brute::check(i,w)) j=w, l=w+1;
        else r=w-1; 
      }
      if(j>=0) {
        if(ans<i+j) {
          ans=i+j;
          gi=i, gj=j;
        }
      }
      if(j==-1) y=i-1;
      else if(i==0) x=i+1, q=j;
      else if(i==z) y=i-1, p=j;
      else {
        int pj=0;
        for(int l=p,r=q;l<=r;) {
          int w=(l+r)>>1;
          if(Brute::check(i-1,w)) pj=w, l=w+1;
          else r=w-1; 
        }
        if(pj>=0) {
          if(ans<i-1+pj) {
            ans=i-1+pj;
            gi=i-1, gj=pj;
          }
        }
        if(i-1+pj>i+j) y=i-1, p=j;
        else x=i+1, q=j;
      }
    }
    printf("%d\n",ans);
    if(!ans) return;
    Brute::check(gi,gj);
    rep(i,1,n) {
      if(pa[i]) printf("%d %d %d\n",i-1,qa[pa[i]]-1,pa[i]-1);
      else if(pb[i]) printf("%d %d %d\n",i-1,qb[pb[i]]-1,pb[i]-1);
    }
  }
}

signed main() {
  n=read();
  rep(i,1,n) a[i]=read();
  rep(i,1,n) {
    if(a[i]==1) p1[++m1]=i;
    else if(a[i]==2) p2[++m2]=i;
    else p3[++m3]=i;
  }
  if(n<=10000) {
    Brute::solve();
    return 0;
  }
  Donut::solve();
  return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

6
3 1 2 2 3 1

output:

2
0 3 5
1 2 4

result:

ok count=2

Test #2:

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

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

score: 0
Accepted
time: 8ms
memory: 22196kb

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 67 2785
1 71 2795
2 113 2796
3 645 2813
4 650 2816
5 14 2313
6 671 2825
7 720 2839
8 18 2314
9 20 2318
10 721 2840
11 27 2320
12 1102 2842
13 1104 2852
15 29 2321
16 1209 2853
17 1211 2858
19 1385 2865
21 1388 2883
22 30 2323
23 39 2324
24 46 2325
25 1391 2899
26 1392 2908
28 1398 2909
31 51 2...

result:

ok count=499

Test #4:

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

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

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

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
14 22 552
15 20 545
18 23 553
19 21 547
24 25 550
26 27 554
28 33 557
29 34 558
30 32 555
31 35 559
36 42 563
37 50 564
38 41 556
39 51 566
40 53 570
43 44 560
45 54 573
46 49 561
47 55 576
48 56 577
52 57 580
58 59 581
60 61 ...

result:

ok count=500

Test #7:

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

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

result:

ok count=1000

Test #8:

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

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 62 1632
1 31 1598
2 63 1633
3 64 1634
4 32 1600
5 65 1635
6 67 1637
7 71 1641
8 77 1647
9 41 1606
10 79 1651
11 80 1652
12 51 1609
13 81 1653
14 82 1657
15 83 1658
16 52 1610
17 53 1611
18 54 1617
19 55 1619
20 56 1621
21 84 1662
22 85 1663
23 57 1622
24 86 1667
25 87 1672
26 58 1623
27 88 16...

result:

ok count=1000

Test #9:

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

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
1 3 1221
4 33 1223
5 34 1224
6 35 1225
7 37 1227
8 39 1229
9 40 1230
10 21 1215
11 41 1231
12 26 1216
13 27 1217
14 42 1234
15 30 1218
16 31 1220
17 32 1222
18 43 1235
19 36 1226
20 44 1236
22 45 1237
23 46 1242
24 38 1228
25 47 1246
28 48 1247
29 49 1249
50 84 1251
51 73 1232
52 74 123...

result:

ok count=999

Test #10:

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

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
1 4 1927
3 6 1928
5 7 1929
8 18 1926
9 31 1930
10 59 1934
11 61 1935
12 64 1938
13 66 1940
14 39 1931
15 68 1942
16 49 1932
17 51 1933
19 69 1943
20 72 1946
21 62 1936
22 73 1947
23 74 1948
24 77 1951
25 79 1953
26 63 1937
27 65 1939
28 67 1941
29 81 1955
30 84 1958
32 88 1962
33 70 194...

result:

ok count=998

Test #11:

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

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 17 2898
1 156 2905
2 199 2908
3 4 125
5 6 126
7 12 129
8 200 2910
9 211 2916
10 220 2919
11 222 2921
13 15 131
14 231 2922
16 246 2923
18 248 2925
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
34 271 2926
35 54 155
37 2832 2929
39 59 157
4...

result:

ok count=1000

Test #12:

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

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
3 5 1684
7 8 1685
13 14 1668
19 21 1669
20 22 1686
25 26 1687
32 34 1670
33 35 1688
44 46 1671
45 47 1689
49 50 1672
51 52 1696
53 56 1697
54 55 1674
57 58 1699
59 60 1702
63 64 1675
73 74 1677
76 77 1707
79 80 1678
81 82 1708
83 86 1679
84 88 1710
85 89 1711
87 90 1715
91 94 1716
92 93...

result:

ok count=673

Test #13:

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

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
5 9 1650
7 10 1651
8 17 1652
11 12 1643
13 14 1645
15 16 1648
19 20 1653
21 22 1649
26 28 1654
27 31 1655
29 35 1657
30 36 1661
32 33 1656
34 37 1665
39 40 1658
45 46 1666
48 51 1672
49 50 1659
53 54 1676
57 59 1680
58 60 1682
62 65 1686
63 70 1687
64 73 1688
66 68 1660
67 69 1...

result:

ok count=683

Test #14:

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

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
4 6 1710
12 13 1656
17 19 1711
18 24 1712
20 21 1657
22 23 1658
25 26 1713
34 35 1659
41 45 1661
42 49 1716
43 46 1663
44 50 1720
47 48 1665
51 52 1721
56 57 1667
59 60 1668
68 69 1725
70 71 1669
72 73 1726
75 77 1727
76 78 1728
81 82 1670
83 84 1671
88 89 1729
90 95 1732
91 96...

result:

ok count=629

Test #15:

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

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
2 7 1649
4 10 1650
5 11 1651
8 9 1639
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
49 53 1687
51 52 1648
54 56 1692
55 57 1693
58 61 1652
59 63 1653
60 65 1655
62 66 165...

result:

ok count=712

Test #16:

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

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

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

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

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
2 11 15
3 9 12
4 13 16
5 14 17

result:

ok count=6

Test #20:

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

input:

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

output:

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

result:

ok count=5

Test #21:

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

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
2 11 14
4 8 12
6 10 13

result:

ok count=5

Test #22:

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

input:

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

output:

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

result:

ok count=6

Test #23:

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

input:

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

output:

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

result:

ok count=6

Test #24:

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

input:

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

output:

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

result:

ok count=6

Test #25:

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

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

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
4 12 13
5 10 11
6 14 15
7 16 17

result:

ok count=6

Test #27:

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

input:

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

output:

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

result:

ok count=5

Test #28:

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

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

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

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

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

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

input:

6
2 1 3 3 1 2

output:

0

result:

ok count=0

Test #34:

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

input:

6
3 1 2 2 3 1

output:

2
0 3 5
1 2 4

result:

ok count=2

Test #35:

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

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:

4997
1 60 7484
2 5 7457
3 67 7488
4 78 7494
6 13 7458
7 91 7502
8 14 7459
9 94 7503
10 104 7507
11 107 7509
12 15 7460
16 112 7512
17 18 7461
19 23 7466
20 26 7470
21 27 7471
22 42 7475
24 113 7514
25 116 7515
28 118 7516
29 129 7520
30 145 7532
31 152 7534
32 165 7538
33 182 7544
34 48 7476
35 50 7...

result:

ok count=4997

Test #36:

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

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:

4999
0 4 7444
1 17 7518
2 9 7445
3 10 7446
5 20 7520
6 21 7524
7 13 7448
8 23 7527
11 15 7451
12 35 7528
14 113 7530
16 115 7534
18 140 7536
19 144 7537
22 147 7538
24 25 7456
26 27 7458
28 32 7459
29 34 7462
30 152 7542
31 168 7544
33 170 7547
36 39 7464
37 41 7466
38 45 7467
40 46 7468
42 171 7549...

result:

ok count=4999

Test #37:

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

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:

4998
0 1 7502
2 98 7505
3 4 7425
5 6 7426
7 8 7431
9 18 7440
10 23 7445
11 103 7506
12 25 7448
13 27 7450
14 113 7510
15 116 7512
16 30 7451
17 122 7513
19 37 7459
20 139 7516
21 140 7518
22 44 7465
24 145 7520
26 157 7528
28 160 7530
29 164 7533
31 169 7534
32 170 7535
33 171 7536
34 52 7466
35 57 ...

result:

ok count=4998

Test #38:

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

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:

5000
0 1 7454
2 5 7461
3 15 7465
4 21 7468
6 8 7455
7 24 7469
9 12 7458
10 13 7460
11 19 7467
14 29 7470
16 32 7475
17 42 7484
18 45 7485
20 54 7493
22 36 7479
23 37 7481
25 63 7499
26 88 7505
27 38 7482
28 46 7487
30 48 7488
31 90 7506
33 96 7512
34 51 7490
35 52 7491
39 53 7492
40 101 7517
41 58 7...

result:

ok count=5000

Test #39:

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

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:

5000
0 24 5292
1 41 5294
2 55 5318
3 58 5321
4 59 5322
5 62 5325
6 42 5295
7 43 5296
8 44 5299
9 46 5302
10 47 5303
11 65 5328
12 48 5306
13 66 5329
14 49 5308
15 67 5330
16 68 5331
17 50 5309
18 74 5337
19 51 5310
20 52 5311
21 53 5314
22 54 5316
23 76 5339
25 56 5319
26 57 5320
27 60 5323
28 61 53...

result:

ok count=5000

Test #40:

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

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:

5000
0 55 6208
1 30 6135
2 56 6209
3 42 6136
4 57 6213
5 58 6214
6 43 6137
7 45 6139
8 46 6140
9 47 6147
10 59 6215
11 60 6218
12 61 6219
13 62 6220
14 63 6221
15 64 6222
16 48 6148
17 49 6151
18 65 6225
19 50 6153
20 51 6155
21 66 6231
22 67 6232
23 68 6233
24 69 6235
25 70 6236
26 71 6237
27 72 62...

result:

ok count=5000

Test #41:

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

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:

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

result:

ok count=5000

Test #42:

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

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:

2000
0 128 2589
1 89 2507
2 129 2590
3 130 2591
4 90 2508
5 91 2509
6 92 2510
7 131 2592
8 133 2594
9 134 2595
10 135 2596
11 136 2597
12 93 2511
13 139 2600
14 141 2602
15 144 2605
16 94 2512
17 146 2609
18 95 2513
19 96 2514
20 97 2516
21 147 2615
22 98 2525
23 148 2616
24 149 2619
25 150 2620
26 ...

result:

ok count=2000

Test #43:

score: 0
Accepted
time: 49ms
memory: 22212kb

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:

3000
0 14 4227
1 16 4230
2 17 4232
3 18 4234
4 19 4235
5 20 4238
6 21 4239
7 22 4240
8 23 4244
9 13 4174
10 24 4246
11 25 4249
12 26 4251
15 27 4255
28 32 4175
29 48 4256
30 49 4257
31 39 4176
33 50 4260
34 41 4181
35 43 4183
36 51 4261
37 44 4186
38 45 4187
40 46 4190
42 47 4192
52 66 4193
53 84 41...

result:

ok count=3000

Test #44:

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

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:

4000
0 344 6553
1 346 6555
2 347 6556
3 348 6557
4 350 6559
5 30 6531
6 354 6563
7 56 6535
8 355 6564
9 233 6538
10 270 6539
11 356 6565
12 309 6540
13 334 6541
14 358 6567
15 335 6542
16 362 6571
17 364 6573
18 368 6577
19 339 6543
20 342 6547
21 343 6550
22 373 6582
23 345 6554
24 349 6558
25 351 ...

result:

ok count=4000

Test #45:

score: 0
Accepted
time: 8ms
memory: 22264kb

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:

5000
0 7 5436
1 19 5437
2 5 5427
3 22 5439
4 24 5441
6 27 5444
8 10 5429
9 17 5430
11 18 5432
12 28 5446
13 20 5438
14 23 5440
15 29 5448
16 25 5442
21 26 5443
30 32 5445
31 34 5447
33 35 5449
36 70 5450
37 108 5451
38 119 5453
39 120 5454
40 121 5455
41 123 5457
42 124 5458
43 118 5452
44 122 5456
...

result:

ok count=5000

Test #46:

score: 0
Accepted
time: 8ms
memory: 24340kb

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:

5000
0 51 6942
1 65 6944
2 89 6945
3 121 6950
4 132 6956
5 136 6960
6 137 6961
7 124 6951
8 139 6963
9 140 6964
10 141 6965
11 128 6953
12 143 6967
13 144 6968
14 151 6975
15 133 6957
16 152 6976
17 134 6958
18 135 6959
19 138 6962
20 142 6966
21 145 6969
22 156 6980
23 158 6982
24 146 6970
25 161 6...

result:

ok count=5000

Test #47:

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

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:

5000
0 54 6176
1 55 6179
2 7 6118
3 56 6181
4 57 6182
5 33 6119
6 34 6120
8 36 6121
9 39 6124
10 58 6183
11 40 6128
12 41 6135
13 59 6184
14 42 6138
15 60 6187
16 43 6139
17 44 6142
18 45 6144
19 61 6188
20 62 6189
21 46 6148
22 63 6190
23 64 6192
24 47 6154
25 65 6194
26 48 6156
27 49 6157
28 50 61...

result:

ok count=5000

Test #48:

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

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:

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

result:

ok count=3267

Test #49:

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

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:

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

result:

ok count=3340

Test #50:

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

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:

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
35 43 7869
36 40 7692
37 47 7873
38 41 7696
39 42 7697
44 46 7698
45 50 7875
48 49 7699
52 53 7700
54 55 7877
57 58 7702
63 64 7706
69 70 7708
75 76 7880
78 81 7881
79 80 7709
84 85 7710
88 89 7711
97 103 7883
98 10...

result:

ok count=3042

Test #51:

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

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:

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

result:

ok count=2941

Test #52:

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

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:

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
63 71 6162
64 66 6051
65 72 6163
67 69 6052
68 70 6054
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 6073
110 112 6173
115 116 6075
118 119 6175...

result:

ok count=2460

Test #53:

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

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:

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
52 57 6226
55 56 6005
63 64 6230
66 69 6006
67 70 6233
68 75 6234
71 81 6235
72 73 6007
74 82 6236
76 77...

result:

ok count=2423

Test #54:

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

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:

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

result:

ok count=2372

Test #55:

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

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:

2490
2 3 6084
4 5 6106
7 8 6085
11 14 6110
12 13 6087
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 6099
75 77 6100
87 88 6103
89 90 6136
95 9...

result:

ok count=2490

Test #56:

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

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:

1
7734 8258 14999

result:

ok count=1

Test #57:

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

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:

1
1354 1355 5343

result:

ok count=1

Test #58:

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

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:

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 10018
19 5019 10019
20 5020 10020
21 5021 100...

result:

ok count=5000

Test #59:

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

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:

1
0 1 14999

result:

ok count=1

Test #60:

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

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:

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 12018
19 6019 12019
20 6020 12020
21 6021 120...

result:

ok count=3000

Test #61:

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

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:

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 10038
19 4996 10039
20 4997 10040
21 4998 100...

result:

ok count=4977

Test #62:

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

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:

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

result:

ok count=29

Test #63:

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

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:

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

result:

ok count=29

Test #64:

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

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:

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

result:

ok count=28

Test #65:

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

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:

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

result:

ok count=30

Test #66:

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

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:

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

result:

ok count=29

Test #67:

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

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:

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

result:

ok count=28

Test #68:

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

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:

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

result:

ok count=27

Test #69:

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

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:

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

result:

ok count=30

Test #70:

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

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:

1
0 29 58

result:

ok count=1

Test #71:

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

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:

1
29 30 93

result:

ok count=1

Test #72:

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

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:

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

result:

ok count=33

Test #73:

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

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:

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

result:

ok count=32

Test #74:

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

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:

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

result:

ok count=33

Test #75:

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

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:

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

result:

ok count=31

Test #76:

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

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:

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

result:

ok count=30

Test #77:

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

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:

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
31 68 70
32 72 81
33 66 67
34 69 73
35 71 80
36 78 89
37 79 92
40 74 83
41 75 84
42 76 85
45 77 86
50 82 97

result:

ok count=20

Test #78:

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

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:

18
7 8 70
9 10 73
16 17 59
22 23 60
24 25 80
26 27 61
33 89 90
38 67 71
39 68 77
42 72 79
43 74 81
46 75 82
49 76 84
50 78 86
54 83 87
55 85 88
58 91 96
62 92 97

result:

ok count=18

Test #79:

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

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:

15
0 1 43
7 9 46
8 10 50
12 13 62
14 15 63
21 26 52
22 65 74
23 28 55
24 66 78
25 30 58
27 31 59
29 67 83
35 64 73
36 68 85
37 69 97

result:

ok count=15

Test #80:

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

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:

21
2 5 62
3 4 54
6 7 75
10 11 79
12 16 82
13 17 91
14 23 92
18 19 56
20 22 58
25 26 60
27 29 61
28 30 63
33 64 66
42 65 68
43 67 74
44 69 78
46 70 80
51 71 83
55 72 86
57 73 95
59 76 96

result:

ok count=21

Test #81:

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

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:

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 62 95
30 63 96
31 64 97
32 65 98

result:

ok count=33

Test #82:

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

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:

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

result:

ok count=33

Test #83:

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

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:

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

result:

ok count=32

Test #84:

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

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:

999
1 2 159
3 6 164
4 10 165
5 17 2874
7 13 169
8 27 2877
9 15 172
11 114 2881
12 120 2884
14 16 173
18 20 174
19 124 2889
21 234 2894
22 23 177
24 25 178
26 1714 2898
28 30 182
29 38 187
31 1752 2899
32 41 189
33 42 191
34 45 192
35 49 197
36 50 198
37 54 200
39 1753 2903
40 2193 2908
43 2194 2909
...

result:

ok count=999

Test #85:

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

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:

995
0 13 2889
1 4 111
2 37 2890
3 8 115
5 40 2894
6 9 117
7 10 119
11 41 2895
12 42 2896
14 19 120
15 22 123
16 24 126
17 1955 2897
18 27 131
20 28 140
21 29 144
23 1958 2899
25 30 145
26 1977 2900
31 1986 2904
32 34 147
33 36 150
35 1989 2908
38 39 151
43 2003 2911
44 57 153
45 2004 2921
46 60 159
...

result:

ok count=995

Test #86:

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

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 #87:

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

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 #88:

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

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 #89:

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

input:

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

output:

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

result:

ok count=29

Test #90:

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

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 #91:

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

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
2 11 15
3 9 12
4 13 16
5 14 17

result:

ok count=6

Test #92:

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

input:

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

output:

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

result:

ok count=5

Test #93:

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

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
2 11 14
4 8 12
6 10 13

result:

ok count=5

Test #94:

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

input:

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

output:

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

result:

ok count=6

Test #95:

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

input:

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

output:

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

result:

ok count=6

Test #96:

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

input:

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

output:

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

result:

ok count=6

Test #97:

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

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 #98:

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

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
4 12 13
5 10 11
6 14 15
7 16 17

result:

ok count=6

Test #99:

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

input:

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

output:

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

result:

ok count=5

Test #100:

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

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:

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

result:

ok count=29

Test #101:

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

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:

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

result:

ok count=29

Test #102:

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

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:

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

result:

ok count=28

Test #103:

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

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:

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

result:

ok count=30

Test #104:

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

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:

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

result:

ok count=29

Test #105:

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

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:

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

result:

ok count=28

Test #106:

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

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:

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

result:

ok count=27

Test #107:

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

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:

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

result:

ok count=30

Test #108:

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

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:

1
0 29 58

result:

ok count=1

Test #109:

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

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:

1
29 30 93

result:

ok count=1

Test #110:

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

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:

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

result:

ok count=33

Test #111:

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

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:

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

result:

ok count=32

Test #112:

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

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:

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

result:

ok count=33

Test #113:

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

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:

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

result:

ok count=31

Test #114:

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

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:

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

result:

ok count=30

Test #115:

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

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:

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
31 68 70
32 72 81
33 66 67
34 69 73
35 71 80
36 78 89
37 79 92
40 74 83
41 75 84
42 76 85
45 77 86
50 82 97

result:

ok count=20

Test #116:

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

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:

18
7 8 70
9 10 73
16 17 59
22 23 60
24 25 80
26 27 61
33 89 90
38 67 71
39 68 77
42 72 79
43 74 81
46 75 82
49 76 84
50 78 86
54 83 87
55 85 88
58 91 96
62 92 97

result:

ok count=18

Test #117:

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

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:

15
0 1 43
7 9 46
8 10 50
12 13 62
14 15 63
21 26 52
22 65 74
23 28 55
24 66 78
25 30 58
27 31 59
29 67 83
35 64 73
36 68 85
37 69 97

result:

ok count=15

Test #118:

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

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:

21
2 5 62
3 4 54
6 7 75
10 11 79
12 16 82
13 17 91
14 23 92
18 19 56
20 22 58
25 26 60
27 29 61
28 30 63
33 64 66
42 65 68
43 67 74
44 69 78
46 70 80
51 71 83
55 72 86
57 73 95
59 76 96

result:

ok count=21

Test #119:

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

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:

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 62 95
30 63 96
31 64 97
32 65 98

result:

ok count=33

Test #120:

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

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:

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

result:

ok count=33

Test #121:

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

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:

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

result:

ok count=32

Test #122:

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

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:

999
1 2 159
3 6 164
4 10 165
5 17 2874
7 13 169
8 27 2877
9 15 172
11 114 2881
12 120 2884
14 16 173
18 20 174
19 124 2889
21 234 2894
22 23 177
24 25 178
26 1714 2898
28 30 182
29 38 187
31 1752 2899
32 41 189
33 42 191
34 45 192
35 49 197
36 50 198
37 54 200
39 1753 2903
40 2193 2908
43 2194 2909
...

result:

ok count=999

Test #123:

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

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:

995
0 13 2889
1 4 111
2 37 2890
3 8 115
5 40 2894
6 9 117
7 10 119
11 41 2895
12 42 2896
14 19 120
15 22 123
16 24 126
17 1955 2897
18 27 131
20 28 140
21 29 144
23 1958 2899
25 30 145
26 1977 2900
31 1986 2904
32 34 147
33 36 150
35 1989 2908
38 39 151
43 2003 2911
44 57 153
45 2004 2921
46 60 159
...

result:

ok count=995

Test #124:

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

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 67 2785
1 71 2795
2 113 2796
3 645 2813
4 650 2816
5 14 2313
6 671 2825
7 720 2839
8 18 2314
9 20 2318
10 721 2840
11 27 2320
12 1102 2842
13 1104 2852
15 29 2321
16 1209 2853
17 1211 2858
19 1385 2865
21 1388 2883
22 30 2323
23 39 2324
24 46 2325
25 1391 2899
26 1392 2908
28 1398 2909
31 51 2...

result:

ok count=499

Test #125:

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

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 #126:

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

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 #127:

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

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
14 22 552
15 20 545
18 23 553
19 21 547
24 25 550
26 27 554
28 33 557
29 34 558
30 32 555
31 35 559
36 42 563
37 50 564
38 41 556
39 51 566
40 53 570
43 44 560
45 54 573
46 49 561
47 55 576
48 56 577
52 57 580
58 59 581
60 61 ...

result:

ok count=500

Test #128:

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

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

result:

ok count=1000

Test #129:

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

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 62 1632
1 31 1598
2 63 1633
3 64 1634
4 32 1600
5 65 1635
6 67 1637
7 71 1641
8 77 1647
9 41 1606
10 79 1651
11 80 1652
12 51 1609
13 81 1653
14 82 1657
15 83 1658
16 52 1610
17 53 1611
18 54 1617
19 55 1619
20 56 1621
21 84 1662
22 85 1663
23 57 1622
24 86 1667
25 87 1672
26 58 1623
27 88 16...

result:

ok count=1000

Test #130:

score: 0
Accepted
time: 8ms
memory: 22244kb

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
1 3 1221
4 33 1223
5 34 1224
6 35 1225
7 37 1227
8 39 1229
9 40 1230
10 21 1215
11 41 1231
12 26 1216
13 27 1217
14 42 1234
15 30 1218
16 31 1220
17 32 1222
18 43 1235
19 36 1226
20 44 1236
22 45 1237
23 46 1242
24 38 1228
25 47 1246
28 48 1247
29 49 1249
50 84 1251
51 73 1232
52 74 123...

result:

ok count=999

Test #131:

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

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
1 4 1927
3 6 1928
5 7 1929
8 18 1926
9 31 1930
10 59 1934
11 61 1935
12 64 1938
13 66 1940
14 39 1931
15 68 1942
16 49 1932
17 51 1933
19 69 1943
20 72 1946
21 62 1936
22 73 1947
23 74 1948
24 77 1951
25 79 1953
26 63 1937
27 65 1939
28 67 1941
29 81 1955
30 84 1958
32 88 1962
33 70 194...

result:

ok count=998

Test #132:

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

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 17 2898
1 156 2905
2 199 2908
3 4 125
5 6 126
7 12 129
8 200 2910
9 211 2916
10 220 2919
11 222 2921
13 15 131
14 231 2922
16 246 2923
18 248 2925
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
34 271 2926
35 54 155
37 2832 2929
39 59 157
4...

result:

ok count=1000

Test #133:

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

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
3 5 1684
7 8 1685
13 14 1668
19 21 1669
20 22 1686
25 26 1687
32 34 1670
33 35 1688
44 46 1671
45 47 1689
49 50 1672
51 52 1696
53 56 1697
54 55 1674
57 58 1699
59 60 1702
63 64 1675
73 74 1677
76 77 1707
79 80 1678
81 82 1708
83 86 1679
84 88 1710
85 89 1711
87 90 1715
91 94 1716
92 93...

result:

ok count=673

Test #134:

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

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
5 9 1650
7 10 1651
8 17 1652
11 12 1643
13 14 1645
15 16 1648
19 20 1653
21 22 1649
26 28 1654
27 31 1655
29 35 1657
30 36 1661
32 33 1656
34 37 1665
39 40 1658
45 46 1666
48 51 1672
49 50 1659
53 54 1676
57 59 1680
58 60 1682
62 65 1686
63 70 1687
64 73 1688
66 68 1660
67 69 1...

result:

ok count=683

Test #135:

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

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
4 6 1710
12 13 1656
17 19 1711
18 24 1712
20 21 1657
22 23 1658
25 26 1713
34 35 1659
41 45 1661
42 49 1716
43 46 1663
44 50 1720
47 48 1665
51 52 1721
56 57 1667
59 60 1668
68 69 1725
70 71 1669
72 73 1726
75 77 1727
76 78 1728
81 82 1670
83 84 1671
88 89 1729
90 95 1732
91 96...

result:

ok count=629

Test #136:

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

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
2 7 1649
4 10 1650
5 11 1651
8 9 1639
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
49 53 1687
51 52 1648
54 56 1692
55 57 1693
58 61 1652
59 63 1653
60 65 1655
62 66 165...

result:

ok count=712

Test #137:

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

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 #138:

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

input:

600000
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...

output:

1
0 2 599999

result:

ok count=1

Test #139:

score: 0
Accepted
time: 566ms
memory: 24632kb

input:

600000
1 1 3 1 2 1 2 3 2 1 1 2 3 2 2 1 2 1 1 3 2 1 1 2 1 3 3 3 1 2 3 3 1 1 1 3 1 3 2 2 1 3 3 2 3 2 3 2 2 2 1 1 1 1 2 3 1 1 1 2 1 1 1 3 3 3 3 3 1 1 3 2 3 2 2 3 2 1 2 3 2 1 3 3 3 3 3 1 1 1 3 3 1 1 1 3 3 2 2 1 2 3 2 2 3 3 2 2 2 2 3 1 1 2 1 1 2 1 1 3 3 3 1 3 3 1 2 2 3 2 2 1 2 1 1 1 1 2 1 2 1 3 1 2 2 1 3...

output:

200000
0 4 299525
1 6 299529
2 671 300332
3 8 299530
5 11 299535
7 675 300335
9 13 299537
10 14 299538
12 677 300343
15 16 299544
17 20 299546
18 23 299555
19 699 300347
21 29 299558
22 38 299560
24 39 299563
25 703 300349
26 704 300352
27 705 300353
28 43 299565
30 712 300356
31 713 300357
32 45 29...

result:

ok count=200000

Test #140:

score: 0
Accepted
time: 473ms
memory: 25056kb

input:

600000
3 1 2 3 3 2 1 1 1 2 3 2 2 3 3 3 2 2 2 2 2 3 1 3 3 1 2 1 3 1 3 1 2 3 3 3 1 1 2 1 2 1 1 3 1 3 1 2 1 1 3 2 2 2 3 2 2 2 1 1 1 3 2 1 1 1 2 3 1 2 1 1 2 3 3 3 2 3 2 2 2 1 1 2 3 1 2 1 3 2 2 3 1 1 3 1 2 2 2 1 3 3 3 1 1 2 1 1 3 3 3 2 2 3 1 2 2 1 3 1 1 2 3 3 3 3 3 1 1 3 3 3 2 1 1 3 3 2 2 2 3 2 2 3 1 1 3...

output:

200000
0 2 299522
1 12 300482
3 5 299528
4 9 299529
6 19 300483
7 20 300484
8 72 300487
10 11 299531
13 16 299534
14 17 299538
15 18 299540
21 26 299543
22 83 300488
23 32 299544
24 38 299545
25 90 300493
27 98 300495
28 40 299547
29 525 300498
30 47 299550
31 531 300499
33 51 299553
34 52 299555
35...

result:

ok count=200000

Test #141:

score: 0
Accepted
time: 31ms
memory: 24236kb

input:

210000
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 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 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 3 1 1 1 1 1 1 1 3 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

4999
1 39 104463
2 54 104487
3 65 104529
4 105 104533
5 156 104626
6 240 104652
7 324 104660
8 377 104678
9 465 104686
10 500 104711
11 542 104717
12 550 104729
13 563 104839
14 568 104885
15 571 104897
16 613 104921
17 675 104925
18 686 104965
19 703 105086
20 744 105115
21 781 105130
22 792 105315...

result:

ok count=4999

Test #142:

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

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:

5000
0 1 7454
2 5 7461
3 15 7465
4 21 7468
6 8 7455
7 24 7469
9 12 7458
10 13 7460
11 19 7467
14 29 7470
16 32 7475
17 42 7484
18 45 7485
20 54 7493
22 36 7479
23 37 7481
25 63 7499
26 88 7505
27 38 7482
28 46 7487
30 48 7488
31 90 7506
33 96 7512
34 51 7490
35 52 7491
39 53 7492
40 101 7517
41 58 7...

result:

ok count=5000

Test #143:

score: 0
Accepted
time: 391ms
memory: 24512kb

input:

600000
3 2 1 3 1 1 2 3 1 1 2 1 2 2 1 1 2 1 1 2 2 2 1 2 3 3 2 2 1 2 3 1 2 1 2 2 3 2 2 1 3 1 2 2 3 1 2 1 2 3 1 2 1 1 2 3 2 2 2 1 2 3 3 1 2 1 3 2 3 1 3 2 1 2 3 2 1 1 3 1 2 3 2 1 2 3 1 3 2 1 1 1 2 2 1 1 1 2 1 3 2 2 2 3 2 2 2 3 1 2 1 3 2 3 3 2 3 1 1 3 3 3 1 1 3 1 1 1 1 1 2 1 3 2 2 3 1 2 1 1 1 2 2 1 2 2 2...

output:

200000
0 1 299648
2 12 300030
3 6 299651
4 13 300037
5 16 300039
7 10 299656
8 19 300041
9 20 300052
11 21 300056
14 23 300057
15 29 300063
17 34 300066
18 35 300069
22 38 300070
24 26 299659
25 27 299661
28 43 300072
30 32 299664
31 48 300077
33 54 300078
36 37 299665
39 57 300081
40 42 299669
41 5...

result:

ok count=200000

Test #144:

score: 0
Accepted
time: 990ms
memory: 24824kb

input:

600000
1 1 3 3 1 1 3 1 3 1 3 3 1 3 3 1 3 3 1 3 1 3 3 3 3 1 3 1 3 3 1 1 1 1 3 1 1 3 3 1 3 1 1 1 3 3 3 3 1 3 1 3 1 3 3 1 1 3 3 3 3 3 1 1 1 1 3 1 1 3 3 3 3 1 1 1 3 1 3 3 1 1 3 1 3 1 1 3 1 1 3 3 3 3 1 1 3 3 1 1 3 3 1 1 1 1 3 3 3 1 1 1 1 1 3 1 1 3 1 1 3 1 1 3 1 3 1 3 3 1 3 3 1 1 1 1 3 1 3 3 3 3 1 3 3 1 1...

output:

200000
0 947 351487
1 2611 351490
2 11345 351512
3 11346 351513
4 3964 351493
5 8354 351494
6 11349 351516
7 8355 351496
8 11350 351517
9 11205 351499
10 11351 351518
11 11353 351520
12 11334 351502
13 11359 351526
14 11362 351529
15 11341 351503
16 11364 351531
17 11368 351535
18 11342 351506
19 11...

result:

ok count=200000

Test #145:

score: 0
Accepted
time: 1290ms
memory: 25000kb

input:

600000
3 1 3 3 3 1 1 1 1 3 3 1 3 1 3 1 1 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 1 1 3 3 3 1 1 1 3 3 1 1 3 3 1 1 3 1 1 1 1 1 3 3 1 1 1 3 1 3 3 3 1 1 3 3 1 3 1 1 3 3 1 3 1 3 3 3 1 1 3 3 3 1 1 1 3 3 1 1 1 3 3 1 1 3 1 3 1 1 3 3 1 1 1 3 1 1 1 3 1 1 3 3 3 3 1 1 1 1 1 3 3 1 3 3 1 1 1 1 1 3 1 3 3 1 1 3 1 3 1...

output:

200000
0 6995 337977
1 11056 339145
2 8232 337978
3 9381 337979
4 10408 337980
5 11060 339149
6 11066 339155
7 11067 339156
8 11068 339157
9 10446 337981
10 10456 337983
11 11069 339158
12 10458 337986
13 11070 339159
14 10459 337988
15 11071 339160
16 11072 339161
17 10460 337989
18 10461 337990
19...

result:

ok count=200000

Test #146:

score: 0
Accepted
time: 1408ms
memory: 25072kb

input:

600000
1 3 3 3 1 3 1 3 1 1 3 1 3 1 3 3 3 1 1 1 3 1 1 1 3 1 3 3 3 1 3 3 3 3 3 3 1 1 1 3 3 3 1 1 3 3 3 3 3 1 3 3 3 3 1 3 3 3 3 1 1 1 1 1 3 3 3 3 1 1 1 3 3 1 1 1 3 1 1 1 1 3 3 3 3 3 1 3 3 3 1 3 1 3 3 1 1 3 3 3 1 1 3 1 3 3 1 1 1 3 3 1 1 1 1 3 1 3 1 1 1 3 1 3 3 3 1 3 3 1 1 3 1 1 3 3 1 1 1 3 3 1 1 3 1 3 3...

output:

200000
0 2788 343214
1 619 342698
2 1022 342701
3 1263 342702
4 2790 343216
5 1717 342708
6 2791 343217
7 1759 342710
8 2793 343219
9 2795 343221
10 2438 342711
11 2799 343225
12 2469 342713
13 2804 343230
14 2499 342714
15 2521 342717
16 2523 342719
17 2805 343231
18 2806 343232
19 2807 343233
20 2...

result:

ok count=200000

Test #147:

score: 0
Accepted
time: 43ms
memory: 22276kb

input:

60000
1 1 1 3 3 1 3 3 1 1 1 3 1 3 1 3 1 3 1 1 1 1 3 3 1 1 1 3 1 1 3 1 1 3 3 1 3 3 3 1 1 1 3 1 1 3 1 1 1 3 3 3 3 3 1 3 3 1 1 1 1 1 1 3 3 1 1 1 3 1 1 3 1 1 1 3 3 3 3 1 1 1 1 1 3 3 3 1 3 3 1 3 3 1 3 1 3 3 1 1 3 1 3 1 3 1 3 1 3 3 3 3 3 3 1 1 3 3 3 1 1 1 1 1 1 1 3 3 3 3 1 1 3 3 3 3 3 3 3 1 1 1 3 3 3 3 1 ...

output:

20000
0 348 27466
1 397 27468
2 402 27469
3 167 27460
4 289 27461
5 406 27470
6 304 27465
7 391 27467
8 428 27472
9 433 27473
10 434 27474
11 423 27471
12 436 27476
13 435 27475
14 439 27479
15 437 27477
16 440 27480
17 438 27478
18 445 27486
19 455 27496
20 459 27500
21 460 27501
22 441 27481
23 44...

result:

ok count=20000

Test #148:

score: 0
Accepted
time: 84ms
memory: 24452kb

input:

90000
3 1 1 3 3 1 3 3 3 3 3 3 1 1 3 3 1 1 1 3 3 1 3 1 1 1 3 3 3 3 3 1 1 1 1 1 1 1 3 3 3 1 1 3 3 3 1 1 1 3 3 1 3 1 1 1 3 1 1 3 3 3 1 1 1 1 3 3 3 3 1 1 1 1 1 1 1 3 3 3 3 3 3 1 1 1 3 1 1 3 3 1 1 3 3 1 1 3 3 1 1 3 3 1 1 1 1 3 1 3 3 1 3 1 1 3 1 3 3 1 3 3 3 1 3 1 3 1 3 1 3 1 3 1 3 3 3 1 1 3 3 3 3 1 3 3 1 ...

output:

30000
0 390 31647
1 254 31479
2 282 31481
3 391 31648
4 392 31649
5 283 31482
6 393 31650
7 394 31651
8 399 31656
9 400 31657
10 401 31658
11 404 31661
12 303 31486
13 304 31487
14 410 31667
15 411 31668
16 315 31489
17 319 31490
18 320 31494
19 412 31669
20 414 31671
21 321 31496
22 417 31674
23 32...

result:

ok count=30000

Test #149:

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

input:

120000
3 3 1 3 3 3 3 3 3 1 3 1 1 3 1 1 1 3 1 3 3 3 3 3 1 1 1 1 1 1 1 3 3 1 3 3 3 1 1 1 3 3 1 1 1 3 1 1 3 1 1 3 3 1 3 1 1 1 1 1 1 3 1 3 1 3 1 1 3 1 3 3 3 3 1 1 1 1 3 3 3 3 3 3 3 3 1 1 3 1 1 1 3 1 3 3 1 1 1 3 1 3 3 3 3 3 3 3 3 3 1 3 3 1 3 3 1 1 3 3 1 1 3 3 1 1 1 3 1 3 3 3 3 1 1 3 1 3 3 1 1 1 1 3 1 3 1...

output:

40000
0 1277 63141
1 1283 63147
2 556 62558
3 1285 63149
4 1287 63151
5 1288 63152
6 1292 63156
7 1293 63157
8 1295 63159
9 819 62559
10 1298 63162
11 933 62560
12 947 62561
13 1300 63164
14 949 62563
15 970 62566
16 976 62571
17 1303 63167
18 993 62573
19 1304 63168
20 1309 63173
21 1311 63175
22 1...

result:

ok count=40000

Test #150:

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

input:

150000
3 3 3 3 1 3 3 1 1 1 3 3 3 1 3 3 1 3 3 3 3 1 3 3 3 1 3 3 3 1 3 1 3 1 1 3 3 1 1 3 1 3 1 3 1 3 3 1 1 1 1 1 1 3 1 1 3 3 1 3 1 3 3 3 3 3 3 1 3 3 3 3 3 1 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 1 3 1 3 1 1 1 1 1 3 1 3 3 1 1 3 1 3 1 1 3 1 3 3 1 1 3 1 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 1 1 2 1 1 1 3 3 1 1 3 1 1 3 1...

output:

50000
0 4850 95473
1 4851 95474
2 4852 95475
3 4857 95480
4 134 95062
5 4858 95481
6 4860 95483
7 1872 95063
8 3709 95064
9 4402 95066
10 4861 95484
11 4862 95485
12 4865 95488
13 4591 95069
14 4866 95489
15 4867 95490
16 4600 95072
17 4869 95492
18 4871 95494
19 4872 95495
20 4873 95496
21 4601 950...

result:

ok count=50000

Test #151:

score: 0
Accepted
time: 247ms
memory: 24552kb

input:

150000
1 1 1 1 3 1 3 3 1 1 1 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 3 3 3 3 1 3 1 3 1 1 1 3 1 1 3 3 3 3 3 1 1 1 1 3 3 1 3 1 1 3 3 1 1 1 3 3 1 3 3 3 3 1 3 3 1 1 3 3 1 1 3 1 3 3 1 1 1 3 3 1 3 1 1 1 3 3 3 1 1 1 1 3 3 1 3 3 3 3 1 1 1 3 1 1 1 3 1 1 1 1 1 3 1 3 1 1 1 3 3 1 3 3 1 3 3 1 3 3 3 3 1 3 3 3 3 1 3 3 3 3 1...

output:

50000
0 2483 66926
1 3463 66928
2 5543 66931
3 5668 66932
4 6494 67028
5 6350 66933
6 6495 67029
7 6496 67030
8 6434 66934
9 6437 66935
10 6446 66937
11 6449 66938
12 6450 66939
13 6451 66940
14 6497 67031
15 6498 67032
16 6452 66941
17 6500 67034
18 6453 66949
19 6454 66950
20 6455 66951
21 6503 67...

result:

ok count=50000

Test #152:

score: 0
Accepted
time: 144ms
memory: 22456kb

input:

150000
1 3 3 3 3 3 3 1 1 1 3 1 1 1 1 3 1 1 1 3 1 1 1 3 3 3 1 1 1 3 1 3 1 1 1 1 3 1 3 1 3 1 1 1 3 3 1 1 1 3 3 1 1 1 3 3 3 1 3 3 3 1 3 3 1 3 1 3 3 3 3 1 1 3 3 1 1 1 3 3 3 3 1 3 1 1 3 1 3 3 1 3 3 1 3 1 1 1 1 3 3 1 1 1 3 3 1 1 1 1 3 1 3 3 3 3 1 3 1 1 1 3 1 3 1 1 1 3 3 1 1 1 1 3 1 3 1 3 1 1 3 1 1 1 3 1 1...

output:

50000
0 995 91497
1 1437 91586
2 1439 91588
3 1440 91589
4 1441 91590
5 1445 91594
6 1446 91595
7 1072 91499
8 1337 91501
9 1349 91503
10 1447 91596
11 1392 91504
12 1402 91507
13 1403 91509
14 1404 91511
15 1448 91597
16 1405 91513
17 1406 91514
18 1407 91515
19 1449 91598
20 1408 91521
21 1409 915...

result:

ok count=50000

Test #153:

score: 0
Accepted
time: 1409ms
memory: 24544kb

input:

600000
2 2 2 3 2 1 1 3 2 2 2 3 3 1 2 2 2 2 2 3 2 2 2 3 1 1 3 2 2 2 3 1 2 2 2 2 2 1 2 2 1 1 2 2 2 2 2 3 2 3 2 1 1 2 2 1 2 2 2 2 3 2 1 2 2 3 2 2 2 1 2 2 3 2 2 1 1 2 2 1 2 1 2 1 2 2 2 1 3 3 3 1 2 2 2 2 2 2 2 3 2 2 3 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 2 3 2 2 2 2 3 2 2 2 2 2 1 2 2 1 2 2 2 3 2 1 2 1 2 2 3 1 2...

output:

133513
3 4 333356
5 8 333212
6 9 333217
7 10 333357
11 15 333359
12 16 333362
13 14 333222
19 20 333364
23 29 333365
24 27 333223
25 28 333226
26 33 333366
30 34 333367
31 32 333230
37 38 333232
40 42 333235
41 43 333242
47 48 333376
49 50 333377
51 53 333244
52 54 333245
55 56 333246
60 61 333378
6...

result:

ok count=133513

Test #154:

score: 0
Accepted
time: 1485ms
memory: 24252kb

input:

600000
2 2 2 2 3 1 2 3 2 2 2 1 1 2 2 2 2 2 2 2 2 1 3 2 3 1 3 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 3 1 2 1 2 2 2 3 2 2 2 1 1 3 2 3 3 3 3 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 1 3 3 2 2 3 2 2 3 2 2 3 2 2 2 2 2 3 2 2 2 1 1 2 2 2 2 3 2 1 2 1 2 2 2 1 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 1 2 2 2 2 1 1 3 2 2 2 2 2 3 2 3 3...

output:

133361
4 8 333728
5 6 332954
7 9 333729
11 13 332955
12 14 332956
21 23 332957
22 28 333731
24 29 333732
25 27 332959
26 30 333734
33 34 332962
45 50 333736
46 47 332964
48 49 332965
52 53 333738
56 59 332967
57 64 332970
58 65 333739
60 66 333741
61 67 333742
62 68 333743
63 69 333745
73 74 333747
...

result:

ok count=133361

Test #155:

score: 0
Accepted
time: 1009ms
memory: 24556kb

input:

600000
2 2 2 2 3 2 2 3 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 1 2 2 1 2 3 2 2 3 3 2 2 2 2 2 2 2 1 3 2 3 3 2 2 2 3 3 2 2 2 2 2 2 2 2 2 2 2 2 3 2 3 3 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 3 2 1 2 2 2 1 3 2 2 1 2 1 2 1 2 2 2 2 3 2 2 2 2 2 2 1 2 2 2 1 2 2 2 1 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 3 1 1...

output:

133217
4 5 333480
7 8 333482
11 12 333484
27 29 333128
28 30 333129
31 32 333131
34 35 333132
36 37 333488
39 41 333489
40 42 333490
48 50 333134
49 53 333491
51 54 333492
52 55 333495
56 58 333498
57 59 333499
70 71 333500
72 74 333501
73 75 333502
76 77 333135
78 79 333139
89 90 333503
91 92 33314...

result:

ok count=133217

Test #156:

score: 0
Accepted
time: 1147ms
memory: 24480kb

input:

600000
2 2 2 2 2 2 3 3 2 2 3 3 3 1 2 2 1 2 2 2 2 2 2 2 2 2 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 3 2 2 2 2 3 1 3 2 3 2 1 1 2 2 2 1 2 2 2 2 2 3 2 2 2 2 1 2 2 2 2 3 2 1 2 2 3 2 3 2 2 2 2 3 2 3 2 2 2 2 2 2 1 3 2 2 2 2 1 2 2 2 3 1 3 2 2 1 1 2 1 2 2 2 1 1 2 3 1 3 3 2 2 1 2 3 1...

output:

133621
6 8 333394
7 9 333397
10 15 333398
11 18 333403
12 19 333405
13 14 333274
16 17 333275
26 28 333406
27 29 333409
43 48 333410
44 46 333277
45 47 333278
57 58 333279
59 60 333411
64 69 333412
65 67 333281
66 74 333413
68 77 333417
70 72 333287
71 73 333290
75 76 333291
81 82 333418
86 87 33329...

result:

ok count=133621

Test #157:

score: 0
Accepted
time: 736ms
memory: 25188kb

input:

470000
2 2 1 3 2 1 1 2 3 3 2 2 2 2 3 2 2 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 3 2 2 2 2 2 2 2 2 3 2 2 2 2 3 2 2 2 1 2 3 2 3 3 3 2 3 2 2 2 2 3 1 2 3 2 1 1 2 2 2 2 2 2 3 3 2 1 2 1 2 2 2 3 2 2 2 2 3 2 2 3 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 3 3 3 2 2 3 1 3 2 2 2 2 2 1 3 2 2 1 2 2 2 2 2 2 2 2 1 3...

output:

104516
2 7 261403
3 4 260864
5 12 261405
6 13 261409
8 10 260866
9 11 260867
14 15 260868
17 18 260869
22 23 260870
35 36 260873
38 39 260874
47 48 260876
52 53 260879
56 57 261411
58 59 260881
60 63 260882
61 65 260886
62 66 260888
64 67 260889
69 71 260891
70 76 261412
72 73 260892
74 77 261416
75...

result:

ok count=104516

Test #158:

score: 0
Accepted
time: 903ms
memory: 25204kb

input:

470000
2 2 2 2 2 3 1 2 2 2 2 2 2 2 2 2 1 1 3 2 1 3 2 2 2 2 2 3 2 3 1 3 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 3 2 2 2 2 2 1 1 2 1 2 2 1 3 2 2 2 3 3 2 2 2 2 2 2 2 2 3 2 2 3 2 2 1 2 2 2 2 2 1 2 2 3 2 1 1 2 3 3 2 2 3 2 3 2 2 2 3 1 3 1 2 2 2 2 2 2 1 2 2 2 3 2 2 3 2 2 2 2 1 3 3 2 1 2 1 2 3 2 1 1 3 3 2 3 2 2 2 2 1...

output:

104147
5 8 261361
6 7 261154
16 19 261155
17 22 261156
18 24 261366
20 23 261157
21 25 261369
27 28 261370
29 33 261372
30 32 261158
31 34 261373
38 39 261159
47 48 261374
53 55 261160
54 57 261161
56 58 261162
59 61 261163
60 62 261376
64 66 261377
65 67 261379
74 75 261380
77 78 261381
80 81 26116...

result:

ok count=104147

Test #159:

score: 0
Accepted
time: 702ms
memory: 24796kb

input:

470000
2 2 2 1 1 3 2 1 2 2 2 2 1 3 2 3 3 2 2 2 2 2 2 2 3 2 2 2 2 3 3 2 2 3 3 3 2 1 2 2 2 2 2 2 1 3 2 2 1 3 1 1 1 2 2 2 2 2 2 1 2 3 2 2 1 2 2 2 2 2 2 3 1 3 3 3 2 1 2 2 3 2 2 1 1 2 1 3 3 2 2 2 2 2 2 1 2 3 2 1 3 1 2 2 2 2 2 2 3 2 3 2 1 3 2 3 2 3 3 1 2 2 2 2 1 1 2 3 2 2 3 2 2 2 1 2 2 3 2 2 2 2 2 1 1 2 2...

output:

104570
3 8 261103
4 9 261106
5 6 260851
7 10 261108
12 19 261109
13 14 260852
15 17 260853
16 18 260858
24 25 260859
29 31 260860
30 32 260864
33 36 260865
34 38 260869
35 39 260871
37 40 261111
44 47 261113
45 46 260872
48 54 261119
49 53 260874
50 55 261120
51 56 261122
52 57 261124
59 60 261128
6...

result:

ok count=104570

Test #160:

score: 0
Accepted
time: 907ms
memory: 26344kb

input:

469999
2 2 2 2 2 2 2 1 3 3 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 1 2 1 2 2 3 2 2 1 3 2 2 2 2 2 3 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 2 2 1 1 2 2 2 2 2 3 2 2 2 2 1 2 1 2 2 2 3 1 2 3 2 2 1 2 2 2 1 2 3 2 2 2 2 2 2 2 2 2 1 2 1 2 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 2 3 2 2 2 2 2 2 2 1 2 2 1 3 3 3 2 3 2 2 2 1 2 3 1 1 3 2 1...

output:

103891
7 12 261789
8 10 260997
9 11 260998
18 19 261002
25 26 261791
27 28 261792
30 31 261004
33 36 261796
34 35 261008
40 41 261009
45 47 261800
46 48 261801
49 50 261802
52 53 261806
58 60 261808
59 61 261812
65 66 261010
70 71 261814
72 73 261815
76 78 261012
77 81 261818
79 80 261013
82 83 2618...

result:

ok count=103891

Test #161:

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

input:

600000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 120192 386125

result:

ok count=1

Test #162:

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

input:

149980
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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
77404 77405 96783

result:

ok count=1

Test #163:

score: 0
Accepted
time: 49ms
memory: 24236kb

input:

600000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

200000
0 200000 400000
1 200001 400001
2 200002 400002
3 200003 400003
4 200004 400004
5 200005 400005
6 200006 400006
7 200007 400007
8 200008 400008
9 200009 400009
10 200010 400010
11 200011 400011
12 200012 400012
13 200013 400013
14 200014 400014
15 200015 400015
16 200016 400016
17 200017 4000...

result:

ok count=200000

Test #164:

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

input:

600000
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 1 599999

result:

ok count=1

Test #165:

score: 0
Accepted
time: 44ms
memory: 22380kb

input:

600000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

120000
0 240000 480000
1 240001 480001
2 240002 480002
3 240003 480003
4 240004 480004
5 240005 480005
6 240006 480006
7 240007 480007
8 240008 480008
9 240009 480009
10 240010 480010
11 240011 480011
12 240012 480012
13 240013 480013
14 240014 480014
15 240015 480015
16 240016 480016
17 240017 4800...

result:

ok count=120000

Test #166:

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

input:

6
1 2 3 2 3 1

output:

2
0 1 4
2 3 5

result:

ok count=2

Test #167:

score: 0
Accepted
time: 48ms
memory: 22224kb

input:

599700
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

197700
0 197700 402000
1 197701 402001
2 197702 402002
3 197703 402003
4 197704 402004
5 197705 402005
6 197706 402006
7 197707 402007
8 197708 402008
9 197709 402009
10 197710 402010
11 197711 402011
12 197712 402012
13 197713 402013
14 197714 402014
15 197715 402015
16 197716 402016
17 197717 4020...

result:

ok count=197700