QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#104654#5210. Lisa's SequencesCharlieVinnieAC ✓329ms101276kbC++172.8kb2023-05-11 16:07:022023-05-11 16:07:05

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-11 16:07:05]
  • 评测
  • 测评结果:AC
  • 用时:329ms
  • 内存:101276kb
  • [2023-05-11 16:07:02]
  • 提交

answer

#include "bits/stdc++.h"
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
#define assume(expr) ((!!(expr))||(exit((fprintf(stderr,"Assumption Failed: %s on Line %d\n",#expr,__LINE__),-1)),false))
using namespace std; using T = tuple<int,int,int,int>;
const int N=1e6+5; typedef long long ll;
int n,K,a[N]; T f[N][2][3]; // down/up, 0/-/inf,  x: ans, y: longest, z: same
void ckmin(T& x,T y) { if(x>y) x=y; }
T operator+ (T A,int op){
    int x=get<0>(A), y=get<1>(A), z=get<2>(A);
         if(op%10==1) x++, y++, z++;
    else if(op%10==2) y=z+1, z=1;
    else if(op%10==3) x++, y++, z=1;
    else if(op%10==4) y++, z=1;
    else if(op%10==5) y++, z++;
    else if(op%10==6) x++, y=z+1, z=1;
    else if(op%10==7) y=z+1, z=1;
    else throw 404;
    if(y>=K) return T(1e9,0,0,0);
    else return T(x,y,z,op);
}
signed main(){
    cin>>n>>K; For(i,1,n) cin>>a[i];
    For(i,0,n) For(j,0,1) For(k,0,2) f[i][j][k]=T(1e9,0,0,0);
    f[0][0][0]=T(0,0,0,0);
    For(i,0,n-1){
        // 0 0
        ckmin(f[i+1][0][0],f[i][0][0]+1); ckmin(f[i+1][1-0][2-0],f[i][1-0][2-0]+11);
        ckmin(f[i+1][1][1],f[i][0][0]+2); ckmin(f[i+1][1-1][2-1],f[i][1-0][2-0]+12);
        // 0 1
        ckmin(f[i+1][0][0],f[i][0][1]+3); ckmin(f[i+1][1-0][2-0],f[i][1-0][2-1]+13);
        if(a[i]>a[i+1])  ckmin(f[i+1][0][1],f[i][0][1]+4),ckmin(f[i+1][1-1][2-1],f[i][1-0][2-1]+17);
        if(a[i]==a[i+1]) ckmin(f[i+1][0][1],f[i][0][1]+5),ckmin(f[i+1][1-0][2-1],f[i][1-0][2-1]+15);
        if(a[i]<a[i+1])  ckmin(f[i+1][1][1],f[i][0][1]+7),ckmin(f[i+1][1-0][2-1],f[i][1-0][2-1]+14);
        ckmin(f[i+1][1][2],f[i][0][1]+6); ckmin(f[i+1][1-1][2-2],f[i][1-0][2-1]+16);
    }
    T ans(1e9,0,0,0); int u=0,v=0;
    For(i,0,1) For(j,0,2) if(f[n][i][j]<ans) ans=f[n][i][j],u=i,v=j;
    cout<<get<0>(ans)<<'\n';
    Rev(i,n,1){
        if(v==0) a[i]=0;
        else if(v==2) a[i]=1e5;
        int op=get<3>(f[i][u][v]);
             if(op==1) u=0,v=0;
        else if(op==2) u=0,v=0;
        else if(op==3) u=0,v=1;
        else if(op==4) u=0,v=1;
        else if(op==5) u=0,v=1;
        else if(op==6) u=0,v=1;
        else if(op==7) u=0,v=1;
        else if(op==11) u=1-0,v=2-0;
        else if(op==12) u=1-0,v=2-0;
        else if(op==13) u=1-0,v=2-1;
        else if(op==14) u=1-0,v=2-1;
        else if(op==15) u=1-0,v=2-1;
        else if(op==16) u=1-0,v=2-1;
        else if(op==17) u=1-0,v=2-1;
        else throw 404;
    }
    For(i,1,n) cout<<a[i]<<' ';; cout<<'\n';
    cerr<<"Time = "<<clock()<<" ms"<<endl;
    return 0;
}

// START TYPING IF YOU DON'T KNOW WHAT TO DO
// STOP TYPING IF YOU DON'T KNOW WHAT YOU'RE DOING
// CONTINUE, NON-STOPPING, FOR CHARLIEVINNIE

// Started Coding On: May 11 Thu, 15 : 04 : 49

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 5664kb

input:

5 3
1 2 3 4 5

output:

2
1 0 3 0 5 

result:

ok 2

Test #2:

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

input:

6 3
1 1 1 1 1 1

output:

3
1 100000 1 100000 1 100000 

result:

ok 3

Test #3:

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

input:

6 4
1 1 4 4 1 1

output:

1
1 1 0 4 1 1 

result:

ok 1

Test #4:

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

input:

6 4
4 4 4 2 2 2

output:

2
4 4 0 2 0 2 

result:

ok 2

Test #5:

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

input:

6 4
4 4 4 3 4 4

output:

1
4 4 100000 3 4 4 

result:

ok 1

Test #6:

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

input:

8 4
2 1 1 3 3 1 1 2

output:

2
2 1 1 3 0 1 0 2 

result:

ok 2

Test #7:

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

input:

10 4
1 1 1 2 2 1 1 2 2 1

output:

2
1 1 100000 2 2 100000 1 2 2 1 

result:

ok 2

Test #8:

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

input:

7 5
5 4 4 3 4 4 4

output:

0
5 4 4 3 4 4 4 

result:

ok 0

Test #9:

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

input:

10 10
1 1 1 1 1 1 1 1 1 1

output:

1
1 1 1 1 1 1 1 1 0 1 

result:

ok 1

Test #10:

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

input:

3 3
1 2 1

output:

0
1 2 1 

result:

ok 0

Test #11:

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

input:

3 3
2 1 1

output:

1
2 0 1 

result:

ok 1

Test #12:

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

input:

3 3
1 1 2

output:

1
1 0 2 

result:

ok 1

Test #13:

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

input:

3 3
1 1 1

output:

1
1 0 1 

result:

ok 1

Test #14:

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

input:

5 3
1 1 1 1 1

output:

2
1 0 1 0 1 

result:

ok 2

Test #15:

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

input:

6 4
5 5 5 5 5 5

output:

2
5 5 0 5 0 5 

result:

ok 2

Test #16:

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

input:

6 4
4 4 4 2 2 4

output:

1
4 4 100000 2 2 4 

result:

ok 1

Test #17:

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

input:

6 4
5 5 5 5 4 2

output:

1
5 5 0 5 4 2 

result:

ok 1

Test #18:

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

input:

6 4
3 3 3 2 2 3

output:

1
3 3 100000 2 2 3 

result:

ok 1

Test #19:

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

input:

8 4
4 2 2 4 4 1 2 4

output:

1
4 2 2 100000 4 1 2 4 

result:

ok 1

Test #20:

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

input:

8 4
4 5 5 4 3 5 5 4

output:

1
4 5 0 4 3 5 5 4 

result:

ok 1

Test #21:

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

input:

6 4
1 3 4 4 4 4

output:

1
1 3 4 0 4 4 

result:

ok 1

Test #22:

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

input:

20 4
2 4 2 3 4 4 3 2 3 3 3 2 1 3 4 5 2 2 4 5

output:

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

result:

ok 4

Test #23:

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

input:

9 4
5 5 5 3 3 3 2 2 2

output:

3
5 5 0 3 3 0 2 0 2 

result:

ok 3

Test #24:

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

input:

13 3
2 3 1 3 1 3 3 1 3 1 3 1 2

output:

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

result:

ok 3

Test #25:

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

input:

10 3
2 1 1 2 2 1 2 2 1 2

output:

3
2 100000 1 2 0 1 0 2 1 2 

result:

ok 3

Test #26:

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

input:

10 3
2 3 3 2 1 1 3 1 3 1

output:

2
2 0 3 2 100000 1 3 1 3 1 

result:

ok 2

Test #27:

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

input:

10 3
1 5 1 3 1 3 4 1 2 5

output:

