QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#538006#4565. Rarest InsectsYahia_Emara#46.15 31ms10316kbC++202.8kb2024-08-30 20:48:352024-08-30 20:48:36

Judging History

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

  • [2024-08-30 20:48:36]
  • 评测
  • 测评结果:46.15
  • 用时:31ms
  • 内存:10316kb
  • [2024-08-30 20:48:35]
  • 提交

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;
}*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 9984kb

input:

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

output:

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

result:

wrong answer Wrong answer.

Subtask #2:

score: 15
Accepted

Test #24:

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

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 985
8
2
8
0 998
8
2
8
1 998
8
0 243
8
2
8
1 243
8
0 912
8
2
8
1 912
8
0 602
8
2
8
1 602
8
0 954
8
2
8
1 954
8
0 677
8
2
8
1 677
8
0 358
8
2
8
1 358
8
0 166
8
2
8
1 166
8
0 836
8
2
8
1 836
8
0 643
8
2
8
1 643
8
0 887
8
2
8
1 887
8
0 395
8
2
8
1 395
8
0 543
8
2
8
1 543
8
0 213
8
2
8
1 213
8
0 208
...

result:

ok 

Test #25:

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

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 985
8
2
8
0 998
8
2
8
0 243
8
2
8
0 912
8
2
8
0 602
8
2
8
0 954
8
2
8
0 677
8
2
8
0 358
8
2
8
0 166
8
2
8
0 836
8
2
8
0 643
8
2
8
0 887
8
2
8
0 395
8
2
8
0 543
8
2
8
0 213
8
2
8
0 208
8
2
8
0 562
8
2
8
0 645
8
2
8
0 66
8
2
8
0 641
8
2
8
0 782
8
2
8
0 810
8
2
8
0 288
8
2
8
0 856
8
2
8
0 824
8
2
8...

result:

ok 

Test #26:

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

input:

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

output:

8
0 985
8
2
8
0 998
8
2
8
0 243
8
2
8
0 912
8
2
8
0 602
8
2
8
0 954
8
2
8
0 677
8
2
8
0 358
8
2
8
0 166
8
2
8
0 836
8
2
8
0 643
8
2
8
1 643
8
0 887
8
2
8
0 395
8
2
8
1 395
8
0 543
8
2
8
0 213
8
2
8
0 208
8
2
8
1 208
8
0 562
8
2
8
0 645
8
2
8
1 645
8
0 66
8
2
8
0 641
8
2
8
1 641
8
0 782
8
2
8
0 810
8...

result:

ok 

Test #27:

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

input:

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

output:

8
0 985
8
2
8
0 998
8
2
8
0 243
8
2
8
0 912
8
2
8
0 602
8
2
8
0 954
8
2
8
0 677
8
2
8
1 677
8
0 358
8
2
8
0 166
8
2
8
0 836
8
2
8
1 836
8
0 643
8
2
8
1 643
8
0 887
8
2
8
0 395
8
2
8
0 543
8
2
8
0 213
8
2
8
0 208
8
2
8
0 562
8
2
8
1 562
8
0 645
8
2
8
0 66
8
2
8
0 641
8
2
8
1 641
8
0 782
8
2
8
1 782
8...

result:

ok 

Test #28:

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

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 985
8
2
8
0 585
8
2
8
1 585
8
0 243
8
2
8
1 243
8
0 912
8
2
8
1 912
8
0 602
8
2
8
1 602
8
0 954
8
2
8
1 954
8
0 677
8
2
8
1 677
8
0 358
8
2
8
1 358
8
0 166
8
2
8
1 166
8
0 836
8
2
8
1 836
8
0 643
8
2
8
1 643
8
0 887
8
2
8
1 887
8
0 395
8
2
8
1 395
8
0 543
8
2
8
1 543
8
0 213
8
2
8
1 213
8
0 208
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 985
8
2
8
0 585
8
2
8
1 585
8
0 243
8
2
8
0 912
8
2
8
0 602
8
2
8
0 954
8
2
8
0 677
8
2
8
0 358
8
2
8
0 166
8
2
8
0 836
8
2
8
1 836
8
0 643
8
2
8
0 887
8
2
8
0 395
8
2
8
0 543
8
2
8
1 543
8
0 213
8
2
8
0 208
8
2
8
0 562
8
2
8
1 562
8
0 645
8
2
8
0 66
8
2
8
1 66
8
0 641
8
2
8
1 641
8
0 782
8
2
8
...

result:

ok 

Test #30:

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

input:

998
1
1
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
2
2
2
2
2
2
2
2
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 985
8
2
8
0 585
8
2
8
0 243
8
2
8
1 243
8
0 912
8
2
8
1 912
8
0 602
8
2
8
1 602
8
0 954
8
2
8
1 954
8
0 677
8
2
8
0 358
8
2
8
1 358
8
0 166
8
2
8
1 166
8
0 836
8
2
8
1 836
8
0 643
8
2
8
1 643
8
0 887
8
2
8
1 887
8
0 395
8
2
8
1 395
8
0 543
8
2
8
1 543
8
0 213
8
2
8
1 213
8
0 208
8
2
8
1 208
8
0 ...

result:

ok 

Test #31:

score: 15
Accepted
time: 11ms
memory: 10060kb

input:

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

output:

8
0 235
8
2
8
0 889
8
2
8
0 62
8
2
8
0 331
8
2
8
0 907
8
2
8
0 482
8
2
8
1 482
8
0 495
8
2
8
0 697
8
2
8
0 128
8
2
8
0 975
8
2
8
0 460
8
2
8
0 270
8
2
8
1 270
8
0 602
8
2
8
1 602
8
0 434
8
2
8
0 411
8
2
8
1 411
8
0 227
8
2
8
0 533
8
2
8
0 770
8
2
8
1 770
8
0 782
8
2
8
0 742
8
2
8
0 208
8
2
8
1 208
8...

