QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#538005#4565. Rarest InsectsYahia_Emara#52.94 35ms10328kbC++202.8kb2024-08-30 20:48:142024-08-30 20:48:14

Judging History

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

  • [2024-08-30 20:48:14]
  • 评测
  • 测评结果:52.94
  • 用时:35ms
  • 内存:10328kb
  • [2024-08-30 20:48:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define dbg(x) cout << (#x) << " : " << x << endl
#define pb push_back
#define bk(x) x.back()
#define all(x) x.begin(),x.end()
#define LOOP(n) for(int rp=0;rp<n;rp++)
#define sq(x) ((x)*(x))
typedef long long ll;
typedef long double dl;
const int SZ=5e5+7;
const ll INF=1e18+7;
const dl eps=1e-9;
int MOD=1e9+7;
mt19937_64 rng(time(0));
int rnd(int l,int r){
    return uniform_int_distribution<int>(l,r)(rng);
}
ll trig(ll x){
    return x*(x+1)/2;
}
int getN(){
    int n;cin >> n;
    return n;
}
#define cmbntrcs fact[0]=1;for(int i=1;i<SZ;i++)fact[i]=mul(fact[i-1],i);finv[SZ-1]=inv(fact[SZ-1]);for(int i=SZ-2;i>0;i--)finv[i]=mul(finv[i+1],i+1);
int fact[SZ],finv[SZ];
int add(int x,int y,int MOD=MOD){
    x+=y;if(x>=MOD)x-=MOD;
    return x;
}
int sub(int x,int y,int MOD=MOD){
    x-=y;if(x<0)x+=MOD;
    return x;
}
int mul(int x,int y,int MOD=MOD){
    return(x*1ll*y)%MOD;
}
int pwr(int x,ll b,int MOD=MOD){
    int rt=1;
    while(b>0){
        if(b&1)rt=mul(rt,x,MOD);
        x=mul(x,x,MOD),b>>=1;
    }
    return rt;
}
int inv(int x,int MOD=MOD){
    return pwr(x,MOD-2,MOD);
}
#include "insects.h"
//#include "stub.cpp"
int n,p[SZ],a[SZ],k,vs[SZ];
vector<int>v;
void ins(int i){
    i=p[i];
    vs[i]=1;
    move_inside(i);
    v.pb(i);
}
void dlt(){
    vs[bk(v)]=0;
    move_outside(bk(v));
    v.pop_back();
}
void permdlt(){
    vs[bk(v)]=2;
    move_outside(bk(v));
    v.pop_back();
}
int card(){
    return press_button();
}
bool f(int C){
    while(card()>C)dlt();
    for(int i=0;i<n;i++){
        if(vs[p[i]])continue;
        ins(i);
        if(card()>C)dlt();
    }
    if(C*k==sz(v))return 1;
    return 0;
}
int min_cardinality(int N){
    n=N;
    for(int i=0;i<n;i++)p[i]=i,swap(p[i],p[rnd(0,i)]);
    for(int i=0;i<n;i++){
        ins(i);
        if(card()>1)dlt();
    }
    k=sz(v);
    if(k==1)return n;
    /*if(k<=5){
        vector<int>w=v;
        while(sz(v))dlt();
        for(int i=0;i<k;i++)swap(w[i],w[rnd(0,i)]);
        int C=0,ans=1e9;
        for(int i=0;i<k-1;i++){
            ins(w[i]);
            for(int i=0;i<n;i++){
                if(vs[p[i]])continue;
                ins(i);
                if(card()!=sz(v))dlt();
            }
            C+=sz(v),ans=min(ans,sz(v));
            while(sz(v))dlt();
        }
        ans=min(ans,n-C);
        return ans;
    }*/
    int l=2,r=n/k,ans=1;
    while(l<=r){
        int md=(l+r)>>1;
        if(f(md))l=md+1,ans=md;
        else r=md-1;
    }
    return ans;
}
/*int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    //cout << fixed << setprecision(12);
    int tt=1;
    //cin >> tt;
    LOOP(tt){
        //code
    }
    return 0;
}*/

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
2
2
2
1
1
2
3
2

output:

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

result:

ok 

Test #2:

score: 10
Accepted
time: 1ms
memory: 10284kb

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

score: 10
Accepted
time: 1ms
memory: 8224kb

input:

3
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
1
2
2
2
1
2
2
3

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

input:

199
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
2
...

output:

8
0 178
8
2
8
0 106
8
2
8
1 106
8
0 136
8
2
8
1 136
8
0 38
8
2
8
1 38
8
0 151
8
2
8
1 151
8
0 135
8
2
8
1 135
8
0 164
8
2
8
1 164
8
0 69
8
2
8
1 69
8
0 98
8
2
8
1 98
8
0 139
8
2
8
1 139
8
0 194
8
2
8
1 194
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
1 125
8
0 89
8
2
8
1 89
8
...

result:

ok 

Test #8:

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

input:

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

8
0 178
8
2
8
0 106
8
2
8
0 199
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
0 98
8
2
8
0 139
8
2
8
0 194
8
2
8
0 11
8
2
8
0 59
8
2
8
0 68
8
2
8
0 125
8
2
8
0 89
8
2
8
0 92
8
2
8
0 159
8
2
8
0 9
8
2
8
0 39
8
2
8
0 198
8
2
8
0 85
8
2
8
0 73
8
2
8
0 171
8
2
8
0 25
8
2
8
0 138
8
2
8
...

result:

ok 

Test #9:

score: 10
Accepted
time: 4ms
memory: 10272kb

input:

200
1
1
2
1
1
2
1
2
2
1
1
2
2
2
2
1
2
2
2
2
1
2
2
2
1
1
1
2
1
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
0 199
8
2
8
1 199
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
1 135
8
0 164
8
2
8
0 69
8
2
8
1 69
8
0 98
8
2
8
1 98
8
0 139
8
2
8
0 194
8
2
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
1 125
8
0 89
8
2
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1 159
8
0 9
8
2
8
1 9
8
...

result:

ok 

Test #10:

score: 10
Accepted
time: 7ms
memory: 10008kb

input:

198
1
2
1
1
1
2
1
2
2
2
1
1
2
1
2
2
2
1
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
1 106
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
1 135
8
0 164
8
2
8
0 69
8
2
8
1 69
8
0 98
8
2
8
1 98
8
0 139
8
2
8
1 139
8
0 194
8
2
8
0 11
8
2
8
0 59
8
2
8
1 59
8
0 68
8
2
8
0 125
8
2
8
1 125
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
0 9
8
2
8
0 39
8
2
8
1 ...

result:

ok 

Test #11:

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

input:

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

output:

8
0 178
8
2
8
0 106
8
2
8
1 106
8
0 136
8
2
8
1 136
8
0 38
8
2
8
1 38
8
0 151
8
2
8
1 151
8
0 135
8
2
8
1 135
8
0 164
8
2
8
1 164
8
0 69
8
2
8
1 69
8
0 98
8
2
8
1 98
8
0 139
8
2
8
1 139
8
0 194
8
2
8
1 194
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
1 125
8
0 89
8
2
8
1 89
8
...

result:

ok 

Test #12:

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

input:

197
1
1
2
2
2
2
1
2
1
2
1
2
2
2
1
2
2
1
2
1
1
1
2
1
1
2
2
2
2
2
2
2
1
1
1
1
1
2
1
1
2
2
1
1
1
2
2
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
2
1
2
2
2
1
1
2
1
1
1
1
1
1
2
2
2
1
1
2
1
1
1
2
2
1
1
2
1
2
1
2
2
1
2
1
1
2
2
2
1
1
1
1
1
1
1
2
2
2
1
1
2
2
2
1
2
2
2
2
1
2
2
1
1
2
2
2
2
1
1
1
2
2
2
2
1
2
1
1
1
2
1
2
2
2
...

output:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
1 136
8
0 38
8
2
8
1 38
8
0 151
8
2
8
1 151
8
0 135
8
2
8
1 135
8
0 164
8
2
8
0 69
8
2
8
1 69
8
0 98
8
2
8
0 139
8
2
8
1 139
8
0 194
8
2
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
0 9
8
2
8...

result:

ok 

Test #13:

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

input:

197
1
1
2
1
2
1
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
1 136
8
0 38
8
2
8
0 151
8
2
8
1 151
8
0 135
8
2
8
0 164
8
2
8
1 164
8
0 69
8
2
8
1 69
8
0 98
8
2
8
1 98
8
0 139
8
2
8
1 139
8
0 194
8
2
8
1 194
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1...

result:

ok 

Test #14:

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

input:

198
1
2
1
1
1
1
1
1
1
2
1
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
1 106
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
0 98
8
2
8
0 139
8
2
8
1 139
8
0 194
8
2
8
0 11
8
2
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1 159
8
0 9
8
2
8
1 9
8
0 39
8
2
8
1 39
8
0 15...

result:

ok 

Test #15:

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

input:

200
1
1
2
2
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
0 199
8
2
8
1 199
8
0 38
8
2
8
1 38
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
1 164
8
0 69
8
2
8
1 69
8
0 98
8
2
8
0 139
8
2
8
1 139
8
0 194
8
2
8
1 194
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
1 125
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1...

result:

ok 

Test #16:

score: 10
Accepted
time: 3ms
memory: 10036kb

input:

196
1
1
1
1
2
2
2
1
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
1 151
8
0 135
8
2
8
1 135
8
0 164
8
2
8
1 164
8
0 69
8
2
8
0 98
8
2
8
1 98
8
0 139
8
2
8
0 194
8
2
8
1 194
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1 159
8
0 9
8
2
...

result:

ok 

Test #17:

score: 10
Accepted
time: 4ms
memory: 10272kb

input:

199
1
1
1
1
1
1
1
2
2
2
2
1
2
2
1
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
1 69
8
0 98
8
2
8
1 98
8
0 139
8
2
8
1 139
8
0 194
8
2
8
1 194
8
0 11
8
2
8
0 59
8
2
8
1 59
8
0 68
8
2
8
1 68
8
0 125
8
2
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1 159
8
0 9
8
2
8
1 9
8
0 39
8
2...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
2
1
1
2
2
2
1
2
1
1
2
2
2
1
2
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
1 151
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
1 69
8
0 98
8
2
8
1 98
8
0 139
8
2
8
1 139
8
0 194
8
2
8
0 11
8
2
8
1 11
8
0 59
8
2
8
0 68
8
2
8
0 125
8
2
8
1 125
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
0 9
8
2
8
1 9
8
0 39
8
2
8
0 15...

result:

ok 

Test #19:

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

input:

196
1
1
1
2
1
1
1
1
1
2
2
2
1
2
2
1
2
2
2
1
1
2
2
2
2
2
2
2
2
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
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
...

output:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
0 38
8
2
8
1 38
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
0 98
8
2
8
0 139
8
2
8
1 139
8
0 194
8
2
8
1 194
8
0 11
8
2
8
1 11
8
0 59
8
2
8
0 68
8
2
8
1 68
8
0 125
8
2
8
1 125
8
0 89
8
2
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1 159
8
0 9
8
2
8
1 9
8
0 39
8
2
8
0 1...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
1
1
1
2
1
1
2
1
2
2
2
2
2
1
2
2
2
1
1
2
2
2
2
1
1
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
0 98
8
2
8
0 139
8
2
8
1 139
8
0 194
8
2
8
0 11
8
2
8
0 59
8
2
8
1 59
8
0 68
8
2
8
0 125
8
2
8
1 125
8
0 89
8
2
8
1 89
8
0 92
8
2
8
1 92
8
0 159
8
2
8
1 159
8
0 9
8
2
8
1 9
8
0 39
8
2
8
0 150
8
2
8
1 150
...

result:

ok 

Test #21:

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

input:

200
1
2
1
1
1
1
1
2
1
1
1
1
2
1
2
1
2
1
1
1
1
1
2
2
2
1
1
1
1
2
1
2
2
1
2
2
2
2
2
1
2
1
1
1
2
1
1
2
2
1
2
1
2
1
1
1
2
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
1
2
1
2
2
2
2
1
2
1
2
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
...

output:

8
0 178
8
2
8
0 106
8
2
8
1 106
8
0 199
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
1 69
8
0 98
8
2
8
0 139
8
2
8
0 194
8
2
8
0 11
8
2
8
0 59
8
2
8
1 59
8
0 68
8
2
8
0 125
8
2
8
1 125
8
0 89
8
2
8
0 92
8
2
8
1 92
8
0 159
8
2
8
0 9
8
2
8
0 39
8
2
8
0 198
8
2
8
0 85
8
2
8
0 73
8
2
...

result:

ok 

Test #22:

score: 10
Accepted
time: 3ms
memory: 8224kb

input:

199
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
1
2
2
1
2
2
2
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
2
2
1
1
1
2
1
1
1
1
2
2
1
2
1
1
2
2
2
1
2
2
1
1
2
1
2
2
1
2
1
2
2
1
1
1
2
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
1
2
1
2
2
2
2
2
1
1
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
1
2
...

output:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
0 98
8
2
8
0 139
8
2
8
0 194
8
2
8
0 11
8
2
8
1 11
8
0 59
8
2
8
1 59
8
0 68
8
2
8
0 125
8
2
8
1 125
8
0 89
8
2
8
0 92
8
2
8
0 159
8
2
8
0 9
8
2
8
0 39
8
2
8
0 198
8
2
8
0 85
8
2
8
0 73
8
2
8
1 73
8
0 171
...

result:

ok 

Test #23:

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

input:

198
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
2
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
2
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
2
2
1
1
1
2
2
2
2
1
1
1
1
2
1
1
1
2
2
1
2
1
1
1
1
1
2
1
1
1
2
1
2
2
1
1
2
2
2
1
1
2
1
2
2
2
2
2
1
2
...

output:

8
0 178
8
2
8
0 106
8
2
8
0 136
8
2
8
0 38
8
2
8
0 151
8
2
8
0 135
8
2
8
0 164
8
2
8
0 69
8
2
8
0 98
8
2
8
0 139
8
2
8
0 194
8
2
8
1 194
8
0 11
8
2
8
0 59
8
2
8
0 68
8
2
8
0 125
8
2
8
0 89
8
2
8
0 92
8
2
8
0 159
8
2
8
0 9
8
2
8
0 39
8
2
8
0 150
8
2
8
0 85
8
2
8
0 73
8
2
8
0 171
8
2
8
0 25
8
2
8
0 13...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 5ms
memory: 10072kb

input:

1000
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
2...

output:

8
0 381
8
2
8
0 570
8
2
8
1 570
8
0 72
8
2
8
1 72
8
0 677
8
2
8
1 677
8
0 219
8
2
8
1 219
8
0 471
8
2
8
1 471
8
0 437
8
2
8
1 437
8
0 925
8
2
8
1 925
8
0 890
8
2
8
1 890
8
0 859
8
2
8
1 859
8
0 972
8
2
8
1 972
8
0 255
8
2
8
1 255
8
0 528
8
2
8
1 528
8
0 778
8
2
8
1 778
8
0 74
8
2
8
1 74
8
0 131
8
2
...

result:

ok 

Test #25:

score: 15
Accepted
time: 0ms
memory: 9996kb

input:

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

8
0 381
8
2
8
0 570
8
2
8
0 72
8
2
8
0 677
8
2
8
0 219
8
2
8
0 471
8
2
8
0 437
8
2
8
0 925
8
2
8
0 890
8
2
8
0 859
8
2
8
0 972
8
2
8
0 255
8
2
8
0 528
8
2
8
0 778
8
2
8
0 74
8
2
8
0 131
8
2
8
0 228
8
2
8
0 828
8
2
8
0 856
8
2
8
0 280
8
2
8
0 213
8
2
8
0 156
8
2
8
0 267
8
2
8
0 495
8
2
8
0 621
8
2
8
...

result:

ok 

Test #26:

score: 15
Accepted
time: 3ms
memory: 10000kb

input:

999
1
1
1
1
1
1
1
2
1
1
2
2
1
1
2
2
1
2
2
1
1
1
1
1
2
1
1
2
2
2
2
1
1
2
1
1
2
2
2
2
2
2
1
2
2
1
1
2
1
2
2
1
2
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
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
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
...

output:

8
0 381
8
2
8
0 570
8
2
8
0 72
8
2
8
0 677
8
2
8
0 219
8
2
8
0 471
8
2
8
0 437
8
2
8
0 925
8
2
8
1 925
8
0 890
8
2
8
0 859
8
2
8
0 972
8
2
8
1 972
8
0 255
8
2
8
1 255
8
0 528
8
2
8
0 778
8
2
8
0 74
8
2
8
1 74
8
0 131
8
2
8
1 131
8
0 228
8
2
8
0 828
8
2
8
1 828
8
0 856
8
2
8
1 856
8
0 280
8
2
8
0 213...

result:

ok 

Test #27:

score: 15
Accepted
time: 14ms
memory: 10020kb

input:

999
1
1
1
1
1
1
2
1
1
1
1
1
2
2
1
2
1
1
2
2
1
1
2
1
2
1
2
2
1
1
2
1
1
2
1
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
1
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 381
8
2
8
0 570
8
2
8
0 72
8
2
8
0 677
8
2
8
0 219
8
2
8
0 471
8
2
8
0 437
8
2
8
1 437
8
0 925
8
2
8
0 890
8
2
8
0 859
8
2
8
0 972
8
2
8
0 255
8
2
8
0 528
8
2
8
1 528
8
0 778
8
2
8
1 778
8
0 74
8
2
8
0 131
8
2
8
1 131
8
0 228
8
2
8
0 828
8
2
8
0 856
8
2
8
1 856
8
0 280
8
2
8
1 280
8
0 213
8
2
8
...

result:

ok 

Test #28:

score: 15
Accepted
time: 6ms
memory: 9992kb

input:

996
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
2
...

output:

8
0 381
8
2
8
0 570
8
2
8
1 570
8
0 72
8
2
8
1 72
8
0 677
8
2
8
1 677
8
0 219
8
2
8
1 219
8
0 471
8
2
8
1 471
8
0 437
8
2
8
1 437
8
0 925
8
2
8
1 925
8
0 890
8
2
8
1 890
8
0 859
8
2
8
1 859
8
0 972
8
2
8
1 972
8
0 255
8
2
8
1 255
8
0 528
8
2
8
1 528
8
0 778
8
2
8
1 778
8
0 74
8
2
8
1 74
8
0 131
8
2
...

result:

ok 

Test #29:

score: 15
Accepted
time: 2ms
memory: 9992kb

input:

995
1
2
1
1
2
1
1
1
2
2
1
2
2
2
2
2
2
1
1
1
1
2
2
2
1
2
2
2
1
2
1
1
2
2
2
1
2
1
2
2
2
1
2
2
1
1
1
2
1
1
1
1
1
2
2
1
1
2
2
1
2
2
2
1
2
1
2
2
2
1
1
2
2
2
2
1
1
1
1
2
1
2
2
2
1
1
1
2
2
2
2
1
1
1
2
2
2
1
2
1
2
1
2
1
1
1
2
2
1
2
1
1
2
1
2
1
2
1
2
1
1
1
1
1
2
2
2
2
1
1
2
2
1
2
2
1
1
2
1
2
2
1
2
1
1
2
1
2
...

output:

8
0 381
8
2
8
0 570
8
2
8
1 570
8
0 72
8
2
8
0 677
8
2
8
0 219
8
2
8
1 219
8
0 471
8
2
8
0 437
8
2
8
0 925
8
2
8
0 890
8
2
8
1 890
8
0 859
8
2
8
1 859
8
0 972
8
2
8
0 255
8
2
8
1 255
8
0 528
8
2
8
1 528
8
0 778
8
2
8
1 778
8
0 74
8
2
8
1 74
8
0 131
8
2
8
1 131
8
0 228
8
2
8
1 228
8
0 828
8
2
8
0 856...

result:

ok 

Test #30:

score: 15
Accepted
time: 8ms
memory: 7964kb

input:

998
1
2
1
2
2
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
...

output:

8
0 381
8
2
8
0 570
8
2
8
1 570
8
0 72
8
2
8
0 677
8
2
8
1 677
8
0 219
8
2
8
1 219
8
0 471
8
2
8
0 437
8
2
8
1 437
8
0 925
8
2
8
1 925
8
0 890
8
2
8
1 890
8
0 859
8
2
8
0 972
8
2
8
1 972
8
0 255
8
2
8
1 255
8
0 528
8
2
8
1 528
8
0 778
8
2
8
1 778
8
0 74
8
2
8
1 74
8
0 131
8
2
8
1 131
8
0 228
8
2
8
1...

result:

ok 

Test #31:

score: 15
Accepted
time: 7ms
memory: 10244kb

input:

998
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
1
1
1
2
1
2
2
2
2
1
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
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
...

output:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
0 633
8
2
8
0 763
8
2
8
0 386
8
2
8
1 386
8
0 706
8
2
8
0 219
8
2
8
0 113
8
2
8
1 113
8
0 274
8
2
8
0 241
8
2
8
0 993
8
2
8
0 315
8
2
8
0 198
8
2
8
0 539
8
2
8
0 983
8
2
8
0 524
8
2
8
0 512
8
2
8
0 881
8
2
8
1 881
8
0 283
8
2
8
1 283
8
0 437
8
2
8
1 437
8
0 754
...

result:

ok 

Test #32:

score: 15
Accepted
time: 10ms
memory: 10080kb

input:

1000
1
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
0 633
8
2
8
1 633
8
0 763
8
2
8
1 763
8
0 386
8
2
8
0 706
8
2
8
1 706
8
0 219
8
2
8
1 219
8
0 113
8
2
8
1 113
8
0 274
8
2
8
1 274
8
0 241
8
2
8
1 241
8
0 993
8
2
8
1 993
8
0 315
8
2
8
1 315
8
0 198
8
2
8
1 198
8
0 539
8
2
8
1 539
8
0 983
8
2
8
1 983
8
0 524
8
2
...

result:

ok 

Test #33:

score: 15
Accepted
time: 20ms
memory: 10092kb

input:

996
1
1
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
1 522
8
0 633
8
2
8
1 633
8
0 763
8
2
8
0 386
8
2
8
1 386
8
0 706
8
2
8
0 219
8
2
8
0 113
8
2
8
1 113
8
0 274
8
2
8
1 274
8
0 241
8
2
8
1 241
8
0 993
8
2
8
1 993
8
0 315
8
2
8
1 315
8
0 198
8
2
8
1 198
8
0 539
8
2
8
1 539
8
0 983
8
2
8
1 983
8
0 524
8
2
8
1 524
...

result:

ok 

Test #34:

score: 15
Accepted
time: 6ms
memory: 10292kb

input:

1000
1
1
1
1
1
1
1
2
1
2
2
1
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
0 633
8
2
8
0 763
8
2
8
0 386
8
2
8
0 706
8
2
8
0 219
8
2
8
1 219
8
0 113
8
2
8
0 274
8
2
8
1 274
8
0 241
8
2
8
1 241
8
0 993
8
2
8
0 315
8
2
8
1 315
8
0 198
8
2
8
1 198
8
0 539
8
2
8
1 539
8
0 983
8
2
8
1 983
8
0 524
8
2
8
1 524
8
0 512
8
2
8
1 512
8
0 881
8
2
...

result:

ok 

Test #35:

score: 15
Accepted
time: 5ms
memory: 10000kb

input:

1000
1
1
1
2
1
2
1
1
2
1
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
0 633
8
2
8
1 633
8
0 763
8
2
8
0 386
8
2
8
1 386
8
0 706
8
2
8
0 219
8
2
8
0 113
8
2
8
1 113
8
0 274
8
2
8
0 241
8
2
8
0 993
8
2
8
1 993
8
0 315
8
2
8
0 198
8
2
8
1 198
8
0 539
8
2
8
1 539
8
0 983
8
2
8
1 983
8
0 524
8
2
8
1 524
8
0 512
8
2
8
1 512
8
0 881
8
2
...

result:

ok 

Test #36:

score: 15
Accepted
time: 0ms
memory: 10080kb

input:

997
1
1
1
1
1
2
2
2
1
2
1
2
2
2
1
2
1
1
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
0 633
8
2
8
0 763
8
2
8
0 386
8
2
8
1 386
8
0 706
8
2
8
1 706
8
0 219
8
2
8
1 219
8
0 113
8
2
8
0 274
8
2
8
1 274
8
0 241
8
2
8
0 993
8
2
8
1 993
8
0 315
8
2
8
1 315
8
0 198
8
2
8
1 198
8
0 539
8
2
8
0 983
8
2
8
1 983
8
0 524
8
2
8
0 512
8
2
8
0 881
8
2
8
1 881
...

result:

ok 

Test #37:

score: 15
Accepted
time: 6ms
memory: 9996kb

input:

995
1
1
1
1
1
1
2
2
1
2
1
1
1
1
2
1
1
1
1
2
1
2
2
2
2
1
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
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
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
...

output:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
0 633
8
2
8
0 763
8
2
8
0 386
8
2
8
0 706
8
2
8
1 706
8
0 219
8
2
8
1 219
8
0 113
8
2
8
0 274
8
2
8
1 274
8
0 241
8
2
8
0 993
8
2
8
0 315
8
2
8
0 198
8
2
8
0 539
8
2
8
1 539
8
0 983
8
2
8
0 524
8
2
8
0 512
8
2
8
0 881
8
2
8
0 283
8
2
8
1 283
8
0 437
8
2
8
0 754
...

result:

ok 

Test #38:

score: 15
Accepted
time: 15ms
memory: 10080kb

input:

997
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
2
1
2
2
1
1
1
1
1
1
2
2
1
2
2
1
1
2
1
1
2
2
1
1
1
2
2
2
1
1
1
2
2
2
2
2
1
1
2
2
1
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 608
8
2
8
0 804
8
2
8
0 522
8
2
8
1 522
8
0 633
8
2
8
0 763
8
2
8
0 386
8
2
8
0 706
8
2
8
0 219
8
2
8
0 113
8
2
8
1 113
8
0 274
8
2
8
0 241
8
2
8
0 993
8
2
8
0 315
8
2
8
0 198
8
2
8
0 539
8
2
8
0 983
8
2
8
1 983
8
0 524
8
2
8
0 512
8
2
8
1 512
8
0 881
8
2
8
1 881
8
0 283
8
2
8
0 437
8
2
8
0 754
...

result:

ok 

Test #39:

score: 15
Accepted
time: 13ms
memory: 7904kb

input:

997
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
2
1
2
1
1
1
1
2
1
1
2
2
2
1
1
1
2
1
2
2
2
1
1
1
2
2
1
1
1
1
2
1
2
2
1
2
1
2
1
2
1
1
2
1
1
2
1
1
2
2
2
2
2
1
2
2
2
1
2
1
1
1
2
1
2
2
2
1
1
2
1
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
1
2
2
2
2
2
2
1
1
1
2
2
2
2
2
2
1
...

output:

8
0 374
8
2
8
0 149
8
2
8
0 36
8
2
8
0 167
8
2
8
0 915
8
2
8
0 932
8
2
8
0 511
8
2
8
0 695
8
2
8
0 653
8
2
8
0 298
8
2
8
0 209
8
2
8
0 309
8
2
8
1 309
8
0 863
8
2
8
0 125
8
2
8
0 353
8
2
8
0 735
8
2
8
0 23
8
2
8
0 208
8
2
8
0 854
8
2
8
0 785
8
2
8
0 0
8
2
8
1 0
8
0 299
8
2
8
0 978
8
2
8
0 360
8
2
8
...

result:

ok 

Test #40:

score: 15
Accepted
time: 8ms
memory: 10280kb

input:

996
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
2
2
1
2
2
2
2
2
2
2
1
1
2
1
1
1
1
2
2
1
1
2
1
1
2
1
1
1
1
2
1
2
2
2
1
2
2
2
1
1
1
1
1
1
2
2
1
2
2
2
2
...

output:

8
0 374
8
2
8
0 149
8
2
8
0 36
8
2
8
0 167
8
2
8
0 915
8
2
8
0 932
8
2
8
0 511
8
2
8
0 695
8
2
8
0 653
8
2
8
0 298
8
2
8
0 209
8
2
8
0 309
8
2
8
0 863
8
2
8
0 125
8
2
8
0 353
8
2
8
0 735
8
2
8
0 23
8
2
8
0 208
8
2
8
0 854
8
2
8
0 785
8
2
8
0 0
8
2
8
0 299
8
2
8
0 978
8
2
8
0 360
8
2
8
0 726
8
2
8
0 ...

result:

ok 

Test #41:

score: 15
Accepted
time: 7ms
memory: 10020kb

input:

995
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
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
2
1
2
1
1
1
1
1
1
1
2
2
1
2
2
2
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
...

output:

8
0 374
8
2
8
0 149
8
2
8
0 36
8
2
8
0 167
8
2
8
0 915
8
2
8
0 932
8
2
8
0 511
8
2
8
0 695
8
2
8
0 653
8
2
8
0 298
8
2
8
0 209
8
2
8
0 309
8
2
8
0 863
8
2
8
0 125
8
2
8
0 353
8
2
8
0 735
8
2
8
0 23
8
2
8
0 208
8
2
8
0 854
8
2
8
0 785
8
2
8
0 0
8
2
8
0 299
8
2
8
0 978
8
2
8
0 360
8
2
8
0 726
8
2
8
0 ...

result:

ok 

Test #42:

score: 15
Accepted
time: 0ms
memory: 10284kb

input:

995
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
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
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
2
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
...

output:

8
0 374
8
2
8
0 149
8
2
8
0 36
8
2
8
0 167
8
2
8
0 915
8
2
8
0 932
8
2
8
0 511
8
2
8
0 695
8
2
8
0 653
8
2
8
0 298
8
2
8
0 209
8
2
8
0 309
8
2
8
0 863
8
2
8
0 125
8
2
8
0 353
8
2
8
0 735
8
2
8
0 23
8
2
8
0 208
8
2
8
0 854
8
2
8
0 785
8
2
8
0 0
8
2
8
0 299
8
2
8
1 299
8
0 978
8
2
8
0 360
8
2
8
0 726
...

result:

ok 

Subtask #3:

score: 27.94
Acceptable Answer

Test #43:

score: 75
Accepted
time: 0ms
memory: 10012kb

input:

2
1
2

output:

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

result:

ok 

Test #44:

score: 75
Accepted
time: 0ms
memory: 10272kb

input:

2
1
1

output:

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

result:

ok 

Test #45:

score: 75
Accepted
time: 2ms
memory: 9984kb

input:

3
1
1
2

output:

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

result:

ok 

Test #46:

score: 75
Accepted
time: 0ms
memory: 9980kb

input:

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

output:

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

result:

ok 

Test #47:

score: 75
Accepted
time: 2ms
memory: 9944kb

input:

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

output:

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

result:

ok 

Test #48:

score: 75
Accepted
time: 0ms
memory: 7972kb

input:

2000
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
2...

output:

8
0 374
8
2
8
0 149
8
2
8
1 149
8
0 1565
8
2
8
1 1565
8
0 167
8
2
8
1 167
8
0 915
8
2
8
1 915
8
0 1905
8
2
8
1 1905
8
0 511
8
2
8
1 511
8
0 695
8
2
8
1 695
8
0 653
8
2
8
1 653
8
0 1241
8
2
8
1 1241
8
0 1510
8
2
8
1 1510
8
0 309
8
2
8
1 309
8
0 1311
8
2
8
1 1311
8
0 1859
8
2
8
1 1859
8
0 1842
8
2
8
1...

result:

ok 

Test #49:

score: 75
Accepted
time: 3ms
memory: 10012kb

input:

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

8
0 374
8
2
8
0 149
8
2
8
0 1565
8
2
8
0 167
8
2
8
0 915
8
2
8
0 1905
8
2
8
0 511
8
2
8
0 695
8
2
8
0 653
8
2
8
0 1241
8
2
8
0 1510
8
2
8
0 309
8
2
8
0 1311
8
2
8
0 1859
8
2
8
0 1842
8
2
8
0 1530
8
2
8
0 1323
8
2
8
0 1099
8
2
8
0 854
8
2
8
0 1931
8
2
8
0 1524
8
2
8
0 1034
8
2
8
0 1227
8
2
8
0 360
8
...

result:

ok 

Test #50:

score: 75
Accepted
time: 7ms
memory: 8260kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
2
1
1
1
2
1
1
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
1
1
2
2
2
1
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
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...

output:

8
0 374
8
2
8
0 149
8
2
8
0 1565
8
2
8
0 167
8
2
8
0 915
8
2
8
0 1905
8
2
8
0 511
8
2
8
0 695
8
2
8
0 653
8
2
8
0 1241
8
2
8
0 1510
8
2
8
0 309
8
2
8
0 1311
8
2
8
0 1859
8
2
8
0 1842
8
2
8
1 1842
8
0 1530
8
2
8
0 1323
8
2
8
0 1099
8
2
8
0 854
8
2
8
0 1931
8
2
8
0 1524
8
2
8
1 1524
8
0 1034
8
2
8
0 1...

result:

ok 

Test #51:

score: 68.7
Acceptable Answer
time: 22ms
memory: 10296kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
2
1
1
1
2
1
2
2
1
1
2
2
2
1
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
1
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 374
8
2
8
0 149
8
2
8
0 1565
8
2
8
0 167
8
2
8
0 915
8
2
8
0 1905
8
2
8
0 511
8
2
8
0 695
8
2
8
0 653
8
2
8
0 1241
8
2
8
0 1510
8
2
8
0 309
8
2
8
0 1311
8
2
8
0 1859
8
2
8
0 1842
8
2
8
0 1530
8
2
8
0 1323
8
2
8
1 1323
8
0 1099
8
2
8
0 854
8
2
8
0 1931
8
2
8
0 1524
8
2
8
0 1034
8
2
8
1 1034
8
0 1...

result:

points 0.9160 points  0.9160

Test #52:

score: 28.13
Acceptable Answer
time: 24ms
memory: 8032kb

input:

2000
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
2...

output:

8
0 1853
8
2
8
0 1988
8
2
8
1 1988
8
0 1940
8
2
8
1 1940
8
0 1788
8
2
8
1 1788
8
0 968
8
2
8
1 968
8
0 645
8
2
8
1 645
8
0 1223
8
2
8
1 1223
8
0 236
8
2
8
1 236
8
0 1467
8
2
8
1 1467
8
0 1270
8
2
8
1 1270
8
0 473
8
2
8
1 473
8
0 266
8
2
8
1 266
8
0 783
8
2
8
1 783
8
0 1440
8
2
8
1 1440
8
0 19
8
2
8
...

result:

points 0.37506666670 points  0.37506666670

Test #53:

score: 75
Accepted
time: 3ms
memory: 10032kb

input:

2000
1
1
1
2
2
2
1
1
2
2
2
1
1
1
2
1
2
2
1
2
2
2
2
2
1
2
2
2
1
2
1
2
1
1
2
2
2
2
1
2
2
2
1
1
2
1
2
1
2
1
1
2
2
2
1
2
1
1
1
2
1
2
2
1
2
2
2
1
2
2
2
1
2
1
2
1
2
1
2
2
1
1
1
2
1
2
1
2
1
1
1
1
1
2
1
2
1
1
2
2
2
2
2
2
2
1
1
1
2
1
2
2
1
2
1
1
1
2
1
2
2
2
1
2
1
2
1
2
1
1
2
2
1
2
1
2
2
2
2
2
2
1
2
1
1
1
2
1...

output:

8
0 1853
8
2
8
0 1988
8
2
8
0 1940
8
2
8
0 1788
8
2
8
1 1788
8
0 968
8
2
8
1 968
8
0 645
8
2
8
1 645
8
0 1223
8
2
8
0 236
8
2
8
0 1467
8
2
8
1 1467
8
0 1270
8
2
8
1 1270
8
0 473
8
2
8
1 473
8
0 266
8
2
8
0 783
8
2
8
0 1440
8
2
8
0 19
8
2
8
1 19
8
0 444
8
2
8
0 163
8
2
8
1 163
8
0 1872
8
2
8
1 1872
8...

result:

ok 

Test #54:

score: 27.94
Acceptable Answer
time: 35ms
memory: 10008kb

input:

2000
1
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 1853
8
2
8
0 1988
8
2
8
0 1940
8
2
8
0 1788
8
2
8
1 1788
8
0 968
8
2
8
1 968
8
0 645
8
2
8
0 1223
8
2
8
1 1223
8
0 236
8
2
8
1 236
8
0 1467
8
2
8
1 1467
8
0 1270
8
2
8
1 1270
8
0 473
8
2
8
1 473
8
0 266
8
2
8
1 266
8
0 783
8
2
8
1 783
8
0 1440
8
2
8
1 1440
8
0 19
8
2
8
1 19
8
0 444
8
2
8
1 444
8...

result:

points 0.37253333330 points  0.37253333330

Test #55:

score: 51.56
Acceptable Answer
time: 16ms
memory: 10288kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
2
2
1
1
1
1
1
2
2
2
2
1
2
1
2
2
1
2
2
1
2
2
2
1
1
1
2
1
2
2
1
2
2
2
2
1
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 525
8
2
8
0 1788
8
2
8
0 1242
8
2
8
0 1936
8
2
8
0 1692
8
2
8
0 1678
8
2
8
0 1369
8
2
8
0 550
8
2
8
0 484
8
2
8
0 1985
8
2
8
0 170
8
2
8
0 900
8
2
8
0 1109
8
2
8
0 706
8
2
8
0 1564
8
2
8
1 1564
8
0 1172
8
2
8
0 973
8
2
8
1 973
8
0 475
8
2
8
1 475
8
0 1914
8
2
8
1 1914
8
0 1400
8
2
8
0 805
8
2
8
...

result:

points 0.68746666670 points  0.68746666670

Test #56:

score: 74.42
Acceptable Answer
time: 10ms
memory: 10012kb

input:

1998
1
1
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 925
8
2
8
0 704
8
2
8
0 322
8
2
8
1 322
8
0 897
8
2
8
0 1462
8
2
8
0 1037
8
2
8
1 1037
8
0 619
8
2
8
0 569
8
2
8
1 569
8
0 677
8
2
8
1 677
8
0 46
8
2
8
1 46
8
0 1846
8
2
8
1 1846
8
0 1978
8
2
8
1 1978
8
0 1448
8
2
8
1 1448
8
0 100
8
2
8
1 100
8
0 642
8
2
8
1 642
8
0 1285
8
2
8
1 1285
8
0 680
8
2...

result:

points 0.99226666670 points  0.99226666670

Test #57:

score: 74.33
Acceptable Answer
time: 0ms
memory: 10004kb

input:

1999
1
1
1
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 925
8
2
8
0 704
8
2
8
0 322
8
2
8
0 897
8
2
8
1 897
8
0 1462
8
2
8
0 1037
8
2
8
0 619
8
2
8
0 569
8
2
8
1 569
8
0 677
8
2
8
1 677
8
0 46
8
2
8
1 46
8
0 1846
8
2
8
1 1846
8
0 1978
8
2
8
1 1978
8
0 1448
8
2
8
1 1448
8
0 100
8
2
8
1 100
8
0 642
8
2
8
1 642
8
0 1285
8
2
8
1 1285
8
0 680
8
2
8
1 680
...

result:

points 0.99106666670 points  0.99106666670

Test #58:

score: 73.26
Acceptable Answer
time: 0ms
memory: 10036kb

input:

1997
1
1
1
1
2
1
1
1
1
2
2
2
2
2
2
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
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...

output:

8
0 925
8
2
8
0 704
8
2
8
0 322
8
2
8
0 897
8
2
8
0 1462
8
2
8
1 1462
8
0 1037
8
2
8
0 619
8
2
8
0 569
8
2
8
0 677
8
2
8
0 46
8
2
8
1 46
8
0 1846
8
2
8
1 1846
8
0 1978
8
2
8
1 1978
8
0 1448
8
2
8
1 1448
8
0 100
8
2
8
1 100
8
0 642
8
2
8
1 642
8
0 1285
8
2
8
1 1285
8
0 680
8
2
8
0 1880
8
2
8
1 1880
8...

result:

points 0.97680 points  0.97680

Test #59:

score: 72.33
Acceptable Answer
time: 20ms
memory: 10032kb

input:

1998
1
1
2
1
1
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 925
8
2
8
0 704
8
2
8
0 322
8
2
8
1 322
8
0 897
8
2
8
0 1462
8
2
8
0 1037
8
2
8
0 619
8
2
8
1 619
8
0 569
8
2
8
0 677
8
2
8
0 46
8
2
8
1 46
8
0 1846
8
2
8
1 1846
8
0 1978
8
2
8
1 1978
8
0 1448
8
2
8
1 1448
8
0 100
8
2
8
1 100
8
0 642
8
2
8
0 1285
8
2
8
1 1285
8
0 680
8
2
8
1 680
8
0 1880
8
2
8
1...

result:

points 0.96440 points  0.96440

Test #60:

score: 71.7
Acceptable Answer
time: 20ms
memory: 10108kb

input:

1996
1
1
1
1
2
2
1
1
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1281
8
2
8
0 1658
8
2
8
0 1955
8
2
8
0 1942
8
2
8
0 134
8
2
8
1 134
8
0 594
8
2
8
1 594
8
0 1728
8
2
8
0 1829
8
2
8
0 1161
8
2
8
1 1161
8
0 1710
8
2
8
1 1710
8
0 1592
8
2
8
0 575
8
2
8
1 575
8
0 1492
8
2
8
1 1492
8
0 1309
8
2
8
0 1072
8
2
8
1 1072
8
0 1081
8
2
8
1 1081
8
0 1939
8
2
8
0 791
8
2
8...

result:

points 0.9560 points  0.9560

Test #61:

score: 72.2
Acceptable Answer
time: 6ms
memory: 9964kb

input:

2000
1
1
1
1
1
2
1
1
1
2
1
1
1
2
2
2
1
2
1
2
2
1
2
1
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 1281
8
2
8
0 1658
8
2
8
0 1955
8
2
8
0 1942
8
2
8
0 134
8
2
8
0 594
8
2
8
1 594
8
0 1728
8
2
8
0 1829
8
2
8
0 1161
8
2
8
0 1710
8
2
8
1 1710
8
0 1592
8
2
8
0 575
8
2
8
0 1492
8
2
8
0 1309
8
2
8
1 1309
8
0 1072
8
2
8
1 1072
8
0 1081
8
2
8
1 1081
8
0 1939
8
2
8
0 791
8
2
8
1 791
8
0 615
8
2
8
0 18...

result:

points 0.96266666670 points  0.96266666670

Test #62:

score: 68.77
Acceptable Answer
time: 10ms
memory: 10040kb

input:

1998
1
1
1
1
2
1
2
1
1
2
1
1
1
2
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
2
2
2
2
1
1
2
1
2
2
1
1
1
2
2
2
2
2
1
1
2
2
2
1
1
1
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
1
2
2
2...

output:

8
0 1281
8
2
8
0 1658
8
2
8
0 1955
8
2
8
0 1942
8
2
8
0 134
8
2
8
1 134
8
0 594
8
2
8
0 1728
8
2
8
1 1728
8
0 1829
8
2
8
0 1161
8
2
8
0 1710
8
2
8
1 1710
8
0 1592
8
2
8
0 575
8
2
8
0 1492
8
2
8
0 1309
8
2
8
1 1309
8
0 1072
8
2
8
0 1081
8
2
8
1 1081
8
0 1939
8
2
8
1 1939
8
0 791
8
2
8
0 615
8
2
8
0 1...

result:

points 0.91693333330 points  0.91693333330

Test #63:

score: 63.9
Acceptable Answer
time: 5ms
memory: 10296kb

input:

2000
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
2
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
2
2
1
2
1
1
1
2
1
2
1
1
1
1
2
1
1
1
1
2
2
1
1
1
2
2
2
2
2
2
1
1
1
1
2
1
2
2
2
1
2
1
1
1
2
2
1
1
1
2
2
1
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
1
1
2
1
1
2
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
1
1
1
2
1
2
2
1...

output:

8
0 1281
8
2
8
0 1658
8
2
8
0 1955
8
2
8
0 1942
8
2
8
0 134
8
2
8
0 594
8
2
8
0 1728
8
2
8
1 1728
8
0 1829
8
2
8
0 1161
8
2
8
0 1710
8
2
8
0 1592
8
2
8
0 575
8
2
8
0 1492
8
2
8
0 1309
8
2
8
1 1309
8
0 1072
8
2
8
0 1081
8
2
8
0 1939
8
2
8
1 1939
8
0 791
8
2
8
0 615
8
2
8
0 1810
8
2
8
0 1343
8
2
8
1 1...

result:

points 0.8520 points  0.8520

Test #64:

score: 68.96
Acceptable Answer
time: 7ms
memory: 10256kb

input:

1995
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
2
1
1
2
1
1
1
2
1
1
1
1
1
1
1
2
1
2
1
2
1
1
1
1
2
1
2
2
1
1
2
2
1
1
2
2
2
1
2
2
2
2
1
2
1
1
1
1
1
1
1
1
1
1
2
2
1
1
2
1
2
1
2
1
2
2
1
1
2
1
1
1
2
1
1
2
1
1
1
2
2
1
2
1
2
1
2
1
1
2
1
1
2
1
1
2
1...

output:

8
0 454
8
2
8
0 1098
8
2
8
0 929
8
2
8
0 1635
8
2
8
0 1451
8
2
8
0 1854
8
2
8
0 753
8
2
8
0 833
8
2
8
0 1550
8
2
8
0 1114
8
2
8
0 1543
8
2
8
0 84
8
2
8
0 1773
8
2
8
0 642
8
2
8
0 207
8
2
8
1 207
8
0 1972
8
2
8
0 583
8
2
8
0 1271
8
2
8
0 1080
8
2
8
0 317
8
2
8
0 81
8
2
8
0 1139
8
2
8
0 622
8
2
8
1 62...

result:

points 0.91946666670 points  0.91946666670

Test #65:

score: 75
Accepted
time: 14ms
memory: 7960kb

input:

1999
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
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
2
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
2
2
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
1
1
2
1
2
1
1
1
2
2
1
2
1...

output:

8
0 454
8
2
8
0 1098
8
2
8
0 929
8
2
8
0 1635
8
2
8
0 1451
8
2
8
0 1854
8
2
8
0 753
8
2
8
0 833
8
2
8
0 1550
8
2
8
0 1114
8
2
8
0 1543
8
2
8
0 84
8
2
8
0 1773
8
2
8
0 642
8
2
8
0 207
8
2
8
1 207
8
0 1972
8
2
8
0 583
8
2
8
0 1271
8
2
8
0 1080
8
2
8
0 317
8
2
8
0 81
8
2
8
0 1139
8
2
8
0 622
8
2
8
0 11...

result:

ok 

Test #66:

score: 75
Accepted
time: 10ms
memory: 10032kb

input:

1998
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
2
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
1
1
1
1
2
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
2
1
1
1
1
1
2
1
2
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...

output:

8
0 454
8
2
8
0 1098
8
2
8
0 929
8
2
8
0 1635
8
2
8
0 1451
8
2
8
0 1854
8
2
8
0 753
8
2
8
0 833
8
2
8
0 1550
8
2
8
0 1114
8
2
8
0 1543
8
2
8
0 84
8
2
8
0 1773
8
2
8
0 642
8
2
8
0 207
8
2
8
0 1972
8
2
8
0 583
8
2
8
0 1271
8
2
8
0 1080
8
2
8
0 317
8
2
8
0 81
8
2
8
0 1139
8
2
8
0 622
8
2
8
1 622
8
0 11...

result:

ok 

Test #67:

score: 75
Accepted
time: 0ms
memory: 10300kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
1
1
2
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
2
1
1
1
1
2
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
2
1...

output:

8
0 454
8
2
8
0 1098
8
2
8
0 929
8
2
8
0 1635
8
2
8
0 1451
8
2
8
0 1854
8
2
8
0 753
8
2
8
0 833
8
2
8
0 1550
8
2
8
0 1114
8
2
8
0 1543
8
2
8
0 84
8
2
8
0 1773
8
2
8
0 642
8
2
8
0 207
8
2
8
0 1972
8
2
8
0 583
8
2
8
0 1271
8
2
8
0 1080
8
2
8
0 317
8
2
8
0 81
8
2
8
0 1139
8
2
8
0 622
8
2
8
0 1198
8
2
8...

result:

ok 

Test #68:

score: 75
Accepted
time: 6ms
memory: 10264kb

input:

1979
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
1
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
2
1
1
2
1
2
1
1
2
2
2
1
2
2
2
1
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
2
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
1
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 454
8
2
8
0 1098
8
2
8
0 929
8
2
8
0 1635
8
2
8
0 1451
8
2
8
0 1854
8
2
8
0 753
8
2
8
0 833
8
2
8
0 1550
8
2
8
0 1114
8
2
8
0 1543
8
2
8
0 84
8
2
8
1 84
8
0 1773
8
2
8
0 642
8
2
8
1 642
8
0 207
8
2
8
0 1972
8
2
8
0 583
8
2
8
1 583
8
0 1271
8
2
8
0 1080
8
2
8
0 317
8
2
8
0 81
8
2
8
1 81
8
0 1139
...

result:

ok 

Test #69:

score: 75
Accepted
time: 4ms
memory: 10032kb

input:

1979
1
1
1
1
1
1
1
1
2
1
2
2
2
1
1
1
2
1
1
1
1
1
2
1
1
2
2
1
1
1
1
2
1
1
2
1
2
1
2
2
1
1
1
2
2
2
1
2
1
2
2
1
1
2
2
1
1
1
1
1
2
2
2
2
2
2
2
1
1
2
1
2
1
1
2
2
1
2
1
2
2
1
2
1
1
2
2
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2...

output:

8
0 1668
8
2
8
0 1470
8
2
8
0 1472
8
2
8
0 613
8
2
8
0 1927
8
2
8
0 1886
8
2
8
0 420
8
2
8
0 1360
8
2
8
0 1296
8
2
8
1 1296
8
0 1207
8
2
8
0 908
8
2
8
1 908
8
0 715
8
2
8
1 715
8
0 311
8
2
8
1 311
8
0 568
8
2
8
0 1334
8
2
8
0 1716
8
2
8
0 1354
8
2
8
1 1354
8
0 1032
8
2
8
0 196
8
2
8
0 1136
8
2
8
0 1...

result:

ok 

Test #70:

score: 74.87
Acceptable Answer
time: 4ms
memory: 7852kb

input:

1979
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
2
2
1
1
1
2
2
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
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
1
1
2
2
2
2
2
2
2
2
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...

output:

8
0 1668
8
2
8
0 1470
8
2
8
0 1472
8
2
8
0 613
8
2
8
0 1927
8
2
8
0 1886
8
2
8
0 420
8
2
8
0 1360
8
2
8
0 1296
8
2
8
1 1296
8
0 1207
8
2
8
0 908
8
2
8
0 715
8
2
8
0 311
8
2
8
0 568
8
2
8
0 1334
8
2
8
0 1716
8
2
8
0 1354
8
2
8
1 1354
8
0 1032
8
2
8
1 1032
8
0 196
8
2
8
1 196
8
0 1136
8
2
8
1 1136
8
0...

result:

points 0.99826666670 points  0.99826666670

Test #71:

score: 74.87
Acceptable Answer
time: 3ms
memory: 7956kb

input:

1979
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
2
2
1
1
1
2
2
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
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
1
1
2
2
2
2
1
2
2
2
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...

output:

8
0 1668
8
2
8
0 1470
8
2
8
0 1472
8
2
8
0 613
8
2
8
0 1927
8
2
8
0 1886
8
2
8
0 420
8
2
8
0 1360
8
2
8
0 1296
8
2
8
1 1296
8
0 1207
8
2
8
0 908
8
2
8
0 715
8
2
8
0 311
8
2
8
0 568
8
2
8
0 1334
8
2
8
0 1716
8
2
8
0 1354
8
2
8
1 1354
8
0 1032
8
2
8
1 1032
8
0 196
8
2
8
1 196
8
0 1136
8
2
8
1 1136
8
0...

result:

points 0.99826666670 points  0.99826666670

Test #72:

score: 68.63
Acceptable Answer
time: 12ms
memory: 9960kb

input:

1981
1
1
1
1
1
1
1
1
2
1
2
2
2
1
1
1
2
1
1
1
1
1
2
1
1
2
2
1
1
1
1
2
1
1
2
1
2
1
2
2
1
1
1
2
2
2
1
2
1
2
2
1
1
2
2
1
1
1
1
1
2
2
2
2
2
2
2
1
1
2
1
2
1
1
2
2
1
2
1
2
2
1
2
1
1
2
2
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2...

output:

8
0 1668
8
2
8
0 1470
8
2
8
0 1472
8
2
8
0 613
8
2
8
0 1927
8
2
8
0 1886
8
2
8
0 420
8
2
8
0 1360
8
2
8
0 1296
8
2
8
1 1296
8
0 1207
8
2
8
0 908
8
2
8
1 908
8
0 715
8
2
8
1 715
8
0 311
8
2
8
1 311
8
0 568
8
2
8
0 1334
8
2
8
0 1716
8
2
8
0 1354
8
2
8
1 1354
8
0 1032
8
2
8
0 196
8
2
8
0 1136
8
2
8
0 1...

result:

points 0.91506666670 points  0.91506666670

Test #73:

score: 68.8
Acceptable Answer
time: 14ms
memory: 10268kb

input:

1981
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
1
2
1
1
1
2
2
2
2
2
2
1
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
1
2
1
2
2
2
1
1
2
2
2
1
1
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
1
2
2
2
2
1
1...

output:

8
0 1574
8
2
8
0 1631
8
2
8
0 1227
8
2
8
0 1283
8
2
8
0 1064
8
2
8
0 331
8
2
8
0 30
8
2
8
0 1724
8
2
8
0 1467
8
2
8
1 1467
8
0 910
8
2
8
0 420
8
2
8
0 1372
8
2
8
0 1188
8
2
8
0 1733
8
2
8
0 995
8
2
8
0 702
8
2
8
0 941
8
2
8
1 941
8
0 875
8
2
8
0 13
8
2
8
0 558
8
2
8
0 273
8
2
8
0 681
8
2
8
0 1560
8
...

result:

points 0.91733333330 points  0.91733333330

Test #74:

score: 61.24
Acceptable Answer
time: 17ms
memory: 10292kb

input:

1989
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
2
1
2
1
2
2
2
1
2
2
2
1
1
1
1
2
1
1
1
2
1
2
1
2
1
1
2
1
2
2
2
2
2
1
1
1
2
1
1
2
1
1
2
2
2
1
1
1
1
1
2
2
1
2
1
2
1
1
2
2
1
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
1
2
2
2
1
1
2
2
2
2...

output:

8
0 1574
8
2
8
0 1631
8
2
8
0 1227
8
2
8
0 1283
8
2
8
1 1283
8
0 1064
8
2
8
0 331
8
2
8
0 30
8
2
8
0 1724
8
2
8
0 1467
8
2
8
0 910
8
2
8
0 420
8
2
8
0 1372
8
2
8
0 1188
8
2
8
0 1733
8
2
8
0 995
8
2
8
1 995
8
0 702
8
2
8
0 941
8
2
8
0 875
8
2
8
0 13
8
2
8
1 13
8
0 558
8
2
8
0 273
8
2
8
0 681
8
2
8
0 ...

result:

points 0.81653333330 points  0.81653333330

Test #75:

score: 61.24
Acceptable Answer
time: 24ms
memory: 10008kb

input:

1989
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
2
1
2
1
2
2
2
1
2
2
2
1
1
1
1
2
1
1
1
2
1
2
1
2
1
1
2
1
2
2
2
2
2
1
1
1
2
1
1
2
1
1
2
2
2
1
1
1
1
1
2
2
1
2
1
2
1
1
2
2
1
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
1
2
2
2
1
1
2
2
2
2...

output:

8
0 1574
8
2
8
0 1631
8
2
8
0 1227
8
2
8
0 1283
8
2
8
1 1283
8
0 1064
8
2
8
0 331
8
2
8
0 30
8
2
8
0 1724
8
2
8
0 1467
8
2
8
0 910
8
2
8
0 420
8
2
8
0 1372
8
2
8
0 1188
8
2
8
0 1733
8
2
8
0 995
8
2
8
1 995
8
0 702
8
2
8
0 941
8
2
8
0 875
8
2
8
0 13
8
2
8
1 13
8
0 558
8
2
8
0 273
8
2
8
0 681
8
2
8
0 ...

result:

points 0.81653333330 points  0.81653333330

Test #76:

score: 74.89
Acceptable Answer
time: 11ms
memory: 10300kb

input:

1970
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
2
2
1
1
2
1
1
1
2
2
2
2
1
1
2
2
2
2
2
1
1
2
1
2
2
2
2
1
2
2
2
2
1
1
2
1
2
2
2
1
2
2
2
2
2
1
2
1
1
1
2
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
1...

output:

8
0 578
8
2
8
0 100
8
2
8
0 1318
8
2
8
0 1552
8
2
8
0 887
8
2
8
0 1621
8
2
8
0 1539
8
2
8
0 524
8
2
8
0 399
8
2
8
1 399
8
0 1467
8
2
8
0 641
8
2
8
0 589
8
2
8
0 371
8
2
8
0 137
8
2
8
0 1328
8
2
8
0 1526
8
2
8
0 1879
8
2
8
0 1308
8
2
8
0 401
8
2
8
0 408
8
2
8
0 1703
8
2
8
0 336
8
2
8
0 149
8
2
8
0 77...

result:

points 0.99853333330 points  0.99853333330

Test #77:

score: 74.89
Acceptable Answer
time: 7ms
memory: 7968kb

input:

1970
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
2
1
2
1
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
1
2
1
1
2
2
2
1
1
2
1
1
2
1
1
1
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
1
2
2
2
1
2
1
2
2
2
2
2
2
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
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
1
2
2
2
2
2...

output:

8
0 578
8
2
8
0 100
8
2
8
0 1318
8
2
8
0 1552
8
2
8
0 887
8
2
8
0 1621
8
2
8
0 1539
8
2
8
0 524
8
2
8
0 399
8
2
8
0 1467
8
2
8
1 1467
8
0 641
8
2
8
1 641
8
0 589
8
2
8
0 371
8
2
8
0 137
8
2
8
0 1328
8
2
8
0 1526
8
2
8
0 1879
8
2
8
0 1308
8
2
8
0 401
8
2
8
0 408
8
2
8
0 1703
8
2
8
0 336
8
2
8
0 149
8...

result:

points 0.99853333330 points  0.99853333330

Test #78:

score: 68.74
Acceptable Answer
time: 5ms
memory: 9996kb

input:

1980
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
1
2
2
1
1
2
1
1
2
1
2
2
1
2
1
1
2
1
1
2
2
2
2
2
2
2
1
1
1
1
2
1
1
2
1
2
1
1
2
1
1
2
1
1
1
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
1
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 578
8
2
8
0 100
8
2
8
0 1318
8
2
8
0 1552
8
2
8
0 887
8
2
8
0 1621
8
2
8
0 1539
8
2
8
0 524
8
2
8
0 399
8
2
8
0 1467
8
2
8
0 641
8
2
8
1 641
8
0 589
8
2
8
0 371
8
2
8
0 137
8
2
8
0 1328
8
2
8
0 1526
8
2
8
1 1526
8
0 1879
8
2
8
0 1308
8
2
8
0 401
8
2
8
1 401
8
0 408
8
2
8
0 1703
8
2
8
1 1703
8
0 ...

result:

points 0.91653333330 points  0.91653333330

Test #79:

score: 68.73
Acceptable Answer
time: 6ms
memory: 10016kb

input:

1980
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
1
2
2
1
1
2
1
1
2
1
2
2
1
2
1
1
2
1
1
2
2
2
2
2
2
2
1
1
1
1
2
1
1
2
1
2
1
1
2
1
1
2
1
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
1
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
2
1
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 578
8
2
8
0 100
8
2
8
0 1318
8
2
8
0 1552
8
2
8
0 887
8
2
8
0 1621
8
2
8
0 1539
8
2
8
0 524
8
2
8
0 399
8
2
8
0 1467
8
2
8
0 641
8
2
8
1 641
8
0 589
8
2
8
0 371
8
2
8
0 137
8
2
8
0 1328
8
2
8
0 1526
8
2
8
1 1526
8
0 1879
8
2
8
0 1308
8
2
8
0 401
8
2
8
1 401
8
0 408
8
2
8
0 1703
8
2
8
1 1703
8
0 ...

result:

points 0.91640 points  0.91640

Test #80:

score: 75
Accepted
time: 8ms
memory: 8216kb

input:

2000
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
2
2
1
1
1
2
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
1
1
1
2
2
2
1
2
1
1
2
1
1
1
2
2
1
1
1
1
1
2
2
2
1
2
1
1
2
2
2
2
1
1
2
2
1
1
2
2
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
1
1
1
2
2
2
1
2
1
2
2
2
1
1
2
1
2
1
2
1
1
2
1
1
2
1
2
1
1
2
1
2
2
1
1...

output:

8
0 1532
8
2
8
0 1790
8
2
8
0 1905
8
2
8
0 528
8
2
8
0 18
8
2
8
0 1394
8
2
8
0 949
8
2
8
0 1809
8
2
8
0 240
8
2
8
0 405
8
2
8
1 405
8
0 950
8
2
8
0 736
8
2
8
0 1390
8
2
8
0 69
8
2
8
0 1538
8
2
8
0 268
8
2
8
1 268
8
0 1761
8
2
8
1 1761
8
0 1777
8
2
8
0 238
8
2
8
0 1515
8
2
8
0 1667
8
2
8
0 1335
8
2
8...

result:

ok 

Test #81:

score: 75
Accepted
time: 17ms
memory: 10012kb

input:

2000
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
2
2
1
1
1
2
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
1
1
1
2
2
2
1
2
1
1
2
1
1
1
2
2
1
1
1
1
1
2
2
2
1
2
1
1
2
2
2
2
1
1
2
2
1
1
2
2
2
2
2
1
1
1
1
2
2
2
2
2
2
2
2
1
1
1
2
2
2
1
2
1
2
2
2
1
1
2
1
2
1
2
1
1
2
1
1
2
1
2
1
1
2
1
2
2
1
1...

output:

8
0 1532
8
2
8
0 1790
8
2
8
0 1905
8
2
8
0 528
8
2
8
0 18
8
2
8
0 1394
8
2
8
0 949
8
2
8
0 1809
8
2
8
0 240
8
2
8
0 405
8
2
8
1 405
8
0 950
8
2
8
0 736
8
2
8
0 1390
8
2
8
0 69
8
2
8
0 1538
8
2
8
0 268
8
2
8
1 268
8
0 1761
8
2
8
1 1761
8
0 1777
8
2
8
0 238
8
2
8
0 1515
8
2
8
0 1667
8
2
8
0 1335
8
2
8...

result:

ok 

Test #82:

score: 74.92
Acceptable Answer
time: 33ms
memory: 10328kb

input:

2000
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
2
1
2
1
1
2
1
1
1
1
1
1
2
1
2
1
2
2
2
1
1
1
1
2
1
1
1
1
1
2
1
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
1
1
2
1
1
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2...

output:

8
0 1532
8
2
8
0 1790
8
2
8
0 1905
8
2
8
0 528
8
2
8
0 18
8
2
8
0 1394
8
2
8
0 949
8
2
8
0 1809
8
2
8
0 240
8
2
8
0 405
8
2
8
1 405
8
0 950
8
2
8
0 736
8
2
8
1 736
8
0 1390
8
2
8
0 69
8
2
8
0 1538
8
2
8
1 1538
8
0 268
8
2
8
0 1761
8
2
8
0 1777
8
2
8
1 1777
8
0 238
8
2
8
0 1515
8
2
8
1 1515
8
0 1667
...

result:

points 0.99893333330 points  0.99893333330

Test #83:

score: 74.92
Acceptable Answer
time: 5ms
memory: 10296kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
2
1
1
1
1
1
2
1
1
2
1
2
2
1
2
1
1
2
1
2
2
2
1
2
1
1
2
2
2
2
2
1
2
1
2
1
1
1
2
1
1
1
2
2
2
1
1
1
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
1
1
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1532
8
2
8
0 1790
8
2
8
0 1905
8
2
8
0 528
8
2
8
0 18
8
2
8
0 1394
8
2
8
0 949
8
2
8
0 1809
8
2
8
0 240
8
2
8
0 405
8
2
8
0 950
8
2
8
0 736
8
2
8
0 1390
8
2
8
0 69
8
2
8
1 69
8
0 1538
8
2
8
0 268
8
2
8
0 1761
8
2
8
1 1761
8
0 1777
8
2
8
0 238
8
2
8
1 238
8
0 1515
8
2
8
0 1667
8
2
8
0 1335
8
2
8
...

result:

points 0.99893333330 points  0.99893333330

Test #84:

score: 42.56
Acceptable Answer
time: 3ms
memory: 9992kb

input:

540
1
2
1
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 464
8
2
8
0 241
8
2
8
1 241
8
0 14
8
2
8
0 528
8
2
8
1 528
8
0 18
8
2
8
1 18
8
0 126
8
2
8
0 233
8
2
8
1 233
8
0 478
8
2
8
1 478
8
0 240
8
2
8
1 240
8
0 405
8
2
8
1 405
8
0 148
8
2
8
0 526
8
2
8
1 526
8
0 326
8
2
8
1 326
8
0 69
8
2
8
1 69
8
0 78
8
2
8
1 78
8
0 268
8
2
8
1 268
8
0 344
8
2
8
1 344...

result:

points 0.56746666670 points  0.56746666670

Test #85:

score: 31.07
Acceptable Answer
time: 5ms
memory: 10252kb

input:

1834
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
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:

8
0 1444
8
2
8
0 1512
8
2
8
1 1512
8
0 624
8
2
8
0 1230
8
2
8
1 1230
8
0 1167
8
2
8
1 1167
8
0 927
8
2
8
1 927
8
0 66
8
2
8
1 66
8
0 737
8
2
8
1 737
8
0 1119
8
2
8
1 1119
8
0 132
8
2
8
1 132
8
0 1086
8
2
8
1 1086
8
0 1733
8
2
8
1 1733
8
0 1620
8
2
8
1 1620
8
0 1604
8
2
8
1 1604
8
0 17
8
2
8
1 17
8
0...

result:

points 0.41426666670 points  0.41426666670

Test #86:

score: 75
Accepted
time: 0ms
memory: 10292kb

input:

2000
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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:

8
0 1444
8
2
8
0 1512
8
2
8
1 1512
8
0 624
8
2
8
0 1854
8
2
8
1 1854
8
0 1167
8
2
8
1 1167
8
0 927
8
2
8
1 927
8
0 66
8
2
8
1 66
8
0 737
8
2
8
1 737
8
0 1119
8
2
8
1 1119
8
0 132
8
2
8
1 132
8
0 1086
8
2
8
1 1086
8
0 1733
8
2
8
1 1733
8
0 1620
8
2
8
1 1620
8
0 1956
8
2
8
1 1956
8
0 17
8
2
8
1 17
8
0...

result:

ok 

Test #87:

score: 75
Accepted
time: 7ms
memory: 10292kb

input:

2000
1
1
1
1
1
2
2
2
1
2
1
1
1
1
2
1
2
1
2
2
2
1
2
1
1
2
1
2
2
2
1
1
1
1
2
2
2
2
2
2
1
1
1
1
1
2
2
1
2
1
1
2
1
1
1
2
1
1
2
1
1
2
2
1
1
1
1
1
1
1
1
2
2
1
1
1
1
2
2
2
2
1
1
1
1
2
2
1
1
2
2
2
1
1
1
1
2
2
2
2
2
1
1
2
2
1
2
2
2
2
1
2
2
2
1
1
2
2
1
1
1
1
2
1
2
1
2
2
2
2
1
1
1
1
1
2
2
1
2
1
2
2
2
1
1
2
2
1...

output:

8
0 1444
8
2
8
0 1512
8
2
8
0 624
8
2
8
0 1854
8
2
8
0 1167
8
2
8
0 927
8
2
8
1 927
8
0 66
8
2
8
1 66
8
0 737
8
2
8
1 737
8
0 1119
8
2
8
0 132
8
2
8
1 132
8
0 1086
8
2
8
0 1733
8
2
8
0 1620
8
2
8
0 1956
8
2
8
0 17
8
2
8
1 17
8
0 1008
8
2
8
0 34
8
2
8
1 34
8
0 1218
8
2
8
0 178
8
2
8
1 178
8
0 184
8
2...

result:

ok 

Test #88:

score: 75
Accepted
time: 3ms
memory: 10036kb

input:

2000
1
2
1
2
2
1
1
1
2
1
2
2
2
2
1
2
1
2
1
1
1
2
1
2
2
1
2
1
1
1
2
2
2
2
1
1
1
1
1
1
2
2
2
2
2
1
1
2
1
2
2
1
2
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
1
1
1
2
2
2
2
1
1
2
2
1
1
1
2
2
2
2
1
1
1
1
1
2
2
1
1
2
1
1
1
1
2
1
1
1
2
2
1
1
2
2
2
2
1
2
1
2
1
1
1
1
2
2
2
2
2
1
1
2
1
2
1
1
1
2
2
1
1
2...

output:

8
0 1444
8
2
8
0 1512
8
2
8
1 1512
8
0 624
8
2
8
0 1854
8
2
8
1 1854
8
0 1167
8
2
8
1 1167
8
0 927
8
2
8
0 66
8
2
8
0 737
8
2
8
0 1119
8
2
8
1 1119
8
0 132
8
2
8
0 1086
8
2
8
1 1086
8
0 1733
8
2
8
1 1733
8
0 1620
8
2
8
1 1620
8
0 1956
8
2
8
1 1956
8
0 17
8
2
8
0 1008
8
2
8
1 1008
8
0 34
8
2
8
0 1218...

result:

ok 

Test #89:

score: 75
Accepted
time: 7ms
memory: 8256kb

input:

2000
1
1
1
2
2
2
2
1
2
1
2
2
1
1
1
1
2
1
2
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
2
2
2
2
2
2
2
1
2
2
1
2
1
2
1
1
1
1
2
1
2
2
1
1
2
1
2
1
1
1
1
2
2
1
1
1
1
2
2
1
1
1
2
2
1
1
1
2
2
1
1
2
1
2
1
1
2
2
1
1
2
1
1
1
2
2
2
2
1
2
2
2
2
2
1
2
1
2
1
2
1
2
1
1
2
1
2
1
1
2
2
2
1
2
1
2
1
2
1
1
2
2
2
1
1
2
1...

output:

8
0 638
8
2
8
0 609
8
2
8
0 1690
8
2
8
0 310
8
2
8
1 310
8
0 1632
8
2
8
1 1632
8
0 1609
8
2
8
1 1609
8
0 1621
8
2
8
1 1621
8
0 794
8
2
8
0 1535
8
2
8
1 1535
8
0 1486
8
2
8
0 1716
8
2
8
1 1716
8
0 53
8
2
8
1 53
8
0 1411
8
2
8
0 699
8
2
8
0 893
8
2
8
0 1255
8
2
8
0 1536
8
2
8
1 1536
8
0 1182
8
2
8
0 1...

result:

ok