QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#140286#4608. 小 Y 和地铁myee100 ✓60ms1896kbC++112.0kb2023-08-15 16:56:462023-08-15 16:57:07

Judging History

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

  • [2023-08-15 16:57:07]
  • 评测
  • 测评结果:100
  • 用时:60ms
  • 内存:1896kb
  • [2023-08-15 16:56:46]
  • 提交

answer

// 那就是希望。
// 即便需要取模,也是光明。

#include <algorithm>
#include <stdio.h>
#include <vector>
typedef long long llt;
typedef unsigned uint;typedef unsigned long long ullt;
typedef bool bol;typedef char chr;typedef void voi;
typedef double dbl;
template<typename T>bol _max(T&a,T b){return(a<b)?a=b,true:false;}
template<typename T>bol _min(T&a,T b){return(b<a)?a=b,true:false;}
template<typename T>T lowbit(T n){return n&-n;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T lcm(T a,T b){return(a!=0||b!=0)?a/gcd(a,b)*b:(T)0;}
template<typename T>T exgcd(T a,T b,T&x,T&y){if(b!=0){T ans=exgcd(b,a%b,y,x);y-=a/b*x;return ans;}else return y=0,x=1,a;}
template<typename T>T power(T base,T index,T mod)
{
    T ans=1%mod;
    while(index)
    {
        if(index&1)ans=ans*base%mod;
        base=base*base%mod,index>>=1;
    }
    return ans;
}
// Heaven and Earth... My guiding star...
// Akira Complex R.I.P.
uint A[45],L[45],R[45],n,m,ans;
voi dfs(uint p,uint s1,uint s2,uint wil)
{
    if(p==m)_min(ans,wil);
    if(wil>=ans)return;
    uint c1r=__builtin_popcount(s1>>R[p]),c1l=__builtin_popcount(s1>>L[p]);
    uint c2r=__builtin_popcount(s2>>R[p]),c2l=__builtin_popcount(s2>>L[p]);
    dfs(p+1,s1|1u<<R[p],s2,wil+std::min<uint>(c1l-c1r,c2l+c1r));
    dfs(p+1,s1,s2|1u<<R[p],wil+std::min<uint>(c2l-c2r,c1l+c2r));
}
voi solve()
{
    scanf("%u",&n),m=0;for(uint i=0;i<n;i++)A[i]=R[i]=-1;
    for(uint i=0,v;i<n;i++){scanf("%u",&v);if(~A[--v])R[A[v]]=i;else A[v]=i;}
    for(uint i=0;i<n;i++)A[i]=0;
    for(uint i=0;i<n;i++)if(~R[i])A[R[i]]=1;
    for(uint i=1;i<n;i++)A[i]+=A[i-1];
    for(uint i=0;i<n;i++)if(~R[i])L[m]=A[i],R[m++]=A[R[i]-1];
    if(m<=1){puts("0");return;}
    ans=-1,dfs(1,1u<<R[0],0,0),printf("%u\n",ans);
}
int main()
{
#ifdef MYEE
    freopen("QAQ.in","r",stdin);
    freopen("QAQ.out","w",stdout);
#endif
    uint t;scanf("%u",&t);
    while(t--)solve();
    return 0;
}

// 那就是希望。
// 即便需要取模,也是光明。

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

100
2
2 2
2
1 1
2
2 2
2
1 1
2
1 1
2
2 2
2
2 2
2
1 1
2
1 1
2
2 2
2
1 1
2
1 1
1
1
2
2 2
2
1 1
2
1 1
2
2 2
2
1 1
1
1
2
1 1
2
1 1
2
2 2
2
1 2
2
1 2
2
2 2
1
1
2
2 2
2
2 2
2
2 2
2
1 1
2
2 2
2
1 1
2
2 2
2
1 1
1
1
2
2 2
2
2 2
2
2 2
1
1
2
2 2
2
1 1
1
1
2
1 1
2
2 2
2
1 1
1
1
2
2 2
2
1 1
2
2 2
2
2 2
2
1 1
2
2 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #2:

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

input:

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

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #3:

score: 2
Accepted
time: 1ms
memory: 1712kb

input:

100
4
3 4 4 3
4
3 2 2 3
4
3 2 3 2
4
1 3 1 3
4
4 4 2 2
4
4 1 4 1
4
2 4 4 2
4
1 1 3 3
4
3 1 3 1
4
1 3 1 3
3
1 2 1
3
1 2 1
4
1 4 4 1
3
2 2 3
4
4 2 2 4
4
1 3 3 1
4
2 2 4 4
3
1 1 3
4
2 1 1 2
4
4 1 4 1
4
4 2 2 4
4
3 3 4 4
4
4 4 3 3
4
3 3 2 2
4
1 1 4 4
4
2 4 4 2
4
4 1 4 1
2
1 1
4
3 1 1 3
4
4 3 4 3
4
4 2 4 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #4:

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

input:

100
5
3 5 5 3 1
4
2 4 2 4
5
5 2 1 5 2
5
3 1 5 1 5
5
1 4 4 1 3
5
5 2 1 5 1
4
1 4 4 1
5
3 4 4 1 1
4
3 1 3 4
5
5 1 4 4 1
4
1 2 2 1
5
2 3 4 3 4
4
2 2 3 3
5
5 5 1 3 1
5
5 4 4 3 3
5
4 2 2 5 4
5
1 3 3 5 5
5
3 3 4 5 4
5
5 1 5 3 3
5
5 4 3 3 5
5
2 2 5 1 1
4
2 1 2 1
5
4 4 2 5 5
5
4 1 2 1 4
4
4 3 4 3
5
5 1 1 4 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #5:

score: 2
Accepted
time: 1ms
memory: 1760kb

input:

100
6
2 6 5 2 6 5
5
2 4 4 2 3
5
2 2 5 4 5
6
4 3 3 4 5 5
6
5 1 5 1 2 2
5
2 1 1 5 5
6
4 4 3 2 2 3
6
6 1 1 2 2 6
6
5 1 5 1 6 6
6
4 4 3 1 1 3
6
6 4 6 4 5 5
6
6 6 4 4 2 2
6
3 3 2 6 6 2
6
5 2 2 5 6 6
6
3 3 2 4 4 1
6
2 1 3 2 1 3
6
6 5 5 3 6 3
6
3 5 5 6 3 6
6
5 5 2 2 6 6
6
3 5 5 3 4 4
6
6 5 4 4 6 5
6
3 2 5 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 numbers

Test #6:

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

input:

100
8
5 3 4 5 1 4 1 3
8
7 1 5 6 7 5 6 1
8
2 7 8 3 7 8 3 2
8
7 8 6 2 7 6 8 2
8
1 6 3 2 6 3 2 1
8
2 4 1 3 4 1 3 2
8
5 8 1 4 8 1 4 5
8
3 1 8 5 3 8 5 1
8
8 6 3 7 6 3 8 7
8
1 6 8 3 6 8 1 3
8
6 3 4 1 3 4 1 6
8
5 7 2 2 7 5 1 1
8
5 2 5 7 7 8 8 2
8
6 1 4 3 6 4 1 3
8
5 1 7 3 1 5 7 3
8
5 3 6 6 7 5 3 7
8
6 5 2 ...

output:

0
1
1
1
1
1
1
1
1
1
1
0
0
1
0
0
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
1
0
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1

result:

ok 100 numbers

Test #7:

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

input:

100
9
4 1 5 5 8 4 3 8 1
9
4 8 3 6 4 3 8 6 9
9
9 6 6 2 5 9 5 2 1
9
2 4 7 3 6 2 3 6 7
9
6 1 3 9 7 3 9 7 6
9
1 2 9 4 2 9 1 7 4
9
6 7 6 8 3 3 9 7 9
9
9 1 3 2 8 9 3 2 1
9
6 1 7 9 6 7 1 3 9
8
7 4 1 8 7 4 8 1
9
2 5 7 3 2 7 3 5 1
8
3 7 8 4 3 8 7 4
9
3 1 5 2 3 5 1 4 2
8
7 4 1 3 7 1 3 4
9
2 4 9 7 2 9 1 7 4
9
...

output:

0
1
0
1
1
1
0
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
0
0
0
1
0
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0

result:

ok 100 numbers

Test #8:

score: 2
Accepted
time: 1ms
memory: 1752kb

input:

100
9
6 1 1 9 8 9 5 8 6
10
3 10 8 5 10 5 3 8 9 9
10
6 1 6 2 2 10 7 7 10 1
10
3 4 8 9 3 2 9 4 2 8
10
5 8 9 10 5 9 2 2 8 10
10
7 1 2 9 6 2 9 1 7 6
10
9 4 10 9 3 8 5 5 8 4
10
7 2 7 5 3 4 5 3 2 4
10
3 2 5 9 3 5 1 2 9 1
10
2 1 10 7 7 5 1 10 5 2
10
3 8 4 5 3 4 6 6 5 8
10
4 5 4 2 1 8 5 1 8 2
10
2 3 5 4 6 3...

output:

0
0
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
2
1
1
2
0
1
1
1
1
1

result:

ok 100 numbers

Test #9:

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

input:

100
11
9 8 3 2 8 3 9 1 7 2 7
11
2 10 8 5 7 10 5 8 1 1 7
11
3 10 1 11 6 11 10 4 1 6 3
10
10 8 4 5 8 2 2 4 10 5
11
2 7 1 9 9 5 7 3 1 2 5
11
3 10 9 6 8 7 6 9 8 7 3
11
5 7 10 9 7 3 10 3 5 9 1
10
3 4 10 5 10 9 4 5 9 3
11
10 8 5 11 3 8 11 9 9 3 10
11
7 8 6 4 9 7 4 3 8 3 9
11
1 6 11 7 6 10 10 11 1 7 5
11
7...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
2
1
1
1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
2
1
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
1
0
1
1
1
1
1

result:

ok 100 numbers

Test #10:

score: 2
Accepted
time: 1ms
memory: 1768kb

input:

100
12
5 9 12 2 10 5 2 9 12 1 1 10
12
2 1 10 12 4 10 12 4 2 9 9 1
12
3 1 7 3 6 10 10 8 7 6 8 1
12
2 1 6 5 11 1 10 2 5 11 6 10
11
5 10 4 4 7 3 9 10 3 7 9
12
5 6 1 7 7 4 10 5 6 4 1 10
12
7 12 10 8 4 3 8 4 7 12 10 3
12
4 5 1 2 5 10 1 10 4 7 7 2
12
5 10 4 8 4 6 5 8 11 6 11 10
12
5 6 12 3 9 5 6 4 3 4 9 1...

output:

1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
2
0
1
1
2
0
1
1
2
1
1
1
1
1
0
1
1
1
1
1
1
1
2
1
1
0
1
1
1
1
1
1
0
1
2
0
1
0
1
1
1
1
1
1
1
2
1
1
1
1
0
1
1
0
1
1
0
1
1
1
0
2
1
0
1
1

result:

ok 100 numbers

Test #11:

score: 2
Accepted
time: 1ms
memory: 1740kb

input:

100
13
13 12 3 8 13 5 12 1 1 8 5 4 3
12
8 11 2 7 2 6 7 4 8 6 11 4
13
10 6 10 11 9 4 8 3 4 8 3 9 11
13
2 13 7 12 12 8 6 13 5 7 6 2 8
13
7 12 12 13 5 6 7 8 5 6 8 4 13
13
7 13 11 4 12 2 12 10 2 7 11 13 4
13
7 13 2 1 11 3 13 2 11 12 7 3 1
13
6 2 11 6 8 8 13 11 13 2 5 9 5
12
7 7 3 10 9 6 9 11 3 6 10 11
1...

output:

1
1
1
1
1
1
2
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
0
1
0
2
1
1
1
1
1
2
1
0
1
1
1
1
2
1
0
1
0
0
1
1
2
1
0
1
1
1
2
1
1
1
1
1
0
1
1
1
0
2
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
0

result:

ok 100 numbers

Test #12:

score: 2
Accepted
time: 1ms
memory: 1692kb

input:

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

output:

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

result:

ok 100 numbers

Test #13:

score: 2
Accepted
time: 1ms
memory: 1768kb

input:

100
14
1 5 9 12 7 13 7 9 12 3 5 3 13 1
15
12 6 1 3 10 12 8 6 13 3 10 8 1 4 4
14
1 11 3 6 9 9 5 7 5 3 7 11 6 1
15
7 11 11 10 10 6 2 7 6 2 14 14 9 1 15
15
11 8 11 9 3 1 7 15 14 7 9 1 14 2 3
15
3 2 14 8 3 13 4 12 10 8 2 13 4 10 14
15
8 10 10 12 1 7 12 1 7 11 13 14 11 13 8
15
3 1 4 3 8 12 11 11 7 4 1 2 ...

output:

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

result:

ok 100 numbers

Test #14:

score: 2
Accepted
time: 1ms
memory: 1764kb

input:

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

output:

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

result:

ok 100 numbers

Test #15:

score: 2
Accepted
time: 1ms
memory: 1704kb

input:

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

output:

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

result:

ok 100 numbers

Test #16:

score: 2
Accepted
time: 1ms
memory: 1744kb

input:

100
20
14 7 16 5 16 11 8 7 6 11 10 6 1 8 10 5 9 1 14 9
19
8 5 7 2 16 8 10 9 9 4 3 3 7 6 16 6 5 4 2
20
11 15 3 6 15 4 7 11 20 4 8 14 14 3 7 20 5 6 8 5
20
12 9 19 3 5 12 6 6 4 5 20 2 19 3 2 10 4 20 10 9
20
20 14 5 19 19 12 18 4 4 18 2 5 12 14 1 8 9 8 1 2
20
11 1 9 14 15 4 1 9 3 19 19 3 18 4 20 20 18 1...

output:

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

result:

ok 100 numbers

Test #17:

score: 2
Accepted
time: 1ms
memory: 1760kb

input:

100
22
3 3 11 9 18 7 9 15 11 13 12 8 6 8 16 12 16 18 13 7 2 6
21
20 15 13 8 6 8 20 1 17 1 12 5 6 7 14 21 12 15 7 14 17
22
9 21 18 10 5 13 17 18 1 3 15 1 13 10 15 21 7 7 5 17 3 9
21
11 8 19 3 14 12 18 21 7 19 15 15 11 17 8 18 3 21 12 7 17
22
20 10 4 14 4 9 10 2 8 18 2 7 20 5 18 14 12 12 9 13 8 7
22
2...

output:

1
2
4
3
1
3
3
1
2
2
3
3
1
3
2
5
3
2
3
2
3
1
1
1
3
4
3
1
6
4
1
4
2
2
1
1
1
4
2
2
2
2
4
5
1
1
3
1
5
3
4
5
2
5
3
4
1
3
4
3
2
3
4
5
3
2
3
1
2
4
2
5
3
2
1
5
2
2
6
7
3
1
3
2
3
4
2
3
3
2
2
5
2
2
2
1
1
3
2
3

result:

ok 100 numbers

Test #18:

score: 2
Accepted
time: 1ms
memory: 1764kb

input:

100
24
19 8 13 9 22 11 17 13 12 22 12 18 3 3 18 24 17 9 6 19 11 8 24 6
24
18 6 12 14 9 14 18 13 15 19 9 15 6 20 4 22 19 13 3 22 20 3 4 12
24
13 20 17 15 10 8 5 24 16 4 15 19 16 23 23 10 20 24 17 4 5 8 13 19
24
12 2 24 18 2 16 9 20 10 1 24 21 12 20 21 19 19 18 15 1 16 10 15 4
23
7 1 11 10 12 2 19 5 1...

output:

3
3
7
4
1
1
3
2
3
4
2
3
1
3
3
2
5
2
2
5
3
7
7
3
5
2
3
6
1
6
1
7
3
3
1
7
2
2
5
3
7
5
4
6
1
1
2
5
3
2
4
4
1
0
4
4
3
3
3
3
5
4
3
5
4
3
3
5
1
2
7
4
4
4
1
3
3
5
1
3
5
4
2
4
5
2
2
4
1
5
1
2
3
5
1
3
0
2
1
2

result:

ok 100 numbers

Test #19:

score: 2
Accepted
time: 1ms
memory: 1704kb

input:

100
26
17 23 22 25 19 14 25 14 2 21 10 7 16 21 6 13 16 7 10 5 5 22 13 2 19 6
25
16 4 7 6 25 12 17 14 18 4 2 23 10 20 17 16 14 2 23 7 25 6 12 10 18
26
24 5 2 12 17 25 26 2 25 10 22 4 17 22 8 12 20 19 19 14 26 14 15 8 15 5
26
21 9 2 17 7 11 18 13 2 7 6 1 6 1 9 23 23 15 18 20 15 3 21 3 11 20
26
9 7 14 ...

output:

1
8
2
1
9
4
3
4
4
6
3
3
3
2
3
2
3
3
4
2
4
2
2
0
2
3
6
3
6
3
1
2
4
3
2
3
4
6
9
2
4
7
3
4
4
6
3
2
6
3
4
5
5
2
2
7
3
4
4
6
3
6
4
3
3
10
2
5
4
5
1
5
6
8
2
7
2
2
6
3
5
4
5
5
4
10
7
1
8
1
8
2
3
3
6
3
4
1
9
7

result:

ok 100 numbers

Test #20:

score: 2
Accepted
time: 1ms
memory: 1764kb

input:

100
27
4 22 7 18 17 20 2 7 3 10 1 18 17 3 24 15 21 1 15 22 23 14 2 10 24 21 4
27
3 22 21 17 14 16 10 20 17 20 18 3 6 24 6 18 4 14 21 24 8 16 22 23 10 8 4
27
19 3 12 9 5 21 19 16 25 8 2 9 3 21 23 5 13 17 13 17 12 24 25 23 8 16 24
28
2 15 21 1 24 3 15 22 2 12 19 21 11 13 19 3 25 22 14 11 1 13 12 24 14...

output:

9
5
6
6
7
6
4
8
5
5
5
4
5
8
9
8
7
7
3
11
3
6
7
2
4
4
7
5
4
6
4
1
8
3
6
4
5
2
7
8
4
2
4
8
5
8
8
10
2
1
5
6
6
5
3
3
5
3
4
2
2
1
4
7
4
1
4
6
2
2
5
4
1
6
2
5
3
3
5
2
7
2
5
6
1
8
1
4
3
6
3
5
2
8
3
6
5
2
3
8

result:

ok 100 numbers

Test #21:

score: 2
Accepted
time: 2ms
memory: 1708kb

input:

100
30
26 15 29 24 17 13 13 17 7 12 2 23 15 27 12 4 23 4 22 27 5 8 2 8 29 26 7 24 22 5
30
7 1 18 5 21 3 24 1 24 6 7 12 6 8 12 20 20 21 3 5 25 26 8 14 18 14 25 16 16 26
30
12 2 21 22 28 30 15 9 5 24 20 20 8 24 9 25 26 5 12 30 25 1 21 26 1 8 15 2 22 28
30
10 26 21 28 9 28 5 16 5 24 19 24 16 8 7 1 1 18...

output:

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

result:

ok 100 numbers

Test #22:

score: 2
Accepted
time: 2ms
memory: 1736kb

input:

100
30
9 29 28 23 12 9 5 6 1 21 5 29 12 17 18 1 24 22 17 28 14 24 21 14 18 23 4 4 6 22
30
14 27 13 16 28 29 24 13 10 2 30 1 27 8 1 11 30 11 12 16 10 26 24 8 2 26 14 28 12 29
30
15 23 23 5 25 8 11 29 7 24 1 4 15 1 7 27 24 18 8 12 12 25 18 29 19 11 27 19 5 4
30
27 25 5 4 17 23 5 12 29 3 9 12 27 4 26 1...

output:

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

result:

ok 100 numbers

Test #23:

score: 2
Accepted
time: 2ms
memory: 1696kb

input:

100
31
6 12 6 24 9 21 11 12 5 14 7 10 21 25 13 24 19 14 1 16 30 7 11 19 16 25 5 3 10 3 13
31
3 9 3 5 12 4 11 30 26 27 10 15 30 7 4 2 11 7 10 9 27 12 18 21 21 5 18 26 6 6 2
31
24 23 15 4 26 24 1 18 2 15 2 8 20 25 8 20 22 1 26 21 25 23 4 13 13 19 19 22 18 11 21
30
1 21 9 30 28 2 7 30 10 24 14 6 23 24 ...

output:

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

result:

ok 100 numbers

Test #24:

score: 2
Accepted
time: 2ms
memory: 1892kb

input:

100
31
10 16 12 2 6 25 3 4 29 29 3 13 13 15 18 26 25 15 2 24 19 4 8 19 16 12 8 6 26 24 10
31
3 15 4 3 4 12 18 19 12 17 31 27 17 23 2 19 29 18 2 8 31 25 23 25 27 22 22 8 29 28 15
31
19 28 28 8 18 9 23 22 4 4 20 3 14 11 19 14 26 21 21 5 3 20 23 9 1 1 18 11 22 8 5
31
30 1 22 13 17 28 31 4 19 14 26 4 12...

output:

6
3
4
7
9
5
3
5
9
9
3
6
9
3
2
5
6
3
3
3
11
11
4
1
8
9
4
5
5
7
2
13
9
5
5
4
8
10
5
4
5
5
4
8
2
5
10
9
10
3
10
3
3
16
5
5
7
4
3
9
8
4
11
3
3
11
9
9
10
3
10
7
6
9
4
9
9
5
8
6
5
7
2
7
3
5
4
2
5
3
4
6
7
8
8
2
6
6
9
6

result:

ok 100 numbers

Test #25:

score: 2
Accepted
time: 3ms
memory: 1716kb

input:

100
32
11 28 8 15 24 9 1 2 9 8 11 26 32 15 19 24 2 28 19 1 12 12 20 20 26 25 18 16 18 16 32 25
32
22 30 22 12 30 10 24 15 15 17 17 20 4 32 4 23 24 27 26 10 26 14 1 2 2 27 16 1 32 23 16 20
31
17 7 1 27 6 14 14 4 4 24 24 8 12 6 1 23 28 23 8 20 17 27 16 16 7 21 28 12 19 21 19
32
22 28 5 19 11 26 24 9 3...

output:

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

result:

ok 100 numbers

Test #26:

score: 2
Accepted
time: 3ms
memory: 1764kb

input:

100
32
8 32 6 22 7 29 19 2 1 23 32 4 27 27 2 25 25 1 7 3 19 8 23 18 29 6 13 18 3 22 4 13
32
1 10 12 1 27 25 5 5 2 23 9 29 4 17 28 25 6 20 24 12 10 2 29 27 17 20 28 6 24 4 9 23
32
9 19 17 17 23 7 4 18 7 22 31 16 9 23 13 18 11 19 13 4 29 6 31 12 29 30 11 6 16 12 30 22
32
27 10 23 15 5 21 5 15 31 18 22...

output:

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

result:

ok 100 numbers

Test #27:

score: 2
Accepted
time: 3ms
memory: 1724kb

input:

100
33
15 23 9 27 8 18 15 2 20 9 1 27 17 23 3 29 18 28 29 20 7 6 8 32 1 16 3 2 17 16 7 6 28
33
23 2 3 24 28 30 29 5 23 31 7 30 2 8 7 20 28 11 8 3 17 20 24 31 11 6 1 17 29 10 5 10 1
33
19 22 26 27 2 10 19 8 4 2 15 22 6 3 8 27 1 28 26 28 4 33 10 20 11 20 3 32 33 15 5 6 5
33
23 30 11 21 13 12 3 21 3 33...

output:

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

result:

ok 100 numbers

Test #28:

score: 2
Accepted
time: 3ms
memory: 1760kb

input:

100
33
8 19 21 4 2 15 14 19 28 15 22 32 3 8 2 26 20 1 5 28 21 7 22 3 10 14 1 4 7 26 32 20 10
33
19 11 10 19 29 24 8 23 28 3 14 24 29 1 31 31 28 3 6 11 8 15 22 1 25 26 26 10 23 25 22 14 15
33
31 31 26 9 15 14 33 26 21 10 18 15 29 10 23 2 7 17 33 8 9 14 2 21 7 22 5 23 17 22 8 18 3
32
6 8 4 10 16 6 3 2...

output:

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

result:

ok 100 numbers

Test #29:

score: 2
Accepted
time: 4ms
memory: 1656kb

input:

100
34
25 26 20 10 12 28 29 28 10 23 21 5 26 13 25 29 24 7 14 12 9 9 19 21 23 13 1 14 7 20 5 19 24 1
34
1 27 30 24 23 1 33 11 11 7 27 9 33 26 23 6 9 14 20 30 34 32 7 6 17 26 34 14 24 21 20 32 17 21
34
14 25 27 23 8 23 2 7 33 16 14 31 7 13 5 34 13 29 5 25 18 31 34 8 1 33 27 32 16 29 18 1 2 32
34
25 1...

output:

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

result:

ok 100 numbers

Test #30:

score: 2
Accepted
time: 2ms
memory: 1756kb

input:

100
34
2 1 27 2 3 1 30 27 21 11 18 9 16 28 8 30 11 24 15 18 12 15 28 17 9 24 17 21 8 3 32 16 12 32
34
21 16 14 7 14 21 23 16 28 33 27 26 22 23 28 34 33 24 20 26 30 13 13 7 9 22 24 25 30 27 9 20 25 34
34
30 6 8 11 8 12 33 19 6 20 30 13 12 33 7 19 10 28 14 28 20 22 11 7 10 29 15 13 25 14 15 29 22 25
3...

output:

10
9
7
5
5
5
10
13
6
15
11
13
13
15
10
9
7
4
6
7
11
3
12
11
6
7
12
8
11
6
3
6
9
11
11
13
16
12
10
8
9
7
15
6
4
13
6
8
4
11
7
12
2
7
3
2
13
6
9
6
9
4
7
7
11
3
10
10
17
6
16
5
10
10
10
6
13
4
10
11
11
7
5
11
13
6
7
6
11
13
12
9
18
8
3
10
4
13
9
5

result:

ok 100 numbers

Test #31:

score: 2
Accepted
time: 4ms
memory: 1764kb

input:

100
35
27 25 34 28 20 22 15 4 3 30 28 12 3 34 33 20 1 9 22 31 19 30 18 9 32 18 25 4 21 19 15 33 12 31 32
35
29 34 1 29 2 34 15 11 19 15 8 3 1 31 18 2 19 3 5 16 27 21 11 5 8 13 9 9 22 30 30 31 22 16 13
35
19 17 9 10 15 18 17 15 16 9 6 23 19 18 1 24 28 2 22 16 10 22 29 6 24 29 12 26 28 23 1 2 25 26 12...

output:

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

result:

ok 100 numbers

Test #32:

score: 2
Accepted
time: 4ms
memory: 1652kb

input:

100
35
7 3 14 22 26 7 5 22 32 9 24 14 8 20 33 26 29 21 5 24 35 3 33 13 35 2 9 18 21 32 29 13 18 2 8
35
22 35 11 15 33 11 16 18 22 19 15 6 30 26 32 30 32 3 21 35 16 27 18 23 26 3 23 25 33 24 6 27 21 25 24
35
5 12 9 6 21 12 23 23 18 18 5 24 33 27 24 6 29 11 25 7 9 8 33 20 29 21 25 32 27 22 7 32 8 20 2...

output:

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

result:

ok 100 numbers

Test #33:

score: 2
Accepted
time: 4ms
memory: 1648kb

input:

100
36
4 7 15 7 35 27 20 1 9 34 10 27 3 24 32 28 35 10 2 15 6 32 6 1 36 9 3 2 4 33 28 36 20 34 33 24
36
32 2 14 6 12 33 29 30 27 30 18 23 21 28 6 14 2 33 27 25 25 19 3 29 16 23 13 32 12 19 18 28 16 3 13 21
36
12 32 28 36 36 27 15 5 5 25 12 32 17 4 8 28 35 25 33 11 21 27 4 8 23 15 33 6 17 35 29 21 11...

output:

14
16
10
9
10
11
14
11
15
13
5
10
8
12
14
17
19
7
12
18
6
7
8
10
9
8
18
4
9
10
9
14
14
11
9
9
5
4
10
11
11
10
14
19
9
15
8
3
11
7
4
9
8
13
11
11
8
7
12
9
10
11
8
4
10
10
19
8
17
10
11
19
5
4
12
12
3
8
9
12
9
5
15
10
4
8
10
12
11
10
6
10
9
6
10
16
17
14
19
10

result:

ok 100 numbers

Test #34:

score: 2
Accepted
time: 7ms
memory: 1752kb

input:

100
36
14 11 18 27 20 23 14 31 30 27 18 23 26 2 7 29 5 11 30 25 20 31 2 5 28 7 28 29 12 34 22 26 25 34 12 22
36
20 4 28 36 20 2 7 32 26 9 14 6 28 27 7 27 36 6 32 25 11 18 26 31 5 4 13 14 25 11 31 18 5 2 9 13
36
24 21 15 28 5 26 15 23 5 22 20 1 23 34 26 24 2 35 32 21 10 36 1 13 20 28 2 35 22 29 10 34...

output:

10
17
12
11
13
16
13
13
14
13
15
9
10
8
14
17
10
13
14
12
18
9
14
19
14
19
15
11
16
7
16
16
11
8
8
7
5
13
12
12
19
7
6
21
11
5
9
16
15
13
9
10
12
5
8
11
19
1
13
10
9
11
12
11
6
9
16
11
4
10
10
18
7
15
4
9
15
11
10
10
11
9
7
7
13
16
12
10
10
11
12
8
14
15
13
10
4
10
7
14

result:

ok 100 numbers

Test #35:

score: 2
Accepted
time: 6ms
memory: 1692kb

input:

100
37
21 16 22 7 25 20 21 31 24 9 36 13 3 27 30 36 37 33 31 30 12 16 27 22 25 14 9 33 1 7 12 24 13 14 20 3 1
37
25 12 17 32 6 26 25 12 1 34 32 8 26 24 5 29 3 30 24 23 7 5 6 34 15 18 19 19 29 22 8 1 23 7 22 18 30
37
37 18 13 4 6 30 37 7 29 5 14 26 29 10 1 4 18 7 30 5 25 21 32 17 10 2 17 14 25 22 13 ...

output:

14
8
14
14
15
5
15
4
8
4
13
14
10
18
17
9
12
9
11
11
16
13
12
12
5
9
11
16
11
7
9
15
9
13
6
6
9
10
7
11
12
12
6
13
10
5
9
9
10
4
7
10
10
11
4
6
5
8
8
13
3
18
7
9
11
16
8
13
5
12
17
10
8
11
9
15
5
6
6
11
11
9
11
14
12
9
16
15
8
14
6
9
12
10
14
7
12
9
11
9

result:

ok 100 numbers

Test #36:

score: 2
Accepted
time: 7ms
memory: 1744kb

input:

100
37
2 28 3 6 13 19 36 34 19 8 3 21 18 18 15 9 11 12 2 36 21 35 15 37 17 20 9 28 8 35 11 37 17 12 1 20 1
37
13 11 4 3 17 10 17 8 20 33 28 30 13 7 33 22 12 21 11 10 28 20 8 22 7 37 21 3 30 1 12 35 1 9 35 37 9
37
21 24 20 35 3 37 20 8 34 14 21 2 8 15 24 34 37 32 1 36 12 17 14 30 32 7 17 29 2 12 30 2...

output:

11
13
13
12
16
16
12
14
15
16
11
14
5
17
12
9
14
11
10
12
6
9
10
7
19
18
5
9
13
8
7
9
12
10
15
12
12
9
7
6
11
13
12
11
9
5
14
11
6
13
11
3
16
10
11
10
7
11
7
9
11
10
8
15
13
9
5
10
3
8
8
8
6
8
4
8
12
13
6
11
14
17
4
11
11
10
14
6
9
8
6
8
10
9
9
4
14
8
11
10

result:

ok 100 numbers

Test #37:

score: 2
Accepted
time: 7ms
memory: 1892kb

input:

100
38
9 12 27 29 14 27 17 18 14 3 33 22 22 21 10 6 30 17 12 3 18 8 13 16 29 26 21 6 30 13 9 33 37 8 16 10 37 26
38
26 32 8 9 21 31 3 17 9 32 24 31 17 7 15 25 29 29 26 24 14 13 21 7 30 13 22 15 30 37 19 3 8 35 22 37 25 35
38
4 21 20 4 7 16 34 36 35 34 28 7 23 30 33 19 20 24 33 16 36 32 26 28 23 35 3...

output:

17
10
13
15
12
10
15
14
11
9
14
12
12
10
17
13
13
17
7
14
13
16
13
9
15
12
7
15
17
18
9
17
14
5
11
8
16
13
10
10
12
4
16
15
16
11
11
10
14
12
11
15
10
11
6
11
10
8
15
14
20
13
8
7
13
11
7
24
17
18
3
8
12
5
10
9
16
10
17
4
11
14
8
16
20
9
11
5
9
8
8
6
14
5
14
15
18
7
11
14

result:

ok 100 numbers

Test #38:

score: 2
Accepted
time: 10ms
memory: 1740kb

input:

100
38
11 38 26 36 11 18 23 15 12 21 25 18 4 23 1 15 16 21 31 5 38 26 29 28 4 12 36 25 31 17 16 33 1 29 5 28 17 33
38
28 17 13 38 20 32 17 22 28 38 22 37 24 6 3 3 20 13 37 34 5 19 2 21 23 5 34 2 16 32 12 19 6 12 21 24 23 16
38
12 38 15 22 1 12 6 15 3 38 17 19 9 1 22 13 5 3 31 24 27 10 5 17 6 19 26 3...

output:

13
9
9
20
23
16
19
13
16
14
15
10
19
13
15
14
15
8
16
14
15
9
18
21
9
15
16
17
12
11
13
19
7
16
19
11
5
10
10
9
15
10
7
6
7
7
9
8
11
18
16
15
16
17
13
10
15
10
9
16
14
12
13
19
14
13
12
7
5
9
10
19
4
10
8
9
10
10
13
16
8
7
8
10
12
10
7
15
7
13
9
6
16
15
6
9
3
5
12
9

result:

ok 100 numbers

Test #39:

score: 2
Accepted
time: 11ms
memory: 1768kb

input:

100
39
22 11 30 32 4 16 38 24 5 22 11 16 39 25 6 19 15 19 4 3 23 2 29 5 26 6 9 24 38 2 8 3 15 8 30 25 9 29 26
39
19 27 10 6 14 24 31 34 6 20 17 2 10 26 12 24 20 7 14 27 38 26 29 8 29 17 31 39 2 32 39 19 11 32 8 34 12 11 7
39
9 32 16 5 37 35 38 23 29 24 36 32 19 35 11 16 9 10 18 29 36 30 8 10 37 27 1...

output:

14
16
16
13
17
14
10
13
12
20
11
15
13
13
12
12
19
15
15
14
16
12
16
17
9
13
10
7
12
12
11
14
11
21
10
11
12
14
4
14
11
14
12
11
12
13
15
13
5
17
15
5
13
14
5
11
16
15
16
12
10
16
9
15
16
11
11
10
17
13
9
20
11
7
11
14
11
10
6
8
12
7
8
7
14
14
11
14
14
16
19
11
12
9
19
11
9
15
13
5

result:

ok 100 numbers

Test #40:

score: 2
Accepted
time: 10ms
memory: 1720kb

input:

100
39
6 5 1 26 35 13 4 22 36 37 15 26 10 37 32 22 35 6 21 5 4 1 27 2 15 36 31 9 7 34 13 27 33 32 31 21 2 7 34
39
35 3 35 32 25 12 15 1 4 18 31 12 15 1 26 26 9 33 3 13 14 4 37 5 18 13 32 14 27 9 28 31 37 25 33 29 28 27 29
39
26 10 9 26 20 10 27 1 22 9 17 21 5 13 5 37 25 1 12 4 37 20 13 27 22 8 4 33 ...

output:

12
14
7
10
14
27
9
9
14
16
16
13
13
12
12
14
11
14
17
16
16
10
23
11
19
13
8
17
15
20
13
16
19
18
18
8
9
21
4
12
3
15
16
13
12
9
10
10
9
6
12
9
18
7
9
9
12
11
5
6
11
13
14
6
9
7
10
15
11
14
6
9
6
13
9
10
13
13
7
10
11
16
15
11
6
12
14
12
15
13
15
12
12
6
5
17
11
16
5
6

result:

ok 100 numbers

Test #41:

score: 2
Accepted
time: 19ms
memory: 1764kb

input:

100
40
25 28 40 7 39 37 22 1 40 11 19 7 15 24 27 38 4 25 18 39 14 1 4 37 3 21 19 30 3 22 24 21 18 27 38 14 28 11 30 15
40
1 16 33 23 26 39 23 16 21 22 2 3 18 31 1 6 28 26 39 9 34 18 21 25 3 2 25 30 7 31 33 9 11 11 22 28 7 34 30 6
40
11 7 2 13 10 2 40 14 34 14 26 25 30 18 11 22 7 39 13 19 39 34 1 27 ...

output:

24
18
11
12
15
21
18
20
14
12
10
18
11
17
16
18
15
14
18
18
24
11
24
9
18
23
12
16
6
14
15
12
19
13
12
9
11
12
8
9
11
12
13
13
17
14
9
6
13
17
15
10
14
13
14
7
7
14
7
17
20
12
14
13
16
16
21
10
8
18
13
4
9
14
11
9
8
7
19
13
11
15
17
14
11
20
9
6
8
10
12
11
12
10
14
25
5
10
14
10

result:

ok 100 numbers

Test #42:

score: 2
Accepted
time: 14ms
memory: 1768kb

input:

100
40
30 24 34 24 20 39 30 19 35 18 9 5 27 35 34 39 19 10 22 37 17 9 26 38 10 37 11 22 18 5 3 17 20 26 3 21 38 11 21 27
40
27 12 4 23 1 24 33 18 27 29 14 39 23 25 4 21 12 15 38 33 24 32 14 5 20 1 25 29 18 32 15 37 21 5 16 39 38 16 20 37
40
33 20 38 22 6 1 33 8 25 6 16 21 20 22 29 37 8 17 36 32 7 38...

output:

13
19
12
14
12
16
21
16
22
18
21
23
12
17
20
23
13
12
21
13
15
15
11
12
20
19
18
15
10
19
15
16
21
15
16
10
9
12
12
11
9
7
8
20
12
15
14
7
13
9
14
11
5
11
8
11
10
9
12
16
15
17
21
16
12
15
10
11
11
13
11
14
9
13
10
10
13
14
9
19
14
23
9
7
13
9
16
17
8
11
11
22
8
12
8
5
9
9
9
10

result:

ok 100 numbers

Test #43:

score: 2
Accepted
time: 20ms
memory: 1700kb

input:

100
41
15 32 3 5 3 11 24 14 35 38 17 27 32 35 30 31 33 14 5 12 8 17 26 11 7 37 27 33 24 31 12 7 4 26 4 30 8 38 18 37 18
41
29 14 33 40 31 29 17 30 41 11 5 41 5 8 11 3 30 7 35 3 7 6 31 19 27 14 33 21 8 21 23 24 10 17 10 40 6 27 35 24 19
41
41 7 33 21 39 28 18 35 20 3 19 5 6 18 13 23 7 22 41 35 33 20 ...

output:

19
7
21
13
18
12
17
13
17
14
13
9
15
20
10
9
10
9
10
18
9
19
15
25
17
14
24
17
16
17
14
8
17
20
15
18
18
9
14
11
13
16
11
11
9
17
11
17
20
14
23
11
6
11
15
10
4
5
11
11
4
8
13
11
10
22
18
21
12
15
8
14
7
9
17
12
16
13
14
14
17
5
25
11
14
12
13
22
17
14
9
9
10
7
11
19
20
13
20
10

result:

ok 100 numbers

Test #44:

score: 2
Accepted
time: 22ms
memory: 1716kb

input:

100
41
11 23 34 29 27 6 25 22 11 4 22 23 10 1 8 36 13 32 41 15 19 29 10 41 20 4 6 17 19 1 8 20 34 15 27 25 17 26 13 26 32
41
30 18 9 39 30 1 36 10 23 37 18 22 32 24 39 1 32 8 23 21 35 28 36 19 37 19 24 22 29 31 28 27 31 8 35 15 29 21 15 10 27
41
20 1 38 29 24 41 2 19 29 16 20 19 14 18 38 17 24 11 41...

output:

18
11
14
18
16
14
15
11
18
10
19
15
20
17
24
19
23
17
13
19
18
13
12
18
12
8
19
9
21
17
16
17
18
21
21
19
18
16
13
20
11
8
13
9
11
15
16
11
10
18
17
16
16
13
14
18
5
12
18
13
10
7
15
23
15
9
17
23
19
22
13
18
13
11
8
9
10
20
7
11
7
9
15
21
13
12
12
18
19
14
7
19
20
11
14
20
10
14
11
12

result:

ok 100 numbers

Test #45:

score: 2
Accepted
time: 27ms
memory: 1892kb

input:

100
42
25 4 6 8 10 16 39 4 33 14 39 40 24 32 14 13 19 6 21 10 21 16 26 27 33 15 8 17 15 35 24 25 13 31 5 26 27 40 35 19 31 17
42
27 19 34 3 8 35 18 39 30 28 22 39 42 13 9 27 30 26 35 42 6 13 2 3 8 17 18 2 1 24 28 22 4 1 17 4 19 9 34 6 24 26
42
33 19 4 12 36 20 15 27 2 19 1 28 22 34 38 4 37 29 29 12 ...

output:

16
22
23
17
20
16
9
12
24
13
8
12
9
33
18
25
15
19
14
21
29
19
18
14
10
18
15
19
17
21
21
18
19
19
25
16
10
11
18
15
9
8
17
10
11
18
17
14
13
15
17
13
13
19
13
15
14
13
20
9
17
13
19
26
9
14
26
18
15
22
20
22
22
19
15
12
23
16
9
8
13
9
16
5
21
12
12
7
8
17
12
9
16
17
17
12
8
9
18
14

result:

ok 100 numbers

Test #46:

score: 2
Accepted
time: 28ms
memory: 1704kb

input:

100
42
40 1 10 4 28 30 19 10 8 4 19 40 8 29 42 16 6 16 23 22 29 42 37 28 2 15 38 20 15 20 6 21 23 41 1 37 30 21 22 3 41 2
42
1 25 18 6 10 15 27 32 39 18 29 27 3 31 12 10 1 6 28 4 39 8 23 15 29 2 40 4 28 8 25 2 3 16 40 21 32 12 21 31 16 23
42
40 31 16 11 16 22 17 28 23 27 36 18 36 31 29 39 30 11 17 8...

output:

11
20
17
14
15
16
13
12
21
7
17
11
18
9
13
17
17
16
13
12
17
20
13
25
14
16
10
15
6
11
20
22
20
22
15
13
20
15
14
16
12
8
19
18
9
9
18
19
12
8
24
18
8
13
14
9
9
25
18
7
16
16
15
8
18
9
22
10
13
24
19
9
9
19
18
16
17
6
14
26
20
12
16
11
22
10
19
10
10
12
17
21
17
11
24
17
20
14
15
15

result:

ok 100 numbers

Test #47:

score: 2
Accepted
time: 29ms
memory: 1692kb

input:

100
43
27 21 23 16 8 15 41 27 31 41 19 32 15 8 22 1 34 40 10 42 22 25 10 17 1 23 31 40 43 21 38 34 19 25 38 26 7 16 7 17 42 26 43
43
16 29 14 11 30 34 32 25 16 34 22 40 20 25 1 8 3 14 22 11 10 5 43 32 29 18 20 19 8 3 40 39 43 30 23 10 1 39 21 5 18 23 21
43
38 12 23 19 28 19 3 12 27 15 42 5 22 38 30 ...

output:

14
20
21
20
21
16
21
15
16
32
28
10
27
15
15
16
14
24
11
19
17
27
15
11
11
17
11
14
29
12
23
9
21
15
20
14
13
9
13
14
15
11
13
18
14
12
21
13
17
5
17
9
12
11
14
18
15
13
17
8
12
13
8
18
25
16
19
11
14
25
13
6
17
10
26
9
12
17
22
19
18
21
17
14
11
16
9
15
22
12
16
19
12
18
23
9
16
19
12
24

result:

ok 100 numbers

Test #48:

score: 2
Accepted
time: 24ms
memory: 1704kb

input:

100
43
3 16 34 27 35 40 7 31 21 33 1 26 3 35 39 12 27 24 21 7 2 41 4 24 16 33 31 14 19 14 29 41 18 34 28 12 4 18 1 2 29 38 28
43
22 19 9 23 25 43 20 43 4 8 3 24 25 39 32 19 8 14 7 28 7 22 34 13 20 4 2 34 24 10 31 42 31 28 2 14 39 23 32 42 13 9 10
43
40 34 6 5 15 7 2 23 7 6 34 3 27 15 24 40 23 16 39 ...

output:

17
16
18
8
13
17
19
16
25
26
13
25
26
13
17
20
17
24
21
23
20
13
22
22
9
22
17
13
21
18
23
20
19
12
22
9
13
10
15
16
14
7
9
9
2
13
12
18
12
13
10
16
9
11
11
18
14
16
7
6
15
15
26
18
21
25
17
17
15
20
27
8
18
17
13
9
20
14
24
16
20
12
15
15
19
10
6
12
15
22
12
21
11
19
15
9
10
18
13
11

result:

ok 100 numbers

Test #49:

score: 2
Accepted
time: 41ms
memory: 1708kb

input:

100
44
11 1 18 1 25 34 13 18 22 33 27 20 11 6 33 25 4 36 32 13 43 10 14 27 14 8 3 4 32 22 34 20 8 3 6 10 12 39 28 36 28 39 43 12
44
12 27 2 12 22 4 31 23 15 44 37 44 22 40 38 23 9 7 17 18 7 31 8 32 18 28 37 40 43 4 8 21 27 43 36 15 2 17 9 36 32 21 38 28
44
22 37 18 37 8 32 40 17 29 6 21 5 11 13 36 3...

output:

11
16
21
17
22
14
29
23
15
23
19
28
21
15
10
14
8
17
17
12
12
15
17
16
27
15
21
21
23
18
16
15
15
19
12
15
12
14
21
25
12
25
15
15
13
14
12
21
11
21
18
21
22
17
20
19
22
15
18
17
8
19
11
13
12
7
16
27
7
20
9
15
13
13
14
12
24
18
20
22
22
12
22
20
15
16
10
10
11
16
10
14
22
24
16
17
13
15
17
13

result:

ok 100 numbers

Test #50:

score: 2
Accepted
time: 60ms
memory: 1752kb

input:

100
44
8 41 22 1 31 25 26 43 37 26 4 31 3 32 17 25 29 27 42 23 19 8 43 10 16 3 5 1 27 32 22 23 29 37 42 41 10 4 21 16 21 5 19 17
44
24 5 5 33 16 7 41 15 16 26 18 6 31 42 17 33 19 15 38 2 41 18 7 39 39 31 27 6 3 17 3 38 22 20 42 20 22 24 26 23 2 19 27 23
44
24 26 36 33 41 38 26 24 38 5 14 30 36 1 15 ...

output:

32
19
13
22
27
21
29
17
25
23
15
16
28
26
11
26
16
38
20
19
16
29
25
14
26
14
28
12
16
18
7
16
17
26
21
14
13
22
17
19
14
19
21
15
17
17
15
12
7
16
11
15
21
13
14
14
14
14
16
18
15
10
9
14
19
14
27
9
15
11
17
20
23
10
15
14
14
9
26
19
19
11
21
24
20
26
18
23
14
13
16
9
15
12
21
23
15
14
23
13

result:

ok 100 numbers

Extra Test:

score: 0
Extra Test Passed