2
1 5 1 3 1 3 0 1 0 5 

result:

ok 2

Test #28:

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

input:

10 3
45193 6340 72389 96197 51013 36684 59421 49197 79404 86162

output:

2
45193 6340 72389 0 51013 36684 59421 49197 100000 86162 

result:

ok 2

Test #29:

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

input:

10 4
1 2 1 2 2 2 1 1 1 2

output:

2
1 2 1 2 2 0 1 1 0 2 

result:

ok 2

Test #30:

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

input:

10 4
2 3 3 1 1 2 1 2 3 3

output:

2
2 3 3 0 1 2 1 2 0 3 

result:

ok 2

Test #31:

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

input:

10 4
1 1 4 3 4 5 3 4 2 5

output:

0
1 1 4 3 4 5 3 4 2 5 

result:

ok 0

Test #32:

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

input:

10 4
45758 16873 75040 42225 77839 62718 13983 70028 26023 91322

output:

0
45758 16873 75040 42225 77839 62718 13983 70028 26023 91322 

result:

ok 0

Test #33:

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

input:

10 5
1 2 2 1 1 2 1 2 2 1

output:

0
1 2 2 1 1 2 1 2 2 1 

result:

ok 0

Test #34:

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

input:

10 5
1 1 2 2 3 2 2 1 1 1

output:

2
1 1 2 2 0 2 2 1 0 1 

result:

ok 2

Test #35:

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

input:

10 5
4 1 3 1 3 3 4 4 4 5

output:

1
4 1 3 1 3 3 100000 4 4 5 

result:

ok 1

Test #36:

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

input:

10 5
55540 7942 77691 78007 13884 79534 67516 89829 81858 96483

output:

0
55540 7942 77691 78007 13884 79534 67516 89829 81858 96483 

result:

ok 0

Test #37:

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

input:

10 6
2 2 2 1 2 1 2 2 2 1

output:

0
2 2 2 1 2 1 2 2 2 1 

result:

ok 0

Test #38:

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

input:

10 6
1 2 3 1 3 1 3 3 1 2

output:

0
1 2 3 1 3 1 3 3 1 2 

result:

ok 0

Test #39:

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

input:

10 6
3 3 3 2 1 1 5 3 5 5

output:

1
3 3 3 2 100000 1 5 3 5 5 

result:

ok 1

Test #40:

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

input:

10 6
56105 97981 59850 34282 30465 96350 22078 9631 28477 1644

output:

0
56105 97981 59850 34282 30465 96350 22078 9631 28477 1644 

result:

ok 0

Test #41:

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

input:

10 7
1 2 2 2 1 2 1 1 1 1

output:

0
1 2 2 2 1 2 1 1 1 1 

result:

ok 0

Test #42:

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

input:

10 7
1 3 2 2 1 2 3 2 1 1

output:

0
1 3 2 2 1 2 3 2 1 1 

result:

ok 0

Test #43:

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

input:

10 7
3 4 4 5 4 3 4 3 3 5

output:

0
3 4 4 5 4 3 4 3 3 5 

result:

ok 0

Test #44:

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

input:

10 7
56671 99297 62500 89526 57292 22385 76640 20216 84312 6804

output:

0
56671 99297 62500 89526 57292 22385 76640 20216 84312 6804 

result:

ok 0

Test #45:

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

input:

10 8
2 1 2 2 2 2 1 2 2 2

output:

0
2 1 2 2 2 2 1 2 2 2 

result:

ok 0

Test #46:

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

input:

10 8
1 3 3 3 3 1 2 3 2 1

output:

0
1 3 3 3 3 1 2 3 2 1 

result:

ok 0

Test #47:

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

input:

10 8
4 5 2 2 2 4 5 1 4 3

output:

0
4 5 2 2 2 4 5 1 4 3 

result:

ok 0

Test #48:

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

input:

10 8
36744 99583 65151 35555 93335 39201 31202 50263 30931 21182

output:

0
36744 99583 65151 35555 93335 39201 31202 50263 30931 21182 

result:

ok 0

Test #49:

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

input:

10 9
2 1 1 2 2 1 2 2 2 2

output:

0
2 1 1 2 2 1 2 2 2 2 

result:

ok 0

Test #50:

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

input:

10 9
3 3 3 1 2 2 2 3 2 2

output:

0
3 3 3 1 2 2 2 3 2 2 

result:

ok 0

Test #51:

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

input:

10 9
2 5 2 5 5 1 3 2 5 5

output:

0
2 5 2 5 5 1 3 2 5 5 

result:

ok 0

Test #52:

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

input:

10 9
46526 90653 57556 81583 9917 65235 75517 70064 77549 26342

output:

0
46526 90653 57556 81583 9917 65235 75517 70064 77549 26342 

result:

ok 0

Test #53:

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

input:

10 10
1 2 2 2 2 1 1 2 1 1

output:

0
1 2 2 2 2 1 1 2 1 1 

result:

ok 0

Test #54:

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

input:

10 10
3 1 2 1 2 3 1 3 1 1

output:

0
3 1 2 1 2 3 1 3 1 1 

result:

ok 0

Test #55:

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

input:

10 10
1 4 4 5 4 2 3 2 2 2

output:

0
1 4 4 5 4 2 3 2 2 2 

result:

ok 0

Test #56:

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

input:

10 10
7713 90031 59708 15268 29396 79470 40228 76226 57485 12718

output:

0
7713 90031 59708 15268 29396 79470 40228 76226 57485 12718 

result:

ok 0

Test #57:

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

input:

30 3
1 1 2 2 1 1 1 2 2 2 2 1 2 1 2 1 1 2 1 2 2 2 2 2 1 2 1 2 1 1

output:

11
1 100000 2 100000 1 100000 1 2 0 2 0 1 0 1 0 1 0 2 1 2 0 2 0 2 1 2 1 2 0 1 

result:

ok 11

Test #58:

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

input:

30 3
1 3 2 3 1 2 1 1 1 2 3 2 3 3 1 1 2 2 2 1 3 3 1 3 3 2 1 1 1 3

output:

9
1 3 2 3 1 2 1 100000 1 2 0 2 0 3 1 100000 2 100000 2 100000 3 100000 1 3 0 2 1 100000 1 3 

result:

ok 9

Test #59:

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

input:

30 3
1 2 1 5 1 3 3 2 2 4 1 2 5 4 3 5 2 2 3 4 2 5 2 3 1 3 2 5 2 1

output:

5
1 2 1 5 1 3 0 2 0 4 1 2 0 4 3 5 2 100000 3 4 2 5 2 3 1 3 2 5 0 1 

result:

ok 5

Test #60:

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

input:

30 3
46794 11642 64446 48822 93862 35562 9271 42435 89725 22019 95837 29908 59376 24224 24200 55981 88803 56777 85133 10604 67092 52105 17027 3049 98119 19228 1570 2996 16069 44400

output:

5
46794 11642 64446 48822 93862 35562 100000 42435 89725 22019 95837 29908 59376 24224 100000 55981 88803 56777 85133 10604 67092 52105 100000 3049 98119 19228 100000 2996 100000 44400 

result:

ok 5

Test #61:

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

input:

30 4
2 1 2 2 2 1 1 2 1 1 1 1 1 2 1 1 1 1 2 2 1 1 2 1 2 2 1 1 2 2

output:

5
2 1 2 0 2 1 1 2 1 1 100000 1 1 2 1 1 100000 1 2 2 0 1 2 1 2 2 1 100000 2 2 

result:

ok 5

Test #62:

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

input:

30 4
1 1 3 2 1 3 2 1 3 2 2 2 2 3 3 3 2 1 2 1 1 3 2 1 2 1 1 2 2 1

output:

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

result:

ok 3

Test #63:

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

input:

30 4
1 3 4 4 4 5 4 3 4 2 5 5 3 5 3 5 3 4 5 5 3 5 4 2 4 4 1 1 5 4

output:

3
1 3 100000 4 4 5 4 3 4 2 5 5 3 5 3 5 3 4 0 5 3 5 4 2 4 4 0 1 5 4 

result:

ok 3

Test #64:

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

input:

30 4
47360 1682 67096 94850 20690 61595 63832 72482 45561 27180 8643 78413 70252 55432 95417 52362 44995 51511 99980 49672 20621 48503 60046 82179 13917 82990 50203 87463 50161 50380