result:

ok 

Test #32:

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

input:

1000
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 235
8
2
8
0 889
8
2
8
1 889
8
0 62
8
2
8
1 62
8
0 331
8
2
8
0 907
8
2
8
1 907
8
0 482
8
2
8
1 482
8
0 495
8
2
8
1 495
8
0 697
8
2
8
1 697
8
0 128
8
2
8
0 975
8
2
8
1 975
8
0 460
8
2
8
1 460
8
0 270
8
2
8
0 602
8
2
8
1 602
8
0 434
8
2
8
0 411
8
2
8
1 411
8
0 227
8
2
8
1 227
8
0 533
8
2
8
1 533
8
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 235
8
2
8
0 889
8
2
8
1 889
8
0 62
8
2
8
0 331
8
2
8
0 907
8
2
8
0 482
8
2
8
0 495
8
2
8
1 495
8
0 697
8
2
8
1 697
8
0 128
8
2
8
1 128
8
0 975
8
2
8
0 460
8
2
8
0 270
8
2
8
1 270
8
0 602
8
2
8
1 602
8
0 434
8
2
8
1 434
8
0 411
8
2
8
1 411
8
0 227
8
2
8
1 227
8
0 533
8
2
8
1 533
8
0 770
8
2
8
1 7...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
2
1
2
2
1
2
2
2
2
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 235
8
2
8
0 889
8
2
8
0 62
8
2
8
0 331
8
2
8
0 907
8
2
8
1 907
8
0 482
8
2
8
0 495
8
2
8
1 495
8
0 697
8
2
8
1 697
8
0 128
8
2
8
0 975
8
2
8
1 975
8
0 460
8
2
8
1 460
8
0 270
8
2
8
1 270
8
0 602
8
2
8
1 602
8
0 434
8
2
8
0 411
8
2
8
1 411
8
0 227
8
2
8
1 227
8
0 533
8
2
8
0 770
8
2
8
1 770
8
0 7...

result:

ok 

Test #35:

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

input:

1000
1
1
1
2
1
1
2
1
1
1
2
2
2
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 235
8
2
8
0 889
8
2
8
0 62
8
2
8
0 331
8
2
8
1 331
8
0 907
8
2
8
0 482
8
2
8
0 495
8
2
8
1 495
8
0 697
8
2
8
0 128
8
2
8
0 975
8
2
8
0 460
8
2
8
1 460
8
0 270
8
2
8
1 270
8
0 602
8
2
8
1 602
8
0 434
8
2
8
1 434
8
0 411
8
2
8
1 411
8
0 227
8
2
8
0 533
8
2
8
1 533
8
0 770
8
2
8
0 782
8
2
8
1 782
8...

result:

ok 

Test #36:

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

input:

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

output:

8
0 235
8
2
8
0 889
8
2
8
0 62
8
2
8
0 331
8
2
8
1 331
8
0 907
8
2
8
0 482
8
2
8
0 495
8
2
8
0 697
8
2
8
0 128
8
2
8
0 975
8
2
8
1 975
8
0 460
8
2
8
0 270
8
2
8
0 602
8
2
8
0 434
8
2
8
0 411
8
2
8
1 411
8
0 227
8
2
8
1 227
8
0 533
8
2
8
1 533
8
0 770
8
2
8
1 770
8
0 782
8
2
8
1 782
8
0 742
8
2
8
1 7...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
2
2
1
2
2
1
2
1
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
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 235
8
2
8
0 889
8
2
8
0 62
8
2
8
0 331
8
2
8
0 907
8
2
8
0 482
8
2
8
0 495
8
2
8
0 697
8
2
8
0 128
8
2
8
0 975
8
2
8
0 460
8
2
8
1 460
8
0 270
8
2
8
1 270
8
0 602
8
2
8
0 434
8
2
8
1 434
8
0 411
8
2
8
0 227
8
2
8
1 227
8
0 533
8
2
8
1 533
8
0 770
8
2
8
0 782
8
2
8
1 782
8
0 742
8
2
8
1 742
8
0 2...

result:

ok 

Test #38:

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

input:

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

output:

8
0 430
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
0 575
8
2
8
1 575
8
0 621
8
2
8
1 621
8
0 123
8
2
8
0 246
8
2
8
1 246
8
0 787
8
2
8
0 464
8
2
8
0 894
8
2
8
1 894
8
0 977
8
2
8
1 977
8
0 210
8
2
8
0 816
8
2
8
0 186
8
2
8
0 237
8
2
8
0 527
8
2
8
0 463
8
2
8
1 463
8
...

result:

ok 

Test #39:

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

input:

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

output:

8
0 430
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
0 575
8
2
8
0 621
8
2
8
0 123
8
2
8
0 246
8
2
8
0 787
8
2
8
0 464
8
2
8
0 894
8
2
8
0 977
8
2
8
0 210
8
2
8
0 816
8
2
8
0 186
8
2
8
0 237
8
2
8
0 527
8
2
8
1 527
8
0 463
8
2
8
0 934
8
2
8
0 988
8
2
8
0 755
8
2
8
0 14...

result:

ok 

Test #40:

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

input:

996
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
2
1
1
1
2
1
1
1
2
1
1
1
2
1
2
2
2
1
2
1
1
1
1
2
2
1
2
1
2
2
2
2
1
1
1
1
1
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
1
2
1
2
1
1
...

output:

8
0 430
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
1 95
8
0 575
8
2
8
0 621
8
2
8
0 123
8
2
8
0 246
8
2
8
0 787
8
2
8
0 464
8
2
8
0 894
8
2
8
0 977
8
2
8
1 977
8
0 210
8
2
8
0 816
8
2
8
0 186
8
2
8
0 237
8
2
8
0 527
8
2
8
0 463
8
2
8
0 934
8
2
8
0 988
8
2
8
0 755
8
2...

result:

ok 

Test #41:

score: 15
Accepted
time: 4ms
memory: 10064kb

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

output:

8
0 430
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
0 575
8
2
8
0 621
8
2
8
0 123
8
2
8
0 246
8
2
8
0 787
8
2
8
0 464
8
2
8
0 894
8
2
8
0 977
8
2
8
0 210
8
2
8
0 816
8
2
8
0 186
8
2
8
0 237
8
2
8
0 527
8
2
8
0 463
8
2
8
0 934
8
2
8
0 988
8
2
8
0 755
8
2
8
0 149
8
2
8
...

result:

ok 

Test #42:

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

input:

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

output:

8
0 430
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
0 575
8
2
8
0 621
8
2
8
0 123
8
2
8
0 246
8
2
8
0 787
8
2
8
0 464
8
2
8
0 894
8
2
8
0 977
8
2
8
0 210
8
2
8
0 816
8
2
8
0 186
8
2
8
1 186
8
0 237
8
2
8
0 527
8
2
8
0 463
8
2
8
0 934
8
2
8
0 988
8
2
8
0 755
8
2
8
0 14...

result:

ok 

Subtask #3:

score: 31.15
Acceptable Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2
1
2

output:

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

result:

ok 

Test #46:

score: 75
Accepted
time: 1ms
memory: 8020kb

input:

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

output:

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
0 2
8
2
8
0 3
8
2
8
1 3
8
1 2
8
1 0
8
0 0
8
0 4
8
2
8
0 1
8
2
8
0 5
8
2
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
1 5
8
1 1
8
1 4
8
1 0
8
3 1

result:

ok 

Test #47:

score: 75
Accepted
time: 1ms
memory: 7956kb

input:

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

output:

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

result:

ok 

Test #48:

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

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 1623
8
2
8
0 958
8
2
8
1 958
8
0 92
8
2
8
1 92
8
0 982
8
2
8
1 982
8
0 275
8
2
8
1 275
8
0 511
8
2
8
1 511
8
0 95
8
2
8
1 95
8
0 1329
8
2
8
1 1329
8
0 621
8
2
8
1 621
8
0 123
8
2
8
1 123
8
0 246
8
2
8
1 246
8
0 1374
8
2
8
1 1374
8
0 464
8
2
8
1 464
8
0 1070
8
2
8
1 1070
8
0 977
8
2
8
1 977
8
0 1...

result:

ok 

Test #49:

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

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 1623
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
0 1329
8
2
8
0 621
8
2
8
0 123
8
2
8
0 246
8
2
8
0 1374
8
2
8
0 464
8
2
8
0 1070
8
2
8
0 977
8
2
8
0 1197
8
2
8
0 1913
8
2
8
0 1385
8
2
8
0 1777
8
2
8
0 1681
8
2
8
0 1675
8
2
8
0 1767
8
2
8
0 1241
8
2
8
0 755
8
2
8
...

result:

ok 

Test #50:

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

input:

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

output:

8
0 1623
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
0 1329
8
2
8
0 621
8
2
8
0 123
8
2
8
0 246
8
2
8
0 1374
8
2
8
0 464
8
2
8
0 1070
8
2
8
0 977
8
2
8
1 977
8
0 1197
8
2
8
1 1197
8
0 1913
8
2
8
0 1385
8
2
8
0 1777
8
2
8
1 1777
8
0 1681
8
2
8
0 1675
8
2
8
1 1675
8
0 1...

result:

ok 

Test #51:

score: 68.68
Acceptable Answer
time: 8ms
memory: 10032kb

input:

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

output:

8
0 1623
8
2
8
0 958
8
2
8
0 92
8
2
8
0 982
8
2
8
1 982
8
0 275
8
2
8
0 511
8
2
8
0 95
8
2
8
0 1329
8
2
8
0 621
8
2
8
0 123
8
2
8
0 246
8
2
8
0 1374
8
2
8
0 464
8
2
8
0 1070
8
2
8
0 977
8
2
8
0 1197
8
2
8
1 1197
8
0 1913
8
2
8
0 1385
8
2
8
0 1777
8
2
8
1 1777
8
0 1681
8
2
8
0 1675
8
2
8
1 1675
8
0 1...

result:

points 0.91573333330 points  0.91573333330

Test #52:

score: 75
Accepted
time: 5ms
memory: 10008kb

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 1987
8
2
8
0 1770
8
2
8
1 1770
8
0 1418
8
2
8
1 1418
8
0 1277
8
2
8
1 1277
8
0 1226
8
2
8
1 1226
8
0 1843
8
2
8
1 1843
8
0 1990
8
2
8
1 1990
8
0 275
8
2
8
1 275
8
0 1708
8
2
8
1 1708
8
0 1173
8
2
8
1 1173
8
0 400
8
2
8
1 400
8
0 187
8
2
8
1 187
8
0 1096
8
2
8
1 1096
8
0 1274
8
2
8
1 1274
8
0 1
8...

result:

ok 

Test #53:

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

input:

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

output:

8
0 1987
8
2
8
0 1770
8
2
8
0 1418
8
2
8
1 1418
8
0 1277
8
2
8
1 1277
8
0 1226
8
2
8
0 1843
8
2
8
0 1990
8
2
8
1 1990
8
0 275
8
2
8
1 275
8
0 1708
8
2
8
0 1173
8
2
8
0 400
8
2
8
1 400
8
0 187
8
2
8
1 187
8
0 1096
8
2
8
1 1096
8
0 1274
8
2
8
1 1274
8
0 1
8
2
8
0 608
8
2
8
1 608
8
0 1422
8
2
8
0 223
8...

result:

ok 

Test #54:

score: 64.33
Acceptable Answer
time: 23ms
memory: 10020kb

input:

2000
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1987
8
2
8
0 1770
8
2
8
0 1418
8
2
8
0 1277
8
2
8
0 1226
8
2
8
1 1226
8
0 1843
8
2
8
1 1843
8
0 1990
8
2
8
1 1990
8
0 275
8
2
8
1 275
8
0 1708
8
2
8
1 1708
8
0 1173
8
2
8
1 1173
8
0 400
8
2
8
1 400
8
0 187
8
2
8
1 187
8
0 1096
8
2
8
1 1096
8
0 1274
8
2
8
1 1274
8
0 1
8
2
8
1 1
8
0 608
8
2
8
1 60...

result:

points 0.85773333330 points  0.85773333330

Test #55:

score: 50.58
Acceptable Answer
time: 7ms
memory: 10288kb

input:

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

output:

8
0 1987
8
2
8
0 1770
8
2
8
0 1418
8
2
8
0 1277
8
2
8
0 1226
8
2
8
0 1843
8
2
8
0 1990
8
2
8
0 275
8
2
8
0 1708
8
2
8
0 1173
8
2
8
0 400
8
2
8
0 187
8
2
8
0 1096
8
2
8
0 1274
8
2
8
0 1
8
2
8
0 608
8
2
8
1 608
8
0 1422
8
2
8
0 223
8
2
8
0 432
8
2
8
0 1930
8
2
8
0 123
8
2
8
1 123
8
0 262
8
2
8
0 742
8...

result:

points 0.67440 points  0.67440

Test #56:

score: 64.33
Acceptable Answer
time: 0ms
memory: 10300kb

input:

1998
1
1
1
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
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 1786
8
2
8
0 1014
8
2
8
0 252
8
2
8
0 668
8
2
8
1 668
8
0 855
8
2
8
0 808
8
2
8
1 808
8
0 1448
8
2
8
1 1448
8
0 603
8
2
8
0 755
8
2
8
1 755
8
0 1059
8
2
8
1 1059
8
0 953
8
2
8
1 953
8
0 1140
8
2
8
1 1140
8
0 1350
8
2
8
1 1350
8
0 1535
8
2
8
1 1535
8
0 586
8
2
8
1 586
8
0 1901
8
2
8
1 1901
8
0 11...

result:

points 0.85773333330 points  0.85773333330

Test #57:

score: 74.33
Acceptable Answer
time: 10ms
memory: 10032kb

input:

1999
1
1
1
1
2
1
1
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
2
2
2
2
2
2
2
2
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 1786
8
2
8
0 1014
8
2
8
0 252
8
2
8
0 668
8
2
8
0 855
8
2
8
1 855
8
0 808
8
2
8
0 1448
8
2
8
0 603
8
2
8
1 603
8
0 755
8
2
8
1 755
8
0 1059
8
2
8
0 953
8
2
8
1 953
8
0 1140
8
2
8
0 1350
8
2
8
1 1350
8
0 1535
8
2
8
1 1535
8
0 586
8
2
8
1 586
8
0 1901
8
2
8
1 1901
8
0 1188
8
2
8
1 1188
8
0 1514
8
...

result:

points 0.99106666670 points  0.99106666670

Test #58:

score: 73.29
Acceptable Answer
time: 11ms
memory: 9988kb

input:

1997
1
1
1
2
1
2
2
1
2
1
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1786
8
2
8
0 1014
8
2
8
0 252
8
2
8
0 668
8
2
8
1 668
8
0 855
8
2
8
0 808
8
2
8
1 808
8
0 1448
8
2
8
1 1448
8
0 603
8
2
8
0 755
8
2
8
1 755
8
0 1059
8
2
8
0 953
8
2
8
0 1140
8
2
8
1 1140
8
0 1350
8
2
8
0 1535
8
2
8
1 1535
8
0 586
8
2
8
1 586
8
0 1901
8
2
8
1 1901
8
0 1188
8
2
8
1 1188
8
0 1514
8...

result:

points 0.97720 points  0.97720

Test #59:

score: 72.23
Acceptable Answer
time: 7ms
memory: 9996kb

input:

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

output:

8
0 1015
8
2
8
0 1355
8
2
8
0 671
8
2
8
0 882
8
2
8
0 414
8
2
8
0 1159
8
2
8
1 1159
8
0 1507
8
2
8
1 1507
8
0 1541
8
2
8
1 1541
8
0 1626
8
2
8
1 1626
8
0 1440
8
2
8
0 1694
8
2
8
1 1694
8
0 828
8
2
8
1 828
8
0 1612
8
2
8
1 1612
8
0 1744
8
2
8
1 1744
8
0 1411
8
2
8
1 1411
8
0 1826
8
2
8
1 1826
8
0 146...

result:

points 0.96306666670 points  0.96306666670

Test #60:

score: 71.71
Acceptable Answer
time: 16ms
memory: 10104kb

input:

1996
1
1
1
1
1
1
1
2
1
1
1
2
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1015
8
2
8
0 1355
8
2
8
0 671
8
2
8
0 882
8
2
8
0 414
8
2
8
0 1159
8
2
8
0 1507
8
2
8
0 1541
8
2
8
1 1541
8
0 1626
8
2
8
0 1440
8
2
8
0 1694
8
2
8
0 828
8
2
8
1 828
8
0 1612
8
2
8
1 1612
8
0 1744
8
2
8
0 1411
8
2
8
1 1411
8
0 1826
8
2
8
0 1460
8
2
8
1 1460
8
0 1155
8
2
8
1 1155
8
0 1226
8
2
8
1 ...