output:

2
47360 1682 67096 94850 20690 61595 63832 0 45561 27180 8643 78413 70252 55432 95417 52362 44995 51511 99980 49672 20621 48503 0 82179 13917 82990 50203 87463 50161 50380 

result:

ok 2

Test #65:

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

input:

30 5
1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 1 1 2 2 1 1 2 1 2 2 2 1 2 2

output:

2
1 1 2 2 1 2 2 1 1 100000 2 2 2 100000 1 2 1 1 2 2 1 1 2 1 2 2 2 1 2 2 

result:

ok 2

Test #66:

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

input:

30 5
2 3 1 3 2 3 2 2 3 3 3 2 1 2 2 1 1 3 1 3 1 2 1 2 1 1 1 1 2 1

output:

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

result:

ok 2

Test #67:

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

input:

30 5
1 4 5 3 3 3 3 1 4 4 1 5 1 4 2 4 1 2 5 4 5 4 4 4 1 5 1 1 4 1

output:

2
1 4 5 3 3 3 100000 1 4 4 1 5 1 4 2 4 1 2 5 4 5 4 4 100000 1 5 1 1 4 1 

result:

ok 2

Test #68:

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

input:

30 5
47925 92750 59501 40878 47517 78412 18394 92283 92179 41557 40911 17701 51420 96886 57419 29281 10404 47275 26104 98986 63903 43871 93847 70527 20496 47781 9084 82178 74006 36897

output:

1
47925 92750 59501 40878 47517 78412 18394 92283 92179 41557 40911 100000 51420 96886 57419 29281 10404 47275 26104 98986 63903 43871 93847 70527 20496 47781 9084 82178 74006 36897 

result:

ok 1

Test #69:

score: 0
Accepted
time: 224ms
memory: 101112kb

input:

1000000 3
1 2 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 2 1 2 1 2 1 1 2 2 1 2 1 1 1 1 1 2 1 1 1 1 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 2 1 1 2 2 2 1 1 2 2 2 1 2 1 2 2 1 1 1 2 2 1 1 1 2 2 2 2 1 1 2 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 1 1 2 2 2 2 1 2 2 1 2 2 2 2 1 2 1 2 2 2 1 2 1 2 1 1 1 2 2 2 1 2 1 2 ...

output:

399795
1 0 1 0 2 1 100000 1 100000 1 100000 1 100000 2 100000 1 100000 1 100000 2 100000 1 100000 2 100000 1 2 1 2 1 100000 2 100000 1 2 1 100000 1 100000 1 2 1 100000 1 100000 2 100000 2 100000 1 2 0 1 0 2 1 2 0 2 1 100000 2 100000 1 2 0 2 1 100000 2 100000 2 100000 2 100000 2 100000 1 100000 1 2 0...

result:

ok 399795

Test #70:

score: 0
Accepted
time: 208ms
memory: 101172kb

input:

1000000 3
2 3 1 2 1 2 1 2 3 2 3 1 2 2 1 1 2 3 1 2 1 2 1 2 3 3 3 1 3 3 3 2 2 1 1 2 3 2 3 2 2 3 2 2 3 3 3 2 2 2 1 3 3 1 1 2 2 3 1 1 1 1 3 2 2 3 2 3 1 2 3 2 2 1 2 2 2 2 1 1 1 3 2 1 2 3 1 3 1 2 1 1 3 1 1 3 3 2 2 3 2 1 3 2 1 1 3 1 2 1 1 2 3 2 1 1 1 1 2 3 2 1 1 3 3 2 3 2 3 1 1 3 3 1 2 1 3 3 3 3 3 1 1 2 2 ...

output:

365780
2 0 1 0 1 0 1 0 3 2 3 1 2 0 1 0 2 0 1 0 1 0 1 0 3 0 3 1 3 0 3 2 100000 1 100000 2 3 2 3 2 100000 3 100000 2 3 0 3 2 100000 2 100000 3 100000 1 100000 2 100000 3 100000 1 100000 1 3 2 100000 3 100000 3 100000 2 3 2 100000 1 2 0 2 0 1 0 1 0 2 1 2 0 1 0 1 0 1 0 3 1 100000 3 100000 2 100000 3 100...

result:

ok 365780

Test #71:

score: 0
Accepted
time: 217ms
memory: 101100kb

input:

1000000 3
2 4 1 2 4 5 3 2 1 2 4 2 1 2 4 2 3 3 5 4 5 2 5 2 4 3 5 4 5 3 4 1 4 2 4 1 3 2 4 3 3 4 1 3 4 1 4 1 5 5 3 1 2 5 5 5 5 1 5 4 1 5 4 1 2 5 1 1 2 2 3 3 2 5 3 3 3 2 5 5 3 5 3 3 1 1 4 2 1 5 1 2 2 4 1 4 4 2 5 4 3 5 5 3 1 3 2 5 3 5 4 2 1 2 1 4 2 1 5 2 4 4 3 4 1 1 3 3 2 2 5 4 4 5 3 3 2 1 3 1 1 5 5 1 3 ...

output:

337446
2 0 1 0 4 0 3 2 100000 2 4 2 100000 2 4 2 3 0 5 4 5 2 5 2 4 3 5 4 5 3 4 1 4 2 4 1 3 2 4 3 100000 4 100000 3 4 1 4 1 5 0 3 1 2 0 5 0 5 1 5 4 100000 5 100000 1 2 0 1 0 2 0 3 0 2 0 3 0 3 2 5 0 3 0 3 0 1 0 4 2 100000 5 100000 2 100000 4 100000 4 100000 2 5 4 100000 5 100000 3 100000 3 100000 5 10...

result:

ok 337446

Test #72:

score: 0
Accepted
time: 304ms
memory: 101216kb

input:

1000000 3
73337 33587 27294 91377 34594 4430 75940 51624 70546 99878 3107 58368 77005 96496 58761 90424 86461 29807 43804 57247 5344 50578 10252 1413 30258 2895 25982 70523 32809 11612 71933 76460 33750 9022 102 21374 39194 92031 83586 50390 23925 56023 73780 96623 1267 98914 61392 96743 36604 49320...

output:

293139
73337 100000 27294 91377 34594 100000 75940 100000 70546 99878 3107 58368 0 96496 58761 90424 86461 100000 43804 57247 5344 50578 10252 100000 30258 100000 25982 70523 32809 100000 71933 76460 33750 100000 102 21374 0 92031 83586 100000 23925 56023 0 96623 1267 98914 61392 96743 36604 49320 0...

result:

ok 293139

Test #73:

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

input:

1000000 4
1 2 1 1 2 2 2 2 1 1 2 1 2 1 1 2 1 2 1 2 2 2 1 2 1 1 1 1 1 2 1 1 1 2 2 1 1 1 2 2 1 2 2 2 2 1 1 1 2 1 1 1 2 1 1 1 1 2 1 2 2 2 2 2 2 1 1 1 1 1 1 2 1 2 2 1 2 1 2 1 1 2 2 2 2 2 1 1 1 1 2 1 2 2 1 1 2 1 2 2 2 2 1 1 2 2 2 2 2 1 2 2 2 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 2 1 1 2 1 1 1 2 2 2 1 1 1 1 2 1 ...

output:

181732
1 2 1 1 2 0 2 2 0 1 2 1 2 1 1 2 1 2 1 2 0 2 1 2 1 1 100000 1 1 2 1 100000 1 2 2 1 100000 1 2 2 1 2 2 0 2 1 100000 1 2 1 100000 1 2 1 1 100000 1 2 1 2 2 0 2 2 0 1 1 0 1 1 0 2 1 2 2 1 2 1 2 1 1 2 0 2 0 2 1 1 100000 1 2 1 2 2 0 1 2 1 2 2 0 2 1 1 2 0 2 0 2 1 2 0 2 1 1 100000 1 2 1 1 100000 1 2 1 ...

result:

ok 181732

Test #74:

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

input:

1000000 4
1 1 2 3 2 1 1 3 3 2 1 1 1 2 2 1 1 1 3 1 2 1 2 2 2 2 1 3 3 3 2 3 1 2 2 3 3 3 3 2 1 3 1 3 2 1 3 1 3 1 1 1 1 3 2 3 1 1 2 3 2 2 2 3 3 1 2 1 3 2 2 1 1 3 1 2 2 3 3 3 1 1 3 3 1 1 3 1 1 3 1 2 1 2 3 1 3 3 3 3 3 2 1 2 3 3 3 3 3 3 1 1 3 3 3 2 1 3 3 2 2 3 3 2 1 2 1 1 2 1 2 3 3 1 1 3 2 1 3 1 3 3 1 1 1 ...

output:

141411
1 1 2 0 2 1 1 3 0 2 1 100000 1 2 2 1 100000 1 3 1 2 1 2 2 0 2 1 3 0 3 2 3 1 2 2 0 3 3 0 2 1 3 1 3 2 1 3 1 3 1 1 100000 1 3 2 3 1 1 2 0 2 2 0 3 3 1 2 1 3 2 2 100000 1 3 1 2 2 0 3 3 1 100000 3 3 100000 1 3 1 1 3 1 2 1 2 3 1 3 3 0 3 3 2 100000 2 3 3 0 3 0 3 1 1 3 0 3 2 1 3 3 2 100000 3 3 100000 ...

result:

ok 141411

Test #75:

score: 0
Accepted
time: 201ms
memory: 100988kb

input:

1000000 4
2 5 4 1 3 2 4 2 1 5 1 3 4 4 3 1 5 5 1 3 1 2 1 1 1 4 2 1 2 1 3 3 2 1 1 1 4 4 4 5 4 2 3 1 5 2 3 2 5 4 5 4 5 4 4 4 4 3 2 1 3 5 2 1 3 3 4 2 4 4 4 2 1 3 3 4 3 1 4 5 3 2 1 2 2 3 5 2 2 5 4 2 4 2 1 5 2 3 2 5 4 5 4 4 5 1 5 2 5 5 4 1 1 5 5 3 5 3 5 1 2 3 3 2 2 3 1 4 4 2 1 2 2 3 1 4 5 2 2 5 1 4 5 5 5 ...

output:

110831
2 5 4 1 3 2 4 2 1 5 1 3 4 0 3 1 5 5 1 3 1 2 1 100000 1 4 2 1 2 1 3 3 2 100000 1 1 100000 4 4 5 4 2 3 1 5 2 3 2 5 4 5 4 5 4 4 100000 4 3 100000 1 3 5 2 1 3 0 4 2 4 4 0 2 1 3 3 0 3 1 4 5 3 100000 1 2 2 0 5 2 2 5 4 2 4 2 1 5 2 3 2 5 4 5 4 4 5 1 5 2 5 5 4 100000 1 5 5 3 5 3 5 1 2 0 3 2 2 3 1 4 4 ...

result:

ok 110831

Test #76:

score: 0
Accepted
time: 294ms
memory: 101152kb

input:

1000000 4
73902 24657 29945 47651 70638 30463 30502 71425 16136 94793 25129 7902 77636 37951 20762 76560 52899 15325 49434 96315 58872 36729 44053 80542 36837 67685 74615 54992 56654 8374 49144 44892 77812 93378 15842 23603 74334 84938 14085 32716 4711 113 14607 74254 82438 46778 6895 75373 51906 64...

output:

62506
73902 24657 29945 0 70638 30463 30502 71425 16136 94793 25129 7902 77636 37951 20762 76560 52899 15325 49434 96315 58872 36729 44053 80542 36837 67685 74615 54992 56654 8374 49144 44892 77812 93378 15842 23603 0 84938 14085 32716 4711 113 14607 74254 0 46778 6895 75373 51906 64987 20456 81626 ...

result:

ok 62506

Test #77:

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

input:

1000000 5
2 2 2 1 1 1 1 2 2 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 1 1 2 2 1 2 2 1 2 1 1 2 1 2 2 2 2 1 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 2 2 1 1 1 2 2 1 1 1 2 2 2 2 2 2 2 1 1 1 2 2 1 2 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 1 1 1 2 2 2 1 2 2 1 2 1 1 1 2 2 2 1 1 1 2 1 1 2 2 2 2 1 2 1 2 1 2 1 2 2 2 2 2 1 2 1 1 1 2 1 2 1 ...

output:

103273
2 2 2 1 100000 1 1 2 2 1 1 2 0 2 1 2 1 2 2 2 0 2 1 2 1 1 2 2 1 2 2 1 2 1 1 2 1 2 2 0 2 1 1 2 1 2 1 2 1 2 1 2 1 1 1 100000 1 1 2 2 1 100000 1 2 2 1 100000 1 2 2 2 0 2 2 2 1 100000 1 2 2 1 2 1 2 1 1 1 100000 1 2 1 2 1 1 2 1 1 1 100000 1 2 2 2 1 2 2 1 2 1 1 1 2 0 2 1 1 1 2 1 1 2 2 0 2 1 2 1 2 1 ...

result:

ok 103273

Test #78:

score: 0
Accepted
time: 219ms
memory: 101212kb

input:

1000000 5
1 2 3 1 1 2 2 3 1 1 2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1 3 1 2 4 4 1 2 4 0 5 1 1 2 2 0 3 4 5 2 3 1 5 5 4 1 2 3 0 3 1 5 2 1 4 2 4 4 1 1 5 5 2 5 4 4 3 5 3 2 2 100000 2 3 4 1 4 5 4 5 1 5 3 2 1 5 4 4 3 5 5 2 3 4 4 0 4 1 5 1 3 5 1 5 1 3 2...

result:

ok 43993

Test #80:

score: 0
Accepted
time: 313ms
memory: 101112kb

input:

1000000 5
73438 35189 32596 83433 87219 47279 84035 91227 62755 99953 48180 57435 69050 58912 72516 53478 9092 843 64282 45630 11372 42344 67609 59673 62880 41694 14033 49706 90746 14354 16109 13323 2411 68519 30553 25832 9476 89119 74293 15043 15206 44202 55433 41639 83074 4888 62643 73466 77455 79...

output:

13428
73438 35189 32596 83433 87219 47279 84035 91227 62755 99953 48180 57435 69050 58912 72516 53478 9092 843 64282 45630 11372 42344 67609 59673 62880 41694 14033 49706 90746 14354 16109 13323 2411 68519 30553 25832 9476 89119 74293 15043 15206 44202 55433 41639 83074 4888 62643 73466 77455 0 4114...

result:

ok 13428

Test #81:

score: 0
Accepted
time: 210ms
memory: 101116kb

input:

1000000 6
1 2 2 1 2 1 1 1 1 2 2 2 1 2 2 1 1 2 1 2 1 2 1 2 2 1 2 2 2 1 2 2 1 1 2 1 2 1 1 1 1 1 1 2 2 1 2 2 2 1 2 1 2 2 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 1 2 1 1 1 1 1 1 2 1 1 1 2 1 2 2 2 2 2 2 1 1 2 1 1 2 1 1 1 1 1 1 1 2 2 2 1 1 1 2 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 1 2 1 2 1 1 2 1 2 1 1 2 2 1 2 1 2 ...

output:

61147
1 2 2 1 2 1 1 1 1 2 0 2 1 2 2 1 1 2 1 2 1 2 1 2 2 1 2 2 2 1 2 2 1 1 2 1 2 1 1 1 1 100000 1 2 2 1 2 2 2 1 2 1 2 2 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 1 2 1 1 1 1 100000 1 2 1 1 1 2 1 2 2 2 2 0 2 1 1 2 1 1 2 1 1 1 1 100000 1 1 2 2 2 1 100000 1 2 1 1 2 2 2 1 2 1 2 2 2 0 2 1 2 2 1 2 1 2 1 1 2 1 2 ...

result:

ok 61147

Test #82:

score: 0
Accepted
time: 234ms
memory: 101108kb

input:

1000000 6
3 1 3 2 2 2 3 1 1 2 3 1 1 3 3 3 3 3 1 2 3 2 3 1 1 1 3 3 1 1 3 2 2 1 2 3 3 1 1 2 3 1 3 1 2 1 1 1 3 3 1 2 2 3 3 1 3 2 1 1 1 3 2 1 1 1 3 1 1 3 1 3 3 3 1 2 3 1 3 3 1 1 1 3 3 1 1 2 3 1 3 3 3 2 2 3 3 2 2 3 3 2 2 3 3 1 1 1 3 2 1 2 1 2 2 1 3 2 3 1 3 1 1 3 3 2 1 1 3 3 3 3 1 3 3 3 2 2 1 2 3 3 2 1 3 ...

output:

33182
3 1 3 2 2 2 3 1 1 2 3 1 1 3 3 3 0 3 1 2 3 2 3 1 1 1 3 3 1 1 3 2 2 1 2 3 3 1 1 2 3 1 3 1 2 1 1 1 3 3 1 2 2 3 3 1 3 2 1 1 1 3 2 1 1 1 3 1 1 3 1 3 3 3 1 2 3 1 3 3 1 1 1 3 3 1 1 2 3 1 3 3 3 2 2 3 3 2 2 3 3 2 2 3 3 1 1 1 3 2 1 2 1 2 2 1 3 2 3 1 3 1 1 3 3 2 1 1 3 3 0 3 1 3 3 3 2 2 100000 2 3 3 2 1 3...

result:

ok 33182

Test #83:

score: 0
Accepted
time: 188ms
memory: 101112kb

input:

1000000 6
5 1 2 5 5 2 4 4 4 2 4 3 1 4 2 1 2 1 3 4 3 1 4 5 3 2 2 2 4 3 1 3 2 3 1 2 1 1 1 2 5 3 4 2 3 3 2 1 3 1 5 1 3 3 2 5 5 1 3 5 3 5 2 5 2 5 5 2 3 4 3 3 2 5 1 1 2 4 3 2 3 4 5 5 2 1 3 1 2 3 5 4 5 5 3 1 5 1 4 2 4 3 3 4 3 2 2 2 5 3 1 4 4 3 2 5 3 1 3 4 4 5 4 3 1 2 3 1 2 1 5 1 1 1 1 4 3 1 1 1 1 1 4 1 1 ...

output:

15986
5 1 2 5 5 2 4 4 4 2 4 3 1 4 2 1 2 1 3 4 3 1 4 5 3 2 2 2 4 3 1 3 2 3 1 2 1 1 1 2 5 3 4 2 3 3 2 1 3 1 5 1 3 3 2 5 5 1 3 5 3 5 2 5 2 5 5 2 3 4 3 3 2 5 1 1 2 4 3 2 3 4 5 5 2 1 3 1 2 3 5 4 5 5 3 1 5 1 4 2 4 3 3 4 3 2 2 2 5 3 1 4 4 3 2 5 3 1 3 4 4 5 4 3 1 2 3 1 2 1 5 1 1 1 1 4 3 1 1 1 100000 1 4 1 1...

result:

ok 15986

Test #84:

score: 0
Accepted
time: 311ms
memory: 101172kb

input:

1000000 6
74003 26259 14755 29462 23263 73313 38597 21275 18591 5114 71232 86476 69680 367 44764 39614 84746 96606 90404 84699 64900 28496 20874 49050 59213 6485 72912 34174 14592 10088 2537 81754 56718 52877 46292 29091 35399 82025 14010 87123 15455 98537 96259 10053 74492 43534 8146 62342 93787 85...

output:

2439
74003 26259 14755 29462 23263 73313 38597 21275 18591 5114 71232 86476 69680 367 44764 39614 84746 96606 90404 84699 64900 28496 100000 49050 59213 6485 72912 34174 14592 10088 2537 81754 56718 52877 46292 29091 35399 82025 14010 87123 15455 98537 96259 10053 74492 43534 8146 62342 93787 85045 ...

result:

ok 2439

Test #85:

score: 0
Accepted
time: 206ms
memory: 101216kb

input:

1000000 7
2 1 2 2 1 2 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 1 1 1 2 2 1 1 2 1 1 2 2 2 2 1 2 1 1 2 2 2 2 2 1 2 1 1 1 2 1 1 1 2 1 2 2 2 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 2 1 2 1 1 1 2 1 1 2 1 2 1 1 2 2 2 1 1 2 1 1 1 2 2 2 1 1 1 2 1 2 2 1 2 1 1 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score: 0
Accepted
time: 213ms
memory: 101208kb

input:

1000000 7
5 1 4 5 2 5 5 4 2 3 3 1 3 4 3 1 3 5 4 4 4 4 1 2 5 2 4 5 3 5 1 1 4 2 4 5 4 2 4 5 2 4 5 2 4 2 1 2 3 5 3 4 3 4 4 3 3 5 2 3 5 3 2 1 3 5 4 2 4 1 4 3 2 4 5 1 3 2 2 2 5 5 3 4 3 5 4 1 2 3 2 2 2 3 3 1 2 2 3 2 3 3 4 4 5 1 3 2 3 3 2 4 2 5 5 4 5 2 4 2 2 2 2 4 3 3 4 1 3 1 1 5 5 2 5 5 1 2 5 5 5 2 1 4 2 ...

output:

5462
5 1 4 5 2 5 5 4 2 3 3 1 3 4 3 1 3 5 4 4 4 4 1 2 5 2 4 5 3 5 1 1 4 2 4 5 4 2 4 5 2 4 5 2 4 2 1 2 3 5 3 4 3 4 4 3 3 5 2 3 5 3 2 1 3 5 4 2 4 1 4 3 2 4 5 1 3 2 2 2 5 5 3 4 3 5 4 1 2 3 2 2 2 3 3 1 2 2 3 2 3 3 4 4 5 1 3 2 3 3 2 4 2 5 5 4 5 2 4 2 2 2 2 4 3 3 4 1 3 1 1 5 5 2 5 5 1 2 5 5 5 2 1 4 2 2 2 4...

result:

ok 5462

Test #88:

score: 0
Accepted
time: 329ms
memory: 101144kb

input:

1000000 7
74568 26545 17405 85735 50090 90129 93158 42105 75455 19491 3501 36010 71340 21328 96518 16533 40938 71878 96035 23768 8183 34110 44429 28181 85256 71276 21547 28889 48684 96603 69501 40969 90533 28018 71249 31320 80786 65715 53726 69449 16734 52873 37086 87683 65911 91397 63894 40972 9884...

output:

331
74568 26545 17405 85735 50090 90129 93158 42105 75455 19491 3501 36010 71340 21328 96518 16533 40938 71878 96035 23768 8183 34110 44429 28181 85256 71276 21547 28889 48684 96603 69501 40969 90533 28018 71249 31320 80786 65715 53726 69449 16734 52873 37086 87683 65911 91397 63894 40972 98843 9930...

result:

ok 331

Test #89:

score: 0
Accepted
time: 202ms
memory: 101224kb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 1 1 2 2 3 1 2 2 2 3 3 1 1 2 3 2 1 3 3 3 2 3 3 1 3 2 2 3 3 2 1 1 2 3 2 1 1 2 2 2 1 1 3 1 2 2 1 2 2 2 3 3 1 2 2 1 1 2 1 2 3 1 1 2 2 2 2 2 1 3 3 2 2 2 3 2 2 1 2 3 3 2 2 3 1 2 2 1 1 1 2 1 3 1 1 3 1 1 3 1 2 3 1 2 3 3 2 1 1...

result:

ok 6690

Test #91:

score: 0
Accepted
time: 215ms
memory: 101212kb

input:

1000000 8
5 3 2 3 1 3 4 3 2 1 4 1 3 1 1 5 5 2 1 4 3 3 2 5 5 3 2 4 1 2 4 4 5 1 2 2 5 3 3 2 5 2 5 2 5 3 5 1 2 1 5 3 1 4 3 1 1 4 2 5 2 1 5 1 4 5 3 5 2 4 1 2 3 3 1 2 2 4 3 2 2 3 1 3 3 3 4 2 2 2 5 2 3 1 1 1 5 5 2 2 5 4 3 5 1 3 2 2 5 4 4 5 1 4 5 4 5 2 5 1 4 1 5 3 3 2 2 3 5 1 3 2 4 2 4 1 3 1 4 3 4 3 5 1 4 ...

output:

1724
5 3 2 3 1 3 4 3 2 1 4 1 3 1 1 5 5 2 1 4 3 3 2 5 5 3 2 4 1 2 4 4 5 1 2 2 5 3 3 2 5 2 5 2 5 3 5 1 2 1 5 3 1 4 3 1 1 4 2 5 2 1 5 1 4 5 3 5 2 4 1 2 3 3 1 2 2 4 3 2 2 3 1 3 3 3 4 2 2 2 5 2 3 1 1 1 5 5 2 2 5 4 3 5 1 3 2 2 5 4 4 5 1 4 5 4 5 2 5 1 4 1 5 3 3 2 2 3 5 1 3 2 4 2 4 1 3 1 4 3 4 3 5 1 4 4 3 4...

result:

ok 1724

Test #92:

score: 0
Accepted
time: 315ms
memory: 101044kb

input:

1000000 8
64888 17614 29273 21518 75888 6946 47721 61907 11828 24652 16306 65051 62754 62782 67736 2668 6347 57396 1667 53620 51465 30508 78231 7312 1054 45284 60963 23603 81746 2584 46712 9401 44842 12375 86989 44824 5681 79113 13935 41530 16983 7209 77913 65314 66546 39261 19643 28819 24393 15351 ...

output:

46
64888 17614 29273 21518 75888 6946 47721 61907 11828 24652 16306 65051 62754 62782 67736 2668 6347 57396 1667 53620 51465 30508 78231 7312 1054 45284 60963 23603 81746 2584 46712 9401 44842 12375 86989 44824 5681 79113 13935 41530 16983 7209 77913 65314 66546 39261 19643 28819 24393 15351 15525 7...

result:

ok 46

Test #93:

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

input:

1000000 9
1 1 2 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 2 1 1 1 1 2 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 1 2 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 1 1 1 1 1 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 1 2 2 2 1 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 1 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 2 1 ...

output:

12341
1 1 2 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 2 1 1 1 1 2 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 1 2 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 1 1 1 1 1 2 2 2 0 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 1 2 2 2 1 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 1 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 2 1 1 1 ...

result:

ok 12341

Test #94:

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

input:

1000000 9
3 3 1 2 3 1 2 1 2 3 2 3 1 1 3 3 2 2 3 2 2 1 2 1 1 1 2 2 2 3 1 1 1 2 1 3 3 2 1 1 1 1 1 2 2 3 3 1 2 3 1 2 3 2 2 2 2 3 3 1 2 1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 3 4 4 2 4 2 3 5 5 1 5 1 2 2 4 5 5 4 1 1 5 5 1 1 2 3 1 5 4 3 2 3 2 3 2 2 3 5 5 4 1 5 1 1 4 4 ...

result:

ok 510

Test #96:

score: 0
Accepted
time: 278ms
memory: 101144kb

input:

1000000 9
74670 17901 21678 77792 2715 32980 92036 81708 67663 29812 39357 23802 73630 4237 19491 79586 72784 53160 26760 2935 4993 25877 21250 86441 7633 99829 19844 8072 15839 8563 33140 77832 78657 87515 11946 47053 40821 62802 44434 23856 27478 51297 28986 53191 47719 77906 75391 17696 40725 402...

output:

4
74670 17901 21678 77792 2715 32980 92036 81708 67663 29812 39357 23802 73630 4237 19491 79586 72784 53160 26760 2935 4993 25877 21250 86441 7633 99829 19844 8072 15839 8563 33140 77832 78657 87515 11946 47053 40821 62802 44434 23856 27478 51297 28986 53191 47719 77906 75391 17696 40725 40235 56708...

result:

ok 4

Test #97:

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

input:

1000000 10
2 2 1 2 1 2 1 2 2 2 2 1 2 1 1 2 2 1 1 1 2 2 1 1 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 1 2 2 2 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 1 2 2 1 1 2 2 2 1 2 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 1 2 1 1 2 2 1 1 1 2 1 2 2 1 2 1 1 2 2 2 1 2 1...

output:

7121
2 2 1 2 1 2 1 2 2 2 2 1 2 1 1 2 2 1 1 1 2 2 1 1 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 1 2 2 2 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 1 2 2 1 1 2 2 2 1 2 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 1 2 1 1 2 2 1 1 1 2 1 2 2 1 2 1 1 2 2 2 1 2 1 1 2 1...

result:

ok 7121

Test #98:

score: 0
Accepted
time: 197ms
memory: 101208kb

input:

1000000 10
1 2 3 1 2 2 3 1 1 1 3 1 2 3 3 3 2 1 1 3 2 2 2 1 3 3 2 3 3 1 1 2 2 3 3 1 2 1 2 1 1 2 1 2 3 3 2 2 1 1 3 3 3 2 3 1 3 3 1 1 3 3 2 1 1 3 3 3 1 3 1 2 3 1 3 1 2 3 2 1 2 2 2 3 1 2 1 2 1 1 3 2 3 3 2 2 2 3 3 3 2 2 2 2 2 2 3 3 2 2 3 1 2 1 1 2 3 1 3 3 1 3 2 3 1 2 2 1 3 2 3 2 1 2 1 3 1 3 1 2 2 2 2 2 2...

output:

1196
1 2 3 1 2 2 3 1 1 1 3 1 2 3 3 3 2 1 1 3 2 2 2 1 3 3 2 3 3 1 1 2 2 3 3 1 2 1 2 1 1 2 1 2 3 3 2 2 1 1 3 3 3 2 3 1 3 3 1 1 3 3 2 1 1 3 3 3 1 3 1 2 3 1 3 1 2 3 2 1 2 2 2 3 1 2 1 2 1 1 3 2 3 3 2 2 2 3 3 3 2 2 2 2 2 2 3 3 2 2 3 1 2 1 1 2 3 1 3 3 1 3 2 3 1 2 2 1 3 2 3 2 1 2 1 3 1 3 1 2 2 2 2 2 2 1 1 1...

result:

ok 1196

Test #99:

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

input:

1000000 10
5 2 3 2 3 3 5 2 2 3 4 3 4 4 1 4 5 1 2 4 1 2 3 2 1 5 2 4 5 4 1 2 1 4 2 4 4 2 3 5 2 1 4 1 4 5 3 4 1 5 2 2 2 2 5 3 3 1 5 1 4 1 1 2 5 1 5 4 2 2 2 5 3 5 1 5 2 3 5 5 4 2 5 2 4 2 5 5 4 1 2 5 1 3 5 2 4 1 4 1 5 2 5 1 5 1 1 1 1 2 2 2 5 5 2 3 4 2 5 3 1 2 1 2 1 1 4 5 5 3 4 3 1 4 1 2 3 4 2 2 4 4 3 1 4...

output:

159
5 2 3 2 3 3 5 2 2 3 4 3 4 4 1 4 5 1 2 4 1 2 3 2 1 5 2 4 5 4 1 2 1 4 2 4 4 2 3 5 2 1 4 1 4 5 3 4 1 5 2 2 2 2 5 3 3 1 5 1 4 1 1 2 5 1 5 4 2 2 2 5 3 5 1 5 2 3 5 5 4 2 5 2 4 2 5 5 4 1 2 5 1 3 5 2 4 1 4 1 5 2 5 1 5 1 1 1 1 2 2 2 5 5 2 3 4 2 5 3 1 2 1 2 1 1 4 5 5 3 4 3 1 4 1 2 3 4 2 2 4 4 3 1 4 5 5 4 ...

result:

ok 159

Test #100:

score: 0
Accepted
time: 312ms
memory: 101196kb

input:

1000000 10
29720 95762 51897 34197 88261 66849 3842 20393 67763 77068 26485 70371 71113 22875 56985 65806 86620 81668 65946 28761 91870 16202 56178 74102 60597 32538 92117 63862 94724 18813 60575 46354 66747 99448 46604 43867 63295 62731 96896 91539 39755 34480 80384 36673 10091 41419 89759 19258 39...

output:

0
29720 95762 51897 34197 88261 66849 3842 20393 67763 77068 26485 70371 71113 22875 56985 65806 86620 81668 65946 28761 91870 16202 56178 74102 60597 32538 92117 63862 94724 18813 60575 46354 66747 99448 46604 43867 63295 62731 96896 91539 39755 34480 80384 36673 10091 41419 89759 19258 39509 60881...

result:

ok 0

Test #101:

score: 0
Accepted
time: 196ms
memory: 101256kb

input:

1000000 1000
1 2 2 2 3 1 2 2 1 3 1 2 2 3 1 1 1 3 1 1 3 1 2 3 1 1 2 2 3 1 2 3 3 2 3 2 1 1 2 3 2 1 1 2 1 2 2 1 3 1 1 1 2 1 1 1 2 2 2 3 3 3 2 1 2 2 2 3 3 1 2 3 1 1 2 1 2 2 3 1 2 3 3 3 1 1 1 1 2 2 2 1 2 3 2 2 3 1 3 1 2 1 1 3 2 3 3 2 3 2 3 1 3 2 1 1 3 1 2 3 1 2 1 3 3 1 3 3 3 1 2 1 3 1 3 1 1 2 3 1 1 3 1 3...

output:

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

result:

ok 0

Test #102:

score: 0
Accepted
time: 215ms
memory: 101272kb

input:

1000000 1000000
3 3 1 1 2 2 1 2 3 3 1 2 3 3 1 2 1 1 2 2 3 1 2 2 1 2 3 3 1 1 3 3 2 1 1 2 1 2 3 3 3 2 3 3 2 3 3 2 3 3 2 1 2 3 1 3 1 2 3 1 3 3 2 1 2 3 1 2 1 2 1 2 2 3 3 3 3 2 1 3 2 1 2 2 3 3 1 2 2 2 3 1 2 3 3 1 2 1 2 1 2 1 3 1 3 2 2 3 1 3 3 3 2 1 1 1 2 2 1 2 2 1 3 1 3 3 2 2 1 3 3 3 2 1 1 2 3 1 2 3 2 3 ...

output:

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

result:

ok 0

Test #103:

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

input:

100 3
44050 44050 44050 84115 10917 10917 36945 36945 33064 33064 33541 26934 26934 26934 41932 27043 27043 62590 61829 61829 61829 67417 26046 26046 26046 84640 63919 90649 90649 90649 21857 90003 90003 50162 50162 97151 94354 96280 96280 96280 13715 69365 69365 45708 71490 26828 26828 92733 92733 ...

output:

34
44050 100000 44050 84115 10917 100000 36945 100000 33064 100000 33541 100000 26934 100000 41932 100000 27043 62590 61829 100000 61829 67417 26046 100000 26046 84640 63919 90649 0 90649 21857 90003 0 50162 0 97151 94354 96280 0 96280 13715 69365 0 45708 0 26828 0 92733 0 41594 0 44184 0 22917 0 39...

result:

ok 34

Test #104:

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

input:

100 4
75479 75479 57768 57768 57768 82480 82480 61474 61474 62606 841 841 52703 52703 52703 26964 26964 62664 37045 37045 37045 54691 32834 32834 85334 85334 85334 84211 84211 86129 86129 627 79180 79180 79180 6383 93722 93722 93722 93722 26623 43077 43077 40631 40631 40631 93190 93190 26381 26381 4...

output:

20
75479 75479 57768 100000 57768 82480 82480 0 61474 62606 841 841 52703 0 52703 26964 26964 62664 37045 100000 37045 54691 32834 32834 85334 0 85334 84211 84211 100000 86129 627 79180 0 79180 6383 93722 93722 0 93722 26623 43077 43077 40631 100000 40631 93190 93190 26381 100000 48629 48629 100000 ...

result:

ok 20

Test #105:

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

input:

100 5
91458 91458 91458 19817 19817 96942 96942 96942 36513 36513 36804 36804 36804 36804 1444 1444 78133 78133 78133 78133 62866 90631 90631 90631 60222 60222 70799 70799 3965 3965 3965 3965 13733 4165 4165 4165 4165 61944 56651 56651 56651 57588 20131 20131 20131 20131 22325 22325 4324 4324 4324 4...

output:

17
91458 91458 91458 100000 19817 96942 96942 96942 36513 100000 36804 36804 36804 100000 1444 1444 78133 78133 0 78133 62866 90631 90631 90631 0 60222 70799 70799 3965 3965 100000 3965 13733 4165 4165 100000 4165 61944 56651 56651 56651 57588 20131 20131 100000 20131 22325 22325 4324 100000 4324 40...

result:

ok 17

Test #106:

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

input:

100 6
58143 45190 45190 45190 45190 91580 91580 26217 26217 26217 88612 88612 88612 88612 33944 33944 33944 48410 48410 48410 7416 7416 7416 7416 88395 88395 19222 19222 19222 19222 88526 56485 56485 56485 56485 56485 92404 92404 46257 46257 46257 46257 46257 63052 41533 41533 41533 41533 41533 5763...

output:

14
58143 45190 45190 45190 45190 100000 91580 26217 26217 26217 88612 88612 0 88612 33944 33944 33944 48410 48410 0 7416 7416 7416 7416 0 88395 19222 19222 19222 19222 88526 56485 56485 56485 100000 56485 92404 92404 46257 46257 46257 100000 46257 63052 41533 41533 41533 100000 41533 57639 18879 188...

result:

ok 14

Test #107:

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

input:

100 7
73756 73756 73756 73756 79039 79039 79039 79039 59396 59396 67191 67191 67191 67191 67191 3847 3847 3847 5978 5978 5978 5978 5978 4136 37181 37181 37181 37181 37181 25589 25589 25589 66647 66647 66647 66647 66647 42222 42222 42222 99178 99178 99178 14582 14582 14582 14582 14582 61035 61035 146...

output:

11
73756 73756 73756 73756 79039 79039 0 79039 59396 59396 67191 67191 67191 0 67191 3847 3847 3847 5978 5978 5978 0 5978 4136 37181 37181 37181 37181 37181 25589 100000 25589 66647 66647 66647 66647 66647 42222 100000 42222 99178 99178 99178 14582 14582 14582 100000 14582 61035 61035 14694 14694 14...

result:

ok 11

Test #108:

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

input:

100 8
2179 2179 2179 70321 70321 70321 70321 70321 70321 60420 60420 84028 84028 84028 84028 84028 84028 82713 97309 97309 97309 97309 97309 97309 97309 97309 53732 78308 78308 78308 78308 78308 78308 78308 78308 22885 59214 59214 59214 59214 59214 59214 59214 59214 38569 59516 59516 59516 59516 595...

output:

11
2179 2179 2179 70321 70321 70321 70321 0 70321 60420 60420 84028 84028 84028 84028 0 84028 82713 97309 97309 97309 97309 97309 97309 0 97309 53732 78308 78308 78308 78308 78308 78308 0 78308 22885 59214 59214 59214 59214 59214 59214 0 59214 38569 59516 59516 59516 59516 59516 59516 22453 100000 6...

result:

ok 11

Test #109:

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

input:

100 9
80610 80610 80610 80610 61010 61010 61010 61010 61010 61010 94331 94331 75791 75791 75791 75791 75791 75791 96581 96581 96581 14769 14769 14769 14769 14769 14769 14769 87232 87232 66421 66421 66421 66421 66421 66421 99452 99452 99452 99452 94957 94957 94957 94957 94957 94957 97413 97413 75224 ...

output:

9
80610 80610 80610 80610 61010 61010 61010 61010 100000 61010 94331 94331 75791 75791 75791 75791 75791 75791 96581 96581 0 14769 14769 14769 14769 14769 14769 14769 0 87232 66421 66421 66421 66421 66421 66421 99452 99452 0 99452 94957 94957 94957 94957 94957 94957 97413 97413 75224 75224 75224 752...

result:

ok 9

Test #110:

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

input:

100 10
95150 95150 95150 95150 95150 76320 76320 76320 76320 76320 78962 78962 78962 78962 78962 78962 73978 73978 73978 73978 79890 79890 79890 79890 79890 79890 79890 8557 8557 79719 79719 79719 79719 79719 79719 79719 79719 64544 64544 64544 78917 78917 78917 78917 78917 78917 78917 15369 15369 1...

output:

8
95150 95150 95150 95150 95150 76320 76320 76320 100000 76320 78962 78962 78962 78962 78962 78962 73978 73978 100000 73978 79890 79890 79890 79890 79890 79890 79890 8557 8557 79719 79719 79719 79719 79719 79719 0 79719 64544 64544 64544 78917 78917 78917 78917 78917 0 78917 15369 15369 15369 15369 ...