result:

points 0.95613333330 points  0.95613333330

Test #61:

score: 72.22
Acceptable Answer
time: 17ms
memory: 10012kb

input:

2000
1
1
1
1
1
1
1
1
1
2
2
2
2
1
1
1
2
1
1
1
2
2
2
2
2
2
1
1
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1015
8
2
8
0 1355
8
2
8
0 671
8
2
8
0 882
8
2
8
0 414
8
2
8
0 1159
8
2
8
0 1507
8
2
8
0 1541
8
2
8
0 1626
8
2
8
0 1440
8
2
8
1 1440
8
0 1694
8
2
8
1 1694
8
0 828
8
2
8
1 828
8
0 1612
8
2
8
1 1612
8
0 1744
8
2
8
0 1411
8
2
8
0 1826
8
2
8
0 1460
8
2
8
1 1460
8
0 1155
8
2
8
0 1226
8
2
8
0 1881
8
2
...

result:

points 0.96293333330 points  0.96293333330

Test #62:

score: 68.75
Acceptable Answer
time: 11ms
memory: 10008kb

input:

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

output:

8
0 1015
8
2
8
0 1355
8
2
8
0 671
8
2
8
0 882
8
2
8
0 414
8
2
8
0 1159
8
2
8
0 1507
8
2
8
0 1541
8
2
8
0 1626
8
2
8
0 1440
8
2
8
1 1440
8
0 1694
8
2
8
0 828
8
2
8
0 1612
8
2
8
1 1612
8
0 1744
8
2
8
0 1411
8
2
8
0 1826
8
2
8
0 1460
8
2
8
0 1155
8
2
8
0 1226
8
2
8
0 1881
8
2
8
1 1881
8
0 1123
8
2
8
0 ...

result:

points 0.91666666670 points  0.91666666670

Test #63:

score: 63.73
Acceptable Answer
time: 7ms
memory: 10036kb

input:

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

output:

8
0 1951
8
2
8
0 1596
8
2
8
0 434
8
2
8
0 872
8
2
8
0 69
8
2
8
0 1137
8
2
8
0 1182
8
2
8
0 650
8
2
8
0 489
8
2
8
0 133
8
2
8
0 1664
8
2
8
0 354
8
2
8
0 584
8
2
8
0 147
8
2
8
0 777
8
2
8
0 1912
8
2
8
0 1852
8
2
8
0 87
8
2
8
0 119
8
2
8
1 119
8
0 1779
8
2
8
0 1478
8
2
8
0 782
8
2
8
1 782
8
0 1916
8
2
...

result:

points 0.84973333330 points  0.84973333330

Test #64:

score: 68.88
Acceptable Answer
time: 6ms
memory: 10008kb

input:

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

output:

8
0 1951
8
2
8
0 1596
8
2
8
0 434
8
2
8
0 872
8
2
8
0 69
8
2
8
0 1137
8
2
8
0 1182
8
2
8
0 650
8
2
8
0 489
8
2
8
0 133
8
2
8
0 1664
8
2
8
0 354
8
2
8
0 584
8
2
8
0 147
8
2
8
1 147
8
0 777
8
2
8
0 1912
8
2
8
0 1852
8
2
8
1 1852
8
0 87
8
2
8
0 119
8
2
8
0 1779
8
2
8
0 1478
8
2
8
0 782
8
2
8
0 1916
8
2...

result:

points 0.91840 points  0.91840

Test #65:

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

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

output:

8
0 1951
8
2
8
0 1596
8
2
8
0 434
8
2
8
0 872
8
2
8
0 69
8
2
8
0 1137
8
2
8
0 1182
8
2
8
0 650
8
2
8
0 489
8
2
8
0 133
8
2
8
0 1664
8
2
8
0 354
8
2
8
0 584
8
2
8
0 147
8
2
8
0 777
8
2
8
0 1912
8
2
8
0 1852
8
2
8
0 87
8
2
8
0 119
8
2
8
0 1779
8
2
8
0 1478
8
2
8
0 782
8
2
8
0 1916
8
2
8
0 1475
8
2
8
0...

result:

ok 

Test #66:

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

input:

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

output:

8
0 1951
8
2
8
0 1596
8
2
8
0 434
8
2
8
0 872
8
2
8
0 69
8
2
8
0 1137
8
2
8
0 1182
8
2
8
0 650
8
2
8
0 489
8
2
8
0 133
8
2
8
0 1664
8
2
8
0 354
8
2
8
0 584
8
2
8
1 584
8
0 147
8
2
8
0 777
8
2
8
0 1912
8
2
8
0 1852
8
2
8
0 87
8
2
8
0 119
8
2
8
0 1779
8
2
8
0 1478
8
2
8
0 782
8
2
8
0 1916
8
2
8
0 1475...

result:

ok 

Test #67:

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

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

output:

8
0 1256
8
2
8
0 1044
8
2
8
0 318
8
2
8
0 1277
8
2
8
0 267
8
2
8
0 997
8
2
8
0 1879
8
2
8
0 1217
8
2
8
0 140
8
2
8
0 1583
8
2
8
0 505
8
2
8
0 1993
8
2
8
0 1435
8
2
8
0 416
8
2
8
0 1645
8
2
8
0 1454
8
2
8
0 361
8
2
8
0 1284
8
2
8
0 292
8
2
8
0 1503
8
2
8
0 199
8
2
8
0 1653
8
2
8
0 774
8
2
8
0 594
8
2...