result:

ok 8

Test #111:

score: 0
Accepted
time: 311ms
memory: 101260kb

input:

1000000 3
65305 65305 65305 5886 24136 24136 22777 26122 21328 93996 93996 23418 75301 61412 61412 73277 73277 17473 94729 94729 94729 4655 59070 59070 3157 34183 28888 85350 85350 85350 62032 90685 90685 42909 42909 53629 35535 35535 35535 43246 12688 12688 65114 4307 44693 33769 64625 64625 64625 ...

output:

369852
65305 100000 65305 100000 24136 100000 22777 26122 21328 93996 0 23418 0 61412 0 73277 0 17473 0 94729 0 4655 0 59070 3157 34183 28888 85350 0 85350 62032 90685 0 42909 0 53629 35535 100000 35535 43246 12688 100000 65114 100000 44693 100000 64625 100000 64625 100000 85056 100000 85056 100000 ...

result:

ok 369852

Test #112:

score: 0
Accepted
time: 323ms
memory: 101152kb

input:

1000000 4
38820 55080 55080 55080 1659 1659 30334 30334 1240 56318 56318 56318 2305 9619 9619 4465 98235 98235 98235 98235 61364 86296 86296 86296 86296 75954 88684 88684 88684 88684 18937 49146 49146 49146 49146 6451 54118 54118 54118 35809 83744 83744 83744 67853 70057 70057 18950 18950 18950 5190...

output:

200786
38820 55080 55080 0 1659 1659 0 30334 1240 56318 0 56318 2305 9619 9619 4465 98235 98235 0 98235 61364 86296 86296 0 86296 75954 88684 88684 0 88684 18937 49146 49146 0 49146 6451 54118 0 54118 35809 83744 0 83744 67853 70057 70057 18950 100000 18950 51904 51904 47300 100000 47931 47931 10000...

result:

ok 200786

Test #113:

score: 0
Accepted
time: 319ms
memory: 101100kb

input:

1000000 5
17928 17928 17928 45606 45606 45606 43325 43325 43325 83760 83760 83760 35296 35296 69066 69066 42719 42719 42719 42719 97285 71564 71564 71564 71564 98079 98079 92305 92305 98844 98844 98844 92204 98959 98959 98959 98959 98959 11986 75162 75162 75162 75162 2065 52331 52331 52331 52331 304...

output:

160948
17928 17928 17928 45606 0 45606 43325 43325 43325 83760 0 83760 35296 35296 69066 69066 42719 42719 100000 42719 97285 71564 71564 100000 71564 98079 98079 92305 92305 98844 0 98844 92204 98959 98959 98959 0 98959 11986 75162 75162 0 75162 2065 52331 52331 0 52331 30490 57947 57947 0 57947 17...

result:

ok 160948

Test #114:

score: 0
Accepted
time: 282ms
memory: 101144kb

input:

1000000 6
4100 4100 93128 93128 93128 93128 93128 39233 39233 62189 62189 62189 62189 62189 28220 28220 76491 76491 76491 76491 48156 90219 90219 90219 90219 28499 28499 51452 51452 51452 51452 32523 32523 59073 59073 59073 59073 40021 87191 87191 87191 87191 28526 28526 69005 69005 69005 11417 1141...

output:

134414
4100 4100 93128 93128 93128 0 93128 39233 39233 62189 62189 62189 0 62189 28220 28220 76491 76491 0 76491 48156 90219 90219 90219 90219 28499 100000 51452 51452 51452 51452 100000 32523 59073 59073 59073 59073 40021 87191 87191 87191 87191 0 28526 69005 69005 69005 11417 11417 100000 11417 54...

result:

ok 134414

Test #115:

score: 0
Accepted
time: 301ms
memory: 101108kb

input:

1000000 7
53309 53309 53309 53309 47029 47029 47029 47029 47826 47826 47826 27176 27176 27176 27176 95424 95424 84539 84539 84539 84539 84539 84539 90002 23944 23944 23944 23944 23944 23944 88642 88642 72335 72335 72335 72335 72335 87168 87168 87168 37185 37185 37185 39588 39588 39588 39588 7840 784...

output:

115509
53309 53309 53309 53309 47029 47029 100000 47029 47826 47826 47826 27176 27176 100000 27176 95424 95424 84539 84539 84539 84539 100000 84539 90002 23944 23944 23944 23944 100000 23944 88642 88642 72335 72335 72335 100000 72335 87168 87168 87168 37185 37185 37185 39588 39588 0 39588 7840 7840 ...

result:

ok 115509

Test #116:

score: 0
Accepted
time: 300ms
memory: 101116kb

input:

1000000 8
65189 65189 65189 5862 5862 5862 5862 5862 91293 91293 91293 91293 30468 30468 30468 83963 83963 83963 83963 83963 83963 58821 58821 86999 86999 86999 86999 86999 47179 47179 47179 47179 49881 49881 49881 49881 49881 28297 28297 81578 81578 81578 81578 81578 81578 45725 70585 70585 70585 7...

output:

100958
65189 65189 65189 5862 5862 5862 100000 5862 91293 91293 91293 91293 30468 30468 30468 83963 83963 83963 83963 0 83963 58821 58821 86999 86999 86999 86999 86999 47179 47179 100000 47179 49881 49881 49881 49881 49881 28297 28297 81578 81578 81578 81578 0 81578 45725 70585 70585 70585 70585 705...

result:

ok 100958

Test #117:

score: 0
Accepted
time: 317ms
memory: 101116kb

input:

1000000 9
75670 75670 75670 75670 96772 96772 96772 96772 96772 43495 43495 43495 92982 92982 92982 92982 92982 92982 86750 86750 86750 86750 96162 96162 96162 96162 14239 14239 14239 14239 14239 89246 89246 89246 89246 73012 73012 73012 73012 97023 97023 97023 97023 97023 74594 74594 74594 76197 76...

output:

89752
75670 75670 75670 75670 96772 96772 96772 0 96772 43495 43495 43495 92982 92982 92982 92982 0 92982 86750 86750 86750 86750 96162 96162 96162 96162 14239 14239 14239 100000 14239 89246 89246 89246 89246 73012 73012 73012 73012 97023 97023 97023 0 97023 74594 74594 74594 76197 76197 76197 76197...

result:

ok 89752

Test #118:

score: 0
Accepted
time: 299ms
memory: 101116kb

input:

1000000 10
10384 10384 10384 10384 10384 10384 55625 55625 55625 55625 55625 49001 49001 49001 49001 80908 80908 80908 80908 80908 80908 80908 75246 75246 88508 88508 88508 88508 88508 88508 88508 30478 30478 98675 98675 98675 98675 98675 98675 98675 98675 3726 3726 7176 7176 7176 7176 7176 7176 717...

output:

80632
10384 10384 10384 10384 10384 10384 55625 55625 55625 0 55625 49001 49001 49001 49001 80908 80908 80908 80908 80908 0 80908 75246 75246 88508 88508 88508 88508 88508 88508 88508 30478 30478 98675 98675 98675 98675 98675 98675 0 98675 3726 3726 7176 7176 7176 7176 7176 7176 7176 481 481 100000 ...

result:

ok 80632

Test #119:

score: 0
Accepted
time: 300ms
memory: 101212kb

input:

1000000 100
67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 ...

output:

8012
67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 6...

result:

ok 8012

Test #120:

score: 0
Accepted
time: 305ms
memory: 100984kb

input:

1000000 1000
7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 77...

output:

809
7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7...

result:

ok 809

Test #121:

score: 0
Accepted
time: 308ms
memory: 101072kb

input:

1000000 10000
1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1...

output:

78
1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 14...

result:

ok 78

Test #122:

score: 0
Accepted
time: 322ms
memory: 101108kb

input:

1000000 999998
20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 200...

output:

1
20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 2006...

result:

ok 1

Test #123:

score: 0
Accepted
time: 294ms
memory: 101276kb

input:

1000000 999999
71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 715...

output:

1
71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 7156...

result:

ok 1

Test #124:

score: 0
Accepted
time: 313ms
memory: 101256kb

input:

1000000 1000000
25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25...

output:

0
25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 2579...

result:

ok 0