result:

ok 

Test #68:

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

input:

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

output:

8
0 1256
8
2
8
0 1044
8
2
8
0 318
8
2
8
0 1277
8
2
8
0 267
8
2
8
0 997
8
2
8
0 1879
8
2
8
0 1217
8
2
8
0 140
8
2
8
0 1583
8
2
8
0 505
8
2
8
0 1779
8
2
8
0 1435
8
2
8
0 416
8
2
8
0 1645
8
2
8
0 1454
8
2
8
1 1454
8
0 361
8
2
8
0 1284
8
2
8
0 292
8
2
8
0 1503
8
2
8
0 199
8
2
8
1 199
8
0 1653
8
2
8
0 77...

result:

ok 

Test #69:

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

input:

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

output:

8
0 1256
8
2
8
0 1044
8
2
8
0 318
8
2
8
0 1277
8
2
8
0 267
8
2
8
0 997
8
2
8
0 1879
8
2
8
0 1217
8
2
8
0 140
8
2
8
0 1583
8
2
8
0 505
8
2
8
0 1779
8
2
8
0 1435
8
2
8
0 416
8
2
8
0 1645
8
2
8
0 1454
8
2
8
1 1454
8
0 361
8
2
8
0 1284
8
2
8
0 292
8
2
8
0 1503
8
2
8
0 199
8
2
8
1 199
8
0 1653
8
2
8
0 77...

result:

ok 

Test #70:

score: 74.87
Acceptable Answer
time: 19ms
memory: 7972kb

input:

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

output:

8
0 1256
8
2
8
0 1044
8
2
8
0 318
8
2
8
0 1277
8
2
8
0 267
8
2
8
0 997
8
2
8
0 1879
8
2
8
0 1217
8
2
8
1 1217
8
0 140
8
2
8
0 1583
8
2
8
0 505
8
2
8
0 1779
8
2
8
0 1435
8
2
8
0 416
8
2
8
1 416
8
0 1645
8
2
8
0 1454
8
2
8
0 361
8
2
8
0 1284
8
2
8
0 292
8
2
8
0 1503
8
2
8
1 1503
8
0 199
8
2
8
0 1653
8...

result:

points 0.99826666670 points  0.99826666670

Test #71:

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

input:

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

output:

8
0 1256
8
2
8
0 1044
8
2
8
0 318
8
2
8
0 1277
8
2
8
0 267
8
2
8
0 997
8
2
8
0 1879
8
2
8
0 1217
8
2
8
1 1217
8
0 140
8
2
8
0 1583
8
2
8
0 505
8
2
8
0 1779
8
2
8
0 1435
8
2
8
0 416
8
2
8
1 416
8
0 1645
8
2
8
0 1454
8
2
8
0 361
8
2
8
0 1284
8
2
8
0 292
8
2
8
0 1503
8
2
8
1 1503
8
0 199
8
2
8
0 1653
8...

result:

points 0.99826666670 points  0.99826666670

Test #72:

score: 68.64
Acceptable Answer
time: 11ms
memory: 10004kb

input:

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

output:

8
0 1256
8
2
8
0 1044
8
2
8
0 318
8
2
8
0 1277
8
2
8
0 267
8
2
8
0 997
8
2
8
0 1879
8
2
8
0 1217
8
2
8
0 140
8
2
8
0 1583
8
2
8
0 505
8
2
8
0 1779
8
2
8
0 1435
8
2
8
0 416
8
2
8
0 1645
8
2
8
0 1454
8
2
8
1 1454
8
0 361
8
2
8
0 1284
8
2
8
0 292
8
2
8
0 1503
8
2
8
0 199
8
2
8
1 199
8
0 1653
8
2
8
0 77...

result:

points 0.91520 points  0.91520

Test #73:

score: 68.55
Acceptable Answer
time: 7ms
memory: 10264kb

input:

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

output:

8
0 699
8
2
8
0 135
8
2
8
0 1637
8
2
8
0 641
8
2
8
0 1906
8
2
8
0 333
8
2
8
0 403
8
2
8
0 1589
8
2
8
0 957
8
2
8
1 957
8
0 1635
8
2
8
0 1159
8
2
8
0 508
8
2
8
0 197
8
2
8
0 299
8
2
8
0 129
8
2
8
1 129
8
0 711
8
2
8
0 999
8
2
8
0 286
8
2
8
0 289
8
2
8
0 1632
8
2
8
0 80
8
2
8
0 561
8
2
8
0 1095
8
2
8
...

result:

points 0.9140 points  0.9140

Test #74:

score: 61.06
Acceptable Answer
time: 10ms
memory: 8056kb

input:

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

output:

8
0 699
8
2
8
0 135
8
2
8
0 1637
8
2
8
0 641
8
2
8
0 1906
8
2
8
0 333
8
2
8
0 403
8
2
8
0 1983
8
2
8
0 957
8
2
8
0 1635
8
2
8
1 1635
8
0 1159
8
2
8
0 508
8
2
8
0 197
8
2
8
0 299
8
2
8
0 129
8
2
8
1 129
8
0 711
8
2
8
0 999
8
2
8
0 286
8
2
8
0 289
8
2
8
0 1632
8
2
8
0 80
8
2
8
0 561
8
2
8
0 1095
8
2
8...

result:

points 0.81413333330 points  0.81413333330

Test #75:

score: 61.06
Acceptable Answer
time: 14ms
memory: 10008kb

input:

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

output:

8
0 699
8
2
8
0 135
8
2
8
0 1637
8
2
8
0 641
8
2
8
0 1906
8
2
8
0 333
8
2
8
0 403
8
2
8
0 1983
8
2
8
0 957
8
2
8
0 1635
8
2
8
1 1635
8
0 1159
8
2
8
0 508
8
2
8
0 197
8
2
8
0 299
8
2
8
0 129
8
2
8
1 129
8
0 711
8
2
8
0 999
8
2
8
0 286
8
2
8
0 289
8
2
8
0 1632
8
2
8
0 80
8
2
8
0 561
8
2
8
0 1095
8
2
8...

result:

points 0.81413333330 points  0.81413333330

Test #76:

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

input:

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

output:

8
0 877
8
2
8
0 1130
8
2
8
0 477
8
2
8
0 465
8
2
8
0 1069
8
2
8
0 1677
8
2
8
0 36
8
2
8
0 685
8
2
8
0 723
8
2
8
0 53
8
2
8
0 703
8
2
8
0 1849
8
2
8
0 768
8
2
8
0 236
8
2
8
0 1850
8
2
8
0 1706
8
2
8
1 1706
8
0 829
8
2
8
0 127
8
2
8
0 346
8
2
8
0 502
8
2
8
0 1337
8
2
8
1 1337
8
0 1527
8
2
8
0 1559
8
2...

result:

points 0.99853333330 points  0.99853333330

Test #77:

score: 74.89
Acceptable Answer
time: 0ms
memory: 8056kb

input:

1970
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
2
2
1
1
1
1
1
1
2
2
2
2
1
1
1
2
2
1
2
2
2
1
2
2
2
2
2
1
2
1
1
2
2
2
2
1
1
2
1
2
2
2
1
2
2
2
2
1
2
2
2
1
2
1
1
2
1
2
1
2
2
2
1
2
2
1
1
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
1
2
2
2
1
2
1
1
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 877
8
2
8
0 1130
8
2
8
0 477
8
2
8
0 465
8
2
8
0 1069
8
2
8
0 1677
8
2
8
0 36
8
2
8
0 685
8
2
8
0 723
8
2
8
0 53
8
2
8
0 703
8
2
8
0 1849
8
2
8
0 768
8
2
8
1 768
8
0 236
8
2
8
0 1850
8
2
8
0 1706
8
2
8
0 829
8
2
8
0 127
8
2
8
0 346
8
2
8
1 346
8
0 502
8
2
8
1 502
8
0 1337
8
2
8
1 1337
8
0 1527
8...

result:

points 0.99853333330 points  0.99853333330

Test #78:

score: 68.62
Acceptable Answer
time: 21ms
memory: 10088kb

input:

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

output:

8
0 877
8
2
8
0 1130
8
2
8
0 477
8
2
8
0 465
8
2
8
0 1069
8
2
8
0 1677
8
2
8
0 36
8
2
8
0 685
8
2
8
1 685
8
0 723
8
2
8
0 53
8
2
8
0 703
8
2
8
0 1849
8
2
8
0 768
8
2
8
0 236
8
2
8
0 1850
8
2
8
0 1706
8
2
8
1 1706
8
0 829
8
2
8
0 127
8
2
8
1 127
8
0 346
8
2
8
1 346
8
0 502
8
2
8
0 1337
8
2
8
0 1527
8...

result:

points 0.91493333330 points  0.91493333330

Test #79:

score: 68.6
Acceptable Answer
time: 31ms
memory: 10008kb

input:

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

output:

8
0 877
8
2
8
0 1130
8
2
8
0 477
8
2
8
0 465
8
2
8
0 1069
8
2
8
0 1677
8
2
8
0 36
8
2
8
0 685
8
2
8
1 685
8
0 723
8
2
8
0 53
8
2
8
0 703
8
2
8
0 1849
8
2
8
0 768
8
2
8
0 236
8
2
8
0 1850
8
2
8
0 1706
8
2
8
1 1706
8
0 829
8
2
8
0 127
8
2
8
1 127
8
0 346
8
2
8
1 346
8
0 502
8
2
8
0 1337
8
2
8
0 1527
8...

result:

points 0.91466666670 points  0.91466666670

Test #80:

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

input:

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

output:

8
0 1300
8
2
8
0 297
8
2
8
0 1477
8
2
8
0 1163
8
2
8
0 846
8
2
8
0 1151
8
2
8
0 1629
8
2
8
0 1716
8
2
8
0 1978
8
2
8
0 1849
8
2
8
0 425
8
2
8
0 1808
8
2
8
0 1864
8
2
8
0 142
8
2
8
0 1835
8
2
8
0 63
8
2
8
1 63
8
0 29
8
2
8
0 724
8
2
8
0 1220
8
2
8
0 1638
8
2
8
0 150
8
2
8
0 274
8
2
8
0 1414
8
2
8
0 1...

result:

ok 

Test #81:

score: 75
Accepted
time: 23ms
memory: 10028kb

input:

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

output:

8
0 1300
8
2
8
0 297
8
2
8
0 1477
8
2
8
0 1163
8
2
8
0 846
8
2
8
0 1151
8
2
8
0 1629
8
2
8
0 1716
8
2
8
0 1978
8
2
8
0 1849
8
2
8
0 425
8
2
8
0 1808
8
2
8
0 1864
8
2
8
0 142
8
2
8
0 1835
8
2
8
0 63
8
2
8
1 63
8
0 29
8
2
8
0 724
8
2
8
0 1220
8
2
8
0 1638
8
2
8
0 150
8
2
8
0 274
8
2
8
0 1414
8
2
8
0 1...

result:

ok 

Test #82:

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

input:

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

output:

8
0 1300
8
2
8
0 297
8
2
8
0 1477
8
2
8
0 1163
8
2
8
0 846
8
2
8
0 1151
8
2
8
0 1629
8
2
8
0 1716
8
2
8
0 1978
8
2
8
0 1849
8
2
8
0 425
8
2
8
0 1808
8
2
8
0 1864
8
2
8
1 1864
8
0 142
8
2
8
0 1835
8
2
8
0 63
8
2
8
1 63
8
0 29
8
2
8
0 724
8
2
8
0 1220
8
2
8
1 1220
8
0 1638
8
2
8
0 150
8
2
8
0 274
8
2
...

result:

points 0.99893333330 points  0.99893333330

Test #83:

score: 74.92
Acceptable Answer
time: 4ms
memory: 10036kb

input:

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

output:

8
0 1300
8
2
8
0 297
8
2
8
0 1477
8
2
8
0 1163
8
2
8
0 846
8
2
8
0 1151
8
2
8
0 1629
8
2
8
0 1716
8
2
8
1 1716
8
0 1978
8
2
8
0 1849
8
2
8
0 425
8
2
8
0 1808
8
2
8
0 1864
8
2
8
0 142
8
2
8
0 1835
8
2
8
0 63
8
2
8
1 63
8
0 29
8
2
8
0 724
8
2
8
0 1220
8
2
8
0 1638
8
2
8
0 150
8
2
8
1 150
8
0 274
8
2
8...

result:

points 0.99893333330 points  0.99893333330

Test #84:

score: 42.68
Acceptable Answer
time: 13ms
memory: 10240kb

input:

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

output:

8
0 98
8
2
8
0 297
8
2
8
1 297
8
0 323
8
2
8
1 323
8
0 83
8
2
8
1 83
8
0 453
8
2
8
1 453
8
0 429
8
2
8
1 429
8
0 272
8
2
8
1 272
8
0 243
8
2
8
1 243
8
0 302
8
2
8
1 302
8
0 121
8
2
8
1 121
8
0 425
8
2
8
0 186
8
2
8
1 186
8
0 30
8
2
8
1 30
8
0 142
8
2
8
1 142
8
0 114
8
2
8
1 114
8
0 63
8
2
8
1 63
8
0...

result:

points 0.56906666670 points  0.56906666670

Test #85:

score: 31.15
Acceptable Answer
time: 21ms
memory: 9992kb

input:

1834
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 365
8
2
8
0 45
8
2
8
1 45
8
0 251
8
2
8
1 251
8
0 51
8
2
8
0 1610
8
2
8
1 1610
8
0 1115
8
2
8
1 1115
8
0 1210
8
2
8
1 1210
8
0 398
8
2
8
1 398
8
0 599
8
2
8
1 599
8
0 1786
8
2
8
0 1054
8
2
8
1 1054
8
0 1043
8
2
8
1 1043
8
0 1789
8
2
8
1 1789
8
0 1699
8
2
8
0 1337
8
2
8
1 1337
8
0 1512
8
2
8
1 15...

result:

points 0.41533333330 points  0.41533333330

Test #86:

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

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 365
8
2
8
0 45
8
2
8
1 45
8
0 251
8
2
8
0 1860
8
2
8
1 1860
8
0 1610
8
2
8
1 1610
8
0 1115
8
2
8
1 1115
8
0 1210
8
2
8
1 1210
8
0 398
8
2
8
1 398
8
0 599
8
2
8
1 599
8
0 1786
8
2
8
1 1786
8
0 1054
8
2
8
1 1054
8
0 1043
8
2
8
1 1043
8
0 1789
8
2
8
1 1789
8
0 1699
8
2
8
1 1699
8
0 1337
8
2
8
1 133...

result:

ok 

Test #87:

score: 75
Accepted
time: 5ms
memory: 9996kb

input:

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

output:

8
0 365
8
2
8
0 45
8
2
8
1 45
8
0 251
8
2
8
1 251
8
0 1860
8
2
8
0 1610
8
2
8
0 1115
8
2
8
0 1210
8
2
8
0 398
8
2
8
1 398
8
0 599
8
2
8
1 599
8
0 1786
8
2
8
0 1054
8
2
8
0 1043
8
2
8
0 1789
8
2
8
0 1699
8
2
8
0 1337
8
2
8
0 1512
8
2
8
0 1720
8
2
8
0 1093
8
2
8
0 189
8
2
8
1 189
8
0 1282
8
2
8
0 1208...

result:

ok 

Test #88:

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

input:

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

output:

8
0 365
8
2
8
0 45
8
2
8
0 251
8
2
8
0 1860
8
2
8
0 1610
8
2
8
1 1610
8
0 1115
8
2
8
1 1115
8
0 1210
8
2
8
1 1210
8
0 398
8
2
8
0 599
8
2
8
0 1786
8
2
8
1 1786
8
0 1054
8
2
8
1 1054
8
0 1043
8
2
8
1 1043
8
0 1789
8
2
8
1 1789
8
0 1699
8
2
8
1 1699
8
0 1337
8
2
8
1 1337
8
0 1512
8
2
8
1 1512
8
0 1720...

result:

ok 

Test #89:

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

input:

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

output:

8
0 62
8
2
8
0 530
8
2
8
0 1578
8
2
8
1 1578
8
0 1479
8
2
8
0 370
8
2
8
1 370
8
0 45
8
2
8
1 45
8
0 510
8
2
8
0 1972
8
2
8
1 1972
8
0 1787
8
2
8
1 1787
8
0 579
8
2
8
0 1365
8
2
8
0 1322
8
2
8
0 1494
8
2
8
0 698
8
2
8
0 1074
8
2
8
0 326
8
2
8
1 326
8
0 1777
8
2
8
1 1777
8
0 820
8
2
8
0 1096
8
2
8
0 3...

result:

ok