QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#139175#6774. Ancient Machine 2Lynkcat#82 33ms4240kbC++171.8kb2023-08-12 18:54:022024-07-04 01:39:57

Judging History

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

  • [2024-07-04 01:39:57]
  • 评测
  • 测评结果:82
  • 用时:33ms
  • 内存:4240kb
  • [2023-08-12 18:54:02]
  • 提交

answer

#include<bits/stdc++.h>
#include "ancient2.h"
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) (int)((x).size())
//#define int ll
//#define N
using namespace std;
namespace 
{
    bitset<1005>f[1005];
    int n;
    int tot;
}
void qry(int x,int y)
{
    for (int i=2;i*i<=x;i++)
        if (x%i==0) return;
    ++tot;
    if (tot>1000) return;
    int m=x*2;
    vector<int>a(m,0),b(m,0);
    for (int i=0;i<x;i++)
        a[i]=(i+1)%x;
    for (int i=x;i<x+x;i++)
        a[i]=x+(i+1)%x;
    for (int i=0;i<x;i++)
        b[i]=(i+1)%x;
    for (int i=x;i<x+x;i++)
        b[i]=x+(i+1)%x;
    b[y]=x+(y+1)%x;
    b[x+y]=(y+1)%x;
    for (int i=0;i<n;i++)
        if (i%x==y) f[tot-1][i]=1;
    int o=Query(m,a,b);
    if (o<x) f[tot-1][n]=0;
    else f[tot-1][n]=1;
    // cout<<x<<" "<<y<<" "<<f[tot-1][n]<<" "<<o<<endl;
}
std::string Solve(int N)
{
    n=N;tot=0;
    for (int i=2;i<=1000;i++)
    {
        for (int j=(i==2)^1;j<i;j++)
        {
            qry(i,j);
        }
    }
    for (int i=0;i<n;i++)
    {
        if (!f[i][i])
        {
            for (int j=i+1;j<n;j++)
                if (f[j][i]) 
                {swap(f[j],f[i]);break;
                }
        }
        // if (!f[i][i])
        // {
        //     cout<<"wtf!! "<<i<<endl;
        // }
        for (int j=i+1;j<n;j++)
            if (f[j][i]) f[j]^=f[i];
    }
    for (int i=n-1;i>=0;i--)
        for (int j=0;j<i;j++)
            if (f[j][i]) f[j]^=f[i];
    string ans="";
    for (int i=0;i<n;i++)
        ans+=char('0'+f[i][n]);
    // cout<<ans<<endl;
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 82
Acceptable Answer

Test #1:

score: 82
Acceptable Answer
time: 20ms
memory: 4212kb

input:

1000
0
2
1
1
5
5
0
0
6
13
13
6
6
13
21
21
21
10
10
21
10
10
21
21
12
25
12
25
25
12
12
25
25
12
12
12
14
31
31
14
31
31
31
31
31
14
14
14
31
14
14
31
31
12
31
31
31
12
31
12
12
12
12
31
31
12
31
31
12
12
34
34
11
34
34
11
34
11
34
11
34
11
34
34
34
34
11
11
11
11
11
11
43
14
43
43
14
43
14
43
43
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #2:

score: 82
Acceptable Answer
time: 28ms
memory: 3932kb

input:

1000
2
2
1
1
5
0
0
5
13
6
6
13
13
13
10
21
10
21
21
21
21
10
10
21
25
25
25
12
12
12
25
25
25
25
25
25
14
31
14
14
31
14
14
14
14
31
31
31
14
31
14
14
12
31
12
31
12
31
31
12
12
12
31
12
12
31
31
12
12
12
11
34
34
34
34
34
34
11
34
34
34
34
11
11
34
34
11
34
11
34
11
34
43
43
43
43
14
43
43
14
14
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #3:

score: 82
Acceptable Answer
time: 32ms
memory: 3932kb

input:

1000
0
2
4
1
0
5
0
5
6
13
13
6
13
6
21
21
10
21
10
21
10
10
21
10
12
12
12
25
25
12
12
25
12
25
12
12
31
31
14
31
14
14
14
31
31
31
14
14
31
31
31
31
31
12
31
12
12
31
12
12
12
31
12
31
31
31
12
12
12
12
34
11
11
34
34
34
11
34
11
11
11
34
11
11
34
34
34
34
34
34
34
34
43
43
14
14
14
14
43
14
43
14
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #4:

score: 82
Acceptable Answer
time: 33ms
memory: 3936kb

input:

1000
2
2
1
4
5
0
5
0
13
6
6
6
13
6
21
10
21
21
21
10
21
10
21
21
25
25
25
25
25
12
12
25
12
12
25
25
14
14
14
31
14
31
31
14
31
14
14
31
31
14
14
31
12
31
12
12
31
31
12
31
12
12
12
12
31
12
31
12
31
12
34
11
34
11
11
34
34
34
11
11
34
11
11
11
34
34
11
11
34
11
11
11
43
14
43
14
43
43
14
14
43
14
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #5:

score: 82
Acceptable Answer
time: 21ms
memory: 4216kb

input:

1000
0
0
4
1
5
0
5
0
13
6
13
6
6
13
21
10
21
10
10
10
21
10
21
21
12
25
25
12
25
12
12
12
25
12
12
25
31
14
31
31
31
14
31
14
14
31
31
31
14
14
31
31
31
12
12
12
12
31
12
31
31
12
12
12
31
12
12
31
12
31
34
11
11
11
34
34
11
11
11
11
34
34
34
34
34
11
11
11
11
11
11
11
43
14
43
43
14
43
14
14
14
14
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #6:

score: 82
Acceptable Answer
time: 33ms
memory: 4184kb

input:

1000
2
2
1
1
0
5
5
0
13
13
6
13
13
6
21
10
21
10
21
10
21
10
21
21
12
12
12
25
25
25
25
12
12
25
12
25
31
14
31
14
31
14
31
31
31
31
31
14
14
31
31
31
12
12
12
12
12
12
31
31
12
31
12
31
31
31
31
12
31
12
34
34
11
34
11
34
11
11
11
34
11
11
34
34
34
34
34
34
34
34
34
34
14
43
43
43
43
43
43
43
14
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #7:

score: 82
Acceptable Answer
time: 27ms
memory: 3884kb

input:

1000
2
2
1
1
5
0
5
5
6
6
13
6
13
6
21
10
10
10
10
10
10
10
21
10
12
12
12
25
12
12
25
12
25
25
25
12
14
31
31
31
14
14
14
14
31
14
14
14
31
14
14
31
31
31
31
31
12
31
12
31
31
12
12
12
12
12
12
12
31
12
11
11
34
34
11
34
11
34
11
11
34
34
34
34
34
34
11
34
34
34
34
34
43
14
43
14
43
14
14
14
14
14
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #8:

score: 82
Acceptable Answer
time: 25ms
memory: 4220kb

input:

1000
2
0
4
1
5
0
0
0
13
6
13
6
6
6
10
10
21
10
21
10
21
21
10
10
25
12
25
12
25
12
12
25
25
12
25
25
31
14
31
14
31
14
31
14
31
14
31
14
14
31
31
31
31
12
31
12
31
12
31
12
31
12
31
31
31
31
31
31
31
31
34
11
11
11
11
11
11
11
11
11
34
34
11
34
11
34
11
34
11
34
11
34
43
14
43
43
14
43
43
14
43
14
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #9:

score: 82
Acceptable Answer
time: 23ms
memory: 3952kb

input:

1000
0
2
4
4
0
0
0
0
13
6
13
13
6
13
10
21
10
21
21
21
21
10
10
21
12
12
25
12
25
25
25
25
25
25
12
12
31
14
14
14
14
31
14
31
31
31
14
31
31
31
14
31
31
31
12
12
31
12
31
12
31
31
31
12
12
31
31
31
31
31
11
11
11
11
34
34
34
11
11
11
11
34
34
11
34
34
34
34
34
34
11
11
43
14
43
43
43
43
43
43
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #10:

score: 82
Acceptable Answer
time: 23ms
memory: 4028kb

input:

1000
0
0
4
1
0
0
0
0
6
6
13
13
13
13
10
10
10
10
21
21
21
21
21
21
25
25
25
25
25
12
12
12
12
12
12
12
14
14
14
14
14
14
31
31
31
31
31
31
31
31
31
31
31
31
31
31
31
12
12
12
12
12
12
12
12
12
12
12
12
12
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
34
34
34
34
34
34
14
14
14
14
14
14
43
43
43
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #11:

score: 82
Acceptable Answer
time: 25ms
memory: 4228kb

input:

1000
0
0
1
4
0
0
0
0
13
13
6
6
6
13
21
21
21
21
10
10
10
10
10
21
12
12
12
12
12
25
25
25
25
25
25
12
31
31
31
31
31
31
14
14
14
14
14
14
14
31
31
31
12
12
12
12
12
31
31
31
31
31
31
12
12
12
12
12
12
12
11
11
11
11
11
11
11
11
11
11
34
34
34
34
34
34
11
11
11
11
11
11
43
43
43
43
43
43
14
14
14
14
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #12:

score: 82
Acceptable Answer
time: 29ms
memory: 4240kb

input:

1000
2
2
4
4
5
5
0
0
13
13
6
6
13
13
21
21
21
10
21
21
21
10
10
21
12
25
12
12
25
12
25
12
12
12
25
12
14
31
31
31
31
31
31
31
31
14
14
14
31
31
14
14
31
12
12
31
31
12
12
12
31
12
12
31
12
12
31
12
31
12
11
34
11
34
11
34
34
11
34
11
11
34
11
34
34
11
34
11
11
11
11
34
14
14
43
14
43
43
14
14
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #13:

score: 82
Acceptable Answer
time: 33ms
memory: 3928kb

input:

1000
2
2
1
1
5
5
5
0
13
13
13
6
6
13
21
10
21
21
10
10
10
10
21
21
25
12
25
25
25
25
12
12
25
12
25
12
14
31
31
14
14
14
31
14
14
31
14
31
31
31
31
31
12
31
12
31
31
12
12
12
12
31
12
12
31
31
31
12
12
12
11
34
11
11
34
34
11
34
34
34
34
11
34
11
11
34
34
34
34
11
34
11
43
43
14
43
14
43
14
14
14
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #14:

score: 82
Acceptable Answer
time: 20ms
memory: 3928kb

input:

1000
0
2
1
4
0
0
0
0
13
6
13
6
13
6
21
10
10
21
21
10
10
10
10
10
12
12
25
12
12
25
25
25
12
12
25
25
14
31
14
31
14
31
14
14
14
14
14
31
14
31
31
31
31
31
31
12
31
12
31
12
31
12
12
31
31
12
31
12
31
31
11
34
11
34
11
34
34
11
11
11
11
11
11
34
34
34
34
11
11
11
34
34
43
14
43
43
43
14
43
43
14
14
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #15:

score: 82
Acceptable Answer
time: 26ms
memory: 3952kb

input:

1000
0
2
1
1
0
5
5
0
6
6
13
6
13
13
21
21
21
21
10
21
21
21
10
21
12
12
25
12
12
25
25
25
25
12
12
12
14
14
31
31
14
14
31
31
31
14
31
14
14
31
14
31
31
12
12
12
12
12
12
12
31
31
12
12
31
12
31
31
31
12
11
34
34
11
11
34
11
11
34
11
11
34
11
34
34
11
34
11
11
11
11
34
43
43
43
43
43
43
14
43
14
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #16:

score: 82
Acceptable Answer
time: 19ms
memory: 3928kb

input:

1000
0
0
1
4
0
0
0
0
13
6
13
6
13
13
21
10
21
10
21
10
21
10
21
21
12
25
12
25
12
25
12
25
12
25
12
12
31
14
31
14
31
14
31
14
31
14
31
14
31
31
31
31
12
31
12
31
12
31
12
31
12
31
12
12
12
12
12
12
12
12
11
11
11
11
11
11
11
11
11
11
34
11
34
11
34
11
34
11
34
11
34
11
43
14
43
14
43
14
43
14
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #17:

score: 82
Acceptable Answer
time: 26ms
memory: 4028kb

input:

1000
0
0
4
1
0
0
0
0
6
13
6
13
6
13
10
21
10
21
10
21
10
21
10
21
25
12
25
12
25
12
25
12
25
12
25
12
14
31
14
31
14
31
14
31
14
31
14
31
14
31
31
31
31
12
31
12
31
12
31
12
31
12
31
12
12
12
12
12
12
12
11
11
11
11
11
11
11
11
11
11
11
34
11
34
11
34
11
34
11
34
11
34
14
43
14
43
14
43
14
43
14
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #18:

score: 82
Acceptable Answer
time: 26ms
memory: 3956kb

input:

1000
0
2
4
1
5
0
0
5
6
13
13
6
6
6
10
21
21
21
10
10
21
10
10
21
25
25
12
12
12
25
25
25
25
12
12
25
14
31
14
14
31
31
14
31
14
31
31
14
14
14
14
31
12
31
31
31
12
31
12
12
31
12
31
12
31
12
31
31
31
12
34
11
34
34
34
11
11
11
34
11
34
34
11
34
11
11
11
34
34
34
34
34
14
14
43
43
14
43
14
14
43
14
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #19:

score: 82
Acceptable Answer
time: 27ms
memory: 3956kb

input:

1000
0
2
1
1
0
5
0
5
6
13
6
6
6
13
10
10
21
10
21
21
21
10
10
10
12
12
12
25
25
12
25
12
25
25
25
12
31
31
14
31
14
14
31
31
14
31
14
14
31
14
31
14
31
12
31
31
31
12
12
31
12
12
31
31
12
12
31
12
31
12
11
11
11
11
11
11
34
11
11
11
34
34
34
34
11
11
11
11
34
34
34
34
14
43
43
43
43
43
14
43
14
14
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #20:

score: 82
Acceptable Answer
time: 24ms
memory: 3880kb

input:

1000
0
0
4
4
5
0
0
0
6
13
6
6
13
6
10
21
21
21
10
21
21
21
21
10
25
25
25
25
12
25
12
25
25
12
12
25
31
14
31
14
14
14
31
31
31
31
14
31
31
31
14
31
12
31
12
31
12
31
31
31
12
31
12
31
12
12
31
12
12
12
34
11
11
11
11
11
34
11
34
34
34
11
34
34
34
11
11
11
11
11
11
34
43
14
43
43
43
14
43
14
43
14
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #21:

score: 82
Acceptable Answer
time: 32ms
memory: 4012kb

input:

1000
0
2
1
1
5
0
5
5
6
6
6
13
6
13
21
21
21
21
10
21
21
21
21
10
25
12
25
25
12
12
25
12
25
12
12
12
14
14
14
14
31
14
14
14
31
31
31
14
31
31
31
31
12
31
12
12
31
31
12
31
31
31
31
31
12
31
31
12
31
12
11
11
11
11
34
34
11
34
11
11
11
34
11
11
34
34
34
11
11
34
34
11
14
14
14
14
14
43
14
43
14
43
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #22:

score: 82
Acceptable Answer
time: 25ms
memory: 4220kb

input:

1000
2
0
4
1
0
0
5
0
13
13
6
6
6
13
21
21
10
21
10
21
10
10
10
10
12
12
25
12
12
12
12
12
12
12
25
25
14
31
31
31
31
14
14
31
31
31
14
31
14
14
14
31
12
12
12
31
31
31
12
31
12
31
12
12
31
12
31
12
31
12
11
11
11
34
11
34
34
11
11
11
11
11
11
11
34
34
34
11
34
34
11
34
43
43
14
43
14
14
14
14
43
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #23:

score: 82
Acceptable Answer
time: 22ms
memory: 3948kb

input:

1000
2
0
1
1
0
0
5
0
13
6
13
13
6
6
10
21
10
10
10
21
10
21
21
10
12
25
12
12
12
25
25
25
12
25
12
12
14
14
14
14
31
31
31
14
14
14
14
14
14
31
14
14
12
31
31
12
12
31
31
31
12
31
12
31
31
12
31
31
12
12
11
34
11
11
34
11
11
34
11
11
11
34
11
11
34
11
11
34
34
34
34
11
14
14
43
43
14
14
43
14
14
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #24:

score: 82
Acceptable Answer
time: 27ms
memory: 3932kb

input:

1000
0
0
1
4
0
5
0
5
13
13
13
6
13
6
21
10
10
21
10
10
10
10
10
21
12
12
25
12
25
12
12
12
25
25
25
25
31
14
31
31
31
14
31
14
14
14
31
31
14
14
31
14
31
12
12
31
31
31
31
31
31
31
31
31
12
12
31
12
12
12
11
11
11
11
34
34
34
34
11
34
34
11
34
11
34
11
11
34
11
11
34
11
14
14
14
14
14
43
14
14
43
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #25:

score: 82
Acceptable Answer
time: 29ms
memory: 3948kb

input:

1000
0
2
4
4
5
0
0
5
6
6
6
13
6
6
21
10
21
10
10
10
21
10
21
10
12
25
25
12
25
25
25
25
25
12
12
12
31
14
14
14
14
14
14
31
31
31
31
14
31
14
31
14
12
12
31
31
31
12
12
31
31
31
31
31
31
12
12
12
12
31
34
34
34
11
34
11
34
34
11
34
34
34
11
11
34
11
11
11
34
11
11
34
43
43
43
43
43
43
43
43
43
14
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #26:

score: 82
Acceptable Answer
time: 24ms
memory: 4024kb

input:

1000
0
2
4
1
0
5
0
0
13
6
6
6
6
6
21
10
21
21
10
21
10
10
10
10
12
12
25
25
25
12
25
12
12
12
12
25
31
14
14
31
14
31
14
14
31
31
14
31
31
31
31
31
12
12
12
31
31
31
31
12
31
12
12
31
31
12
31
31
31
12
11
11
11
34
34
34
34
11
34
11
11
11
11
34
34
11
34
11
11
11
34
11
14
14
43
14
43
43
43
43
14
14
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #27:

score: 82
Acceptable Answer
time: 27ms
memory: 3944kb

input:

1000
0
0
4
4
0
5
0
5
6
13
6
6
13
6
21
10
10
10
10
10
21
10
21
10
12
12
25
12
25
25
25
12
12
25
25
25
14
31
31
31
31
14
31
31
14
14
14
14
14
31
14
14
12
12
12
31
12
12
31
12
12
31
31
31
12
31
12
12
31
31
11
11
11
34
11
34
34
11
11
34
34
11
34
11
34
34
34
34
34
34
11
34
43
43
43
14
43
14
43
14
43
43
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #28:

score: 82
Acceptable Answer
time: 23ms
memory: 3936kb

input:

1000
0
2
1
4
0
0
5
0
6
13
13
6
13
13
10
10
21
21
10
10
21
10
10
10
12
25
12
12
25
12
12
25
12
25
25
12
31
14
14
14
31
31
31
31
31
14
31
31
31
31
14
14
31
12
31
12
12
12
31
12
12
31
12
31
12
12
12
12
12
31
34
11
34
34
11
34
11
11
11
34
34
34
11
11
34
34
34
34
34
34
11
11
14
43
43
43
43
14
14
43
14
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #29:

score: 82
Acceptable Answer
time: 22ms
memory: 3956kb

input:

1000
0
0
1
4
5
5
5
5
6
13
6
13
13
13
10
10
10
21
10
21
10
10
10
21
25
12
12
12
12
25
12
25
12
25
25
12
14
14
14
14
14
14
14
31
31
31
31
31
14
31
31
31
12
31
12
31
31
12
31
12
12
31
12
12
12
31
31
12
12
31
34
34
11
34
11
11
11
11
11
11
11
11
11
34
34
34
11
11
34
34
34
11
43
14
14
43
14
14
14
14
43
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #30:

score: 82
Acceptable Answer
time: 28ms
memory: 3932kb

input:

1000
2
2
4
1
0
0
0
0
6
13
13
13
13
13
21
21
21
10
21
10
21
10
10
21
12
12
12
12
12
12
12
25
25
12
25
25
14
31
14
31
31
14
14
14
31
14
14
14
14
14
14
14
31
31
31
12
12
12
12
12
12
12
12
31
12
31
12
12
31
12
11
34
34
34
11
11
34
34
11
11
11
34
11
34
11
34
11
34
11
11
11
11
14
43
14
14
14
14
43
14
43
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #31:

score: 82
Acceptable Answer
time: 19ms
memory: 3948kb

input:

1000
0
2
1
4
0
0
5
5
13
13
13
13
13
6
10
10
21
10
10
21
10
21
10
10
25
12
25
12
25
25
12
25
25
12
25
25
31
14
14
31
14
31
31
31
14
14
31
14
14
31
14
14
12
12
31
31
12
12
12
31
12
12
12
31
31
12
12
31
12
31
34
34
34
34
11
11
11
11
34
34
11
34
34
11
11
34
34
34
34
34
34
34
14
14
43
14
43
14
14
14
43
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #32:

score: 82
Acceptable Answer
time: 24ms
memory: 3884kb

input:

1000
0
0
1
4
5
5
5
5
13
13
6
6
6
13
10
10
21
10
10
10
10
21
10
10
25
25
12
25
25
25
12
12
25
25
25
12
14
31
14
31
31
31
31
14
31
31
14
14
14
31
14
14
31
12
12
31
12
31
12
12
31
12
12
12
12
12
12
12
31
31
11
11
34
11
11
34
11
34
11
11
34
34
34
11
34
34
11
34
11
34
34
34
14
14
14
43
14
14
14
14
43
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #33:

score: 82
Acceptable Answer
time: 26ms
memory: 4008kb

input:

1000
0
0
4
4
5
0
0
0
6
6
6
13
13
6
21
10
10
10
21
10
10
10
21
21
12
12
12
12
25
25
12
12
12
12
12
25
14
14
31
14
14
31
31
31
31
31
31
31
31
14
31
31
31
31
31
31
31
12
12
12
12
31
12
12
31
31
12
31
31
12
11
11
11
34
34
34
11
11
11
11
11
34
11
34
34
11
34
34
11
34
11
34
14
14
43
14
14
43
43
43
14
43
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #34:

score: 82
Acceptable Answer
time: 26ms
memory: 4016kb

input:

1000
0
0
4
1
0
0
0
0
13
6
6
6
13
6
10
10
21
21
21
10
21
10
21
10
12
25
25
25
25
12
25
12
12
25
25
25
31
31
14
31
31
14
31
31
14
14
14
14
14
14
14
31
12
12
31
31
12
31
31
31
31
12
12
31
31
12
12
12
12
31
11
34
11
34
34
34
34
34
34
11
11
34
11
34
11
11
11
11
11
34
34
34
43
43
14
14
14
43
14
43
43
43
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #35:

score: 82
Acceptable Answer
time: 26ms
memory: 4220kb

input:

1000
0
0
4
4
5
5
0
5
6
13
13
6
13
6
10
21
10
10
10
10
10
21
10
10
25
25
25
25
12
25
12
12
12
25
25
25
31
14
31
14
31
14
31
14
14
31
31
14
31
14
14
14
31
31
12
12
12
31
31
12
31
31
31
12
12
12
31
12
12
31
11
34
11
34
11
34
11
11
34
11
34
34
11
11
11
34
11
34
34
11
34
34
14
43
43
43
14
14
14
43
43
14
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #36:

score: 82
Acceptable Answer
time: 33ms
memory: 4224kb

input:

1000
2
2
4
1
0
5
0
5
13
6
13
13
6
13
10
10
21
21
10
10
21
21
10
21
12
12
25
12
25
25
12
25
25
25
12
12
14
14
31
31
31
31
31
31
14
31
14
14
31
14
14
31
12
31
31
12
12
31
31
12
12
12
31
31
31
31
31
31
31
12
34
34
11
34
34
34
34
34
11
11
11
11
34
34
34
34
11
11
11
11
11
11
43
43
14
43
43
14
43
43
43
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #37:

score: 82
Acceptable Answer
time: 25ms
memory: 3956kb

input:

1000
2
2
1
4
0
0
5
0
13
13
13
13
6
6
10
21
10
21
10
21
21
10
10
10
25
12
12
12
12
25
12
12
25
12
12
12
31
31
31
31
14
31
14
31
31
31
31
14
31
31
14
31
12
12
12
31
12
31
12
12
12
12
12
31
31
31
31
31
31
31
11
34
34
11
34
34
11
11
34
11
34
34
11
11
11
11
11
11
11
34
34
34
14
14
43
43
14
14
43
14
14
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #38:

score: 82
Acceptable Answer
time: 24ms
memory: 3928kb

input:

1000
0
0
4
4
5
0
0
0
13
6
13
6
13
6
10
10
21
10
21
10
21
10
10
21
25
25
25
25
12
25
12
25
25
12
25
12
14
31
31
31
14
14
14
14
14
14
14
31
14
31
31
14
12
12
12
12
12
12
31
12
12
12
12
31
12
12
31
12
12
12
11
34
11
11
34
34
11
11
11
11
34
11
34
34
11
11
11
11
11
34
34
34
14
43
43
14
14
14
43
43
14
14
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #39:

score: 82
Acceptable Answer
time: 25ms
memory: 3936kb

input:

1000
0
0
1
4
0
5
5
5
13
13
13
13
13
6
21
10
10
10
21
10
10
10
10
10
12
12
25
12
12
12
25
12
25
25
12
12
14
31
31
14
14
14
31
31
14
31
31
31
14
31
14
14
12
12
31
31
31
31
12
12
12
31
12
12
31
31
12
31
31
12
11
34
11
11
11
11
11
11
34
34
34
34
34
11
34
11
11
34
11
34
11
11
43
43
43
14
14
43
14
43
43
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #40:

score: 82
Acceptable Answer
time: 31ms
memory: 4212kb

input:

1000
2
2
4
4
0
5
0
5
13
13
13
6
13
13
10
21
10
10
10
10
21
21
21
21
12
25
12
12
25
25
12
12
25
12
12
12
14
31
31
31
31
14
14
14
31
14
14
14
31
31
14
14
12
31
12
31
31
31
12
31
12
31
12
31
12
31
12
12
31
31
11
11
34
11
34
11
11
11
34
11
11
34
11
11
11
34
11
34
11
11
34
11
43
43
43
43
14
43
43
43
43
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #41:

score: 82
Acceptable Answer
time: 26ms
memory: 3912kb

input:

1000
0
0
4
1
0
0
5
0
13
6
13
13
13
6
10
10
10
10
10
10
21
21
10
10
25
12
25
12
12
25
25
12
12
25
25
12
31
14
31
31
14
31
14
31
31
31
14
14
14
31
31
14
31
12
31
12
12
12
31
12
31
12
12
31
12
12
31
12
31
12
11
34
11
11
11
34
34
11
11
11
34
34
34
11
11
11
34
11
34
34
34
34
14
43
14
43
14
14
14
14
14
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #42:

score: 82
Acceptable Answer
time: 27ms
memory: 4212kb

input:

1000
2
2
1
4
0
5
0
0
13
13
6
6
6
6
21
21
21
21
21
21
21
10
10
10
12
25
25
25
12
25
25
25
12
25
12
25
31
14
14
14
31
14
31
31
14
31
14
31
14
14
31
14
31
12
31
12
12
31
12
12
12
31
31
31
31
31
12
12
12
12
11
34
11
34
11
34
34
34
34
11
34
34
34
11
11
11
34
34
11
11
11
34
14
43
43
14
43
43
43
43
43
43
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #43:

score: 82
Acceptable Answer
time: 28ms
memory: 3928kb

input:

1000
2
2
1
1
5
5
0
0
13
13
6
6
13
6
10
21
21
21
21
10
21
21
21
21
25
12
25
25
25
12
25
12
25
25
25
12
31
14
14
31
31
31
31
14
14
14
31
14
14
31
14
31
12
31
12
12
31
31
31
31
31
31
31
12
12
31
31
12
31
12
11
11
34
11
11
11
34
11
34
34
34
11
34
34
34
34
11
11
11
11
34
11
14
43
14
43
43
14
43
14
43
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #44:

score: 82
Acceptable Answer
time: 24ms
memory: 3884kb

input:

1000
0
0
1
4
0
0
5
0
13
6
13
13
6
13
10
21
21
21
21
21
21
10
10
21
25
12
25
12
25
25
12
12
12
25
25
12
14
14
14
31
14
31
14
14
31
31
31
14
14
31
31
31
12
31
12
31
31
31
12
31
31
12
31
31
12
31
31
31
12
12
11
11
11
11
11
34
11
11
34
11
34
11
11
34
34
34
11
34
11
34
11
34
14
43
14
43
43
43
43
14
14
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #45:

score: 82
Acceptable Answer
time: 32ms
memory: 4228kb

input:

1000
2
2
4
4
0
0
0
0
13
6
13
13
6
6
21
21
21
21
21
10
21
10
10
10
25
12
25
25
12
12
25
25
12
12
25
25
14
14
14
31
14
31
31
14
31
14
14
31
31
14
14
31
31
12
31
12
12
31
31
31
12
12
31
31
12
31
12
12
12
31
11
34
11
34
34
34
11
11
34
34
11
11
11
11
11
34
34
34
34
34
34
34
43
14
14
43
43
43
14
14
14
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #46:

score: 82
Acceptable Answer
time: 22ms
memory: 4212kb

input:

1000
0
2
1
1
5
5
5
0
6
6
13
6
6
6
10
10
21
21
10
21
21
10
21
21
25
12
12
12
25
12
25
12
25
25
12
25
31
14
14
14
14
31
31
31
14
14
31
31
31
31
31
31
31
31
12
31
12
31
12
31
12
31
12
31
31
12
12
12
31
12
34
11
34
34
34
11
11
11
34
11
11
34
34
11
34
11
34
11
11
34
11
34
43
43
43
43
43
43
14
43
14
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #47:

score: 82
Acceptable Answer
time: 32ms
memory: 3884kb

input:

1000
0
2
1
4
0
5
5
5
13
6
6
13
13
13
21
10
21
21
10
10
10
10
21
21
25
25
12
25
25
25
12
12
25
25
25
12
31
31
14
31
14
31
31
31
31
14
14
31
31
14
31
14
12
31
12
12
12
31
31
31
31
12
31
31
12
12
12
12
31
31
34
11
34
34
34
34
34
34
11
34
34
34
11
11
34
11
34
34
11
11
34
34
43
14
14
43
43
14
43
14
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #48:

score: 82
Acceptable Answer
time: 32ms
memory: 3956kb

input:

1000
0
2
4
1
0
5
5
5
6
13
13
13
13
6
10
21
10
10
10
10
10
10
21
21
12
25
25
25
25
12
12
12
25
25
12
12
14
14
31
31
14
14
31
14
31
14
14
14
31
14
31
31
12
12
12
31
12
12
12
12
31
31
12
31
12
31
31
31
31
31
11
11
34
11
11
34
34
11
11
34
34
34
11
11
34
11
34
11
11
34
11
11
14
43
14
43
14
14
14
43
14
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #49:

score: 82
Acceptable Answer
time: 29ms
memory: 3952kb

input:

1000
0
2
1
4
5
0
5
5
13
6
13
13
6
13
21
10
10
21
21
21
10
10
10
10
12
25
25
12
25
25
12
12
25
25
25
25
31
14
31
31
14
31
31
31
31
31
31
31
31
14
31
14
12
12
31
12
12
31
12
31
12
31
31
12
12
12
12
31
12
31
11
11
11
34
34
34
11
34
11
11
11
11
34
34
11
34
11
11
11
11
34
34
14
43
14
14
14
43
43
43
14
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #50:

score: 82
Acceptable Answer
time: 33ms
memory: 3948kb

input:

1000
0
0
1
1
5
0
0
0
13
6
6
6
13
13
21
10
10
10
10
10
10
10
21
10
12
12
12
12
12
25
12
25
12
12
25
25
31
31
31
14
31
31
31
14
14
14
31
31
31
14
14
14
12
31
31
31
31
31
31
12
12
31
31
12
12
12
12
12
31
12
11
34
11
34
11
11
11
34
11
11
11
34
34
34
11
34
34
34
11
11
34
11
14
14
14
43
43
14
14
14
14
14
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #51:

score: 82
Acceptable Answer
time: 33ms
memory: 3864kb

input:

1000
2
2
1
1
0
5
5
5
13
6
13
6
13
6
10
21
21
21
21
21
21
10
21
21
12
25
12
12
12
25
12
25
12
12
25
12
14
14
14
14
14
31
31
31
14
31
14
14
14
31
31
31
12
31
12
12
31
12
31
31
12
31
31
31
31
12
12
31
31
31
11
34
11
34
34
11
34
11
11
34
34
11
11
11
34
34
11
11
11
34
34
34
43
14
43
14
14
14
14
14
14
43
...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #52:

score: 82
Acceptable Answer
time: 26ms
memory: 3932kb

input:

1000
2
2
4
4
0
0
5
5
13
6
13
13
13
13
21
10
21
10
10
21
21
21
21
10
25
12
25
12
12
25
12
25
25
12
12
12
14
14
14
31
14
14
14
14
14
14
31
31
31
14
14
31
31
31
31
31
12
31
12
31
31
31
12
31
12
31
31
31
12
12
34
34
11
34
34
11
34
11
11
11
34
11
34
34
34
11
34
34
11
11
34
34
14
43
43
14
14
14
43
43
14
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #53:

score: 82
Acceptable Answer
time: 26ms
memory: 4228kb

input:

1000
0
0
1
1
0
0
0
5
13
6
13
13
13
6
21
10
21
10
21
10
10
10
21
21
25
25
25
25
12
25
12
25
12
12
12
25
14
31
14
14
14
31
31
31
14
14
14
31
31
31
14
31
31
12
31
12
12
12
12
31
12
12
12
31
12
31
12
31
12
12
11
34
11
34
11
34
34
34
34
34
11
34
11
34
11
34
11
11
11
34
34
34
14
43
14
43
43
43
43
43
14
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #54:

score: 82
Acceptable Answer
time: 23ms
memory: 3992kb

input:

1000
2
2
4
4
0
5
0
5
13
6
13
6
13
13
21
10
21
21
10
10
21
21
10
10
25
12
25
12
12
12
25
25
25
25
12
25
31
14
14
14
31
14
14
14
14
31
14
14
14
31
14
14
31
12
31
31
31
12
31
31
31
12
12
31
31
12
12
31
31
12
34
11
34
34
11
34
34
11
34
11
11
11
11
11
11
34
34
34
34
11
11
34
14
14
14
14
43
14
43
43
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #55:

score: 82
Acceptable Answer
time: 18ms
memory: 4020kb

input:

1000
2
0
4
1
5
0
0
0
13
6
6
13
6
6
21
21
21
10
10
21
10
10
21
10
25
12
12
12
12
12
12
12
25
12
25
12
14
14
31
31
31
31
31
14
14
14
31
14
31
14
14
14
12
12
31
31
31
12
12
12
31
31
12
12
12
31
31
12
12
12
34
11
11
11
34
11
34
11
11
11
11
11
34
11
34
11
11
11
34
34
34
11
43
43
43
14
14
43
14
43
43
14
1...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #56:

score: 82
Acceptable Answer
time: 33ms
memory: 3932kb

input:

1000
0
0
1
4
0
0
0
5
6
13
6
13
13
13
21
21
21
10
10
10
21
10
21
21
25
12
12
25
25
25
12
25
25
25
25
25
14
31
31
31
14
14
31
14
14
14
31
14
14
31
31
31
31
12
12
31
12
12
31
31
31
12
12
12
31
12
31
31
31
12
11
34
34
34
34
34
34
11
34
11
11
11
34
34
34
11
34
34
34
11
11
34
14
43
14
43
43
14
43
14
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #57:

score: 82
Acceptable Answer
time: 25ms
memory: 4024kb

input:

1000
0
0
4
4
0
0
5
0
13
13
6
13
13
6
10
21
21
21
10
10
21
10
10
21
12
25
12
12
25
25
12
12
12
12
25
12
31
31
14
31
31
14
14
31
31
31
14
14
31
31
14
14
31
31
31
31
31
12
31
31
31
12
31
12
31
12
12
31
31
31
11
34
11
11
11
11
34
11
34
11
11
11
11
11
34
11
11
11
34
11
34
34
14
14
14
14
14
14
14
14
14
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #58:

score: 82
Acceptable Answer
time: 16ms
memory: 4008kb

input:

1000
2
0
1
1
5
5
5
5
13
13
13
6
6
13
21
10
21
21
21
10
21
21
10
10
12
25
25
25
12
12
25
12
12
12
12
12
31
31
31
14
14
14
31
31
31
31
31
14
31
14
31
31
31
31
12
12
31
12
12
12
31
12
12
31
31
12
31
12
12
12
11
11
34
34
11
34
34
34
34
11
34
11
34
34
11
11
34
11
34
34
11
34
43
14
14
14
43
43
43
43
43
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #59:

score: 82
Acceptable Answer
time: 23ms
memory: 3952kb

input:

1000
0
0
4
4
5
5
0
5
6
6
6
6
13
6
21
21
21
21
21
10
21
10
10
21
12
25
25
25
12
25
12
25
25
25
12
12
14
31
14
31
14
31
14
31
31
31
31
31
14
31
31
14
31
31
12
31
12
12
31
31
12
31
31
31
12
31
12
31
12
31
11
34
34
11
11
34
11
34
11
34
34
11
34
11
34
34
11
11
34
34
34
11
43
14
14
43
43
43
43
14
14
43
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #60:

score: 82
Acceptable Answer
time: 30ms
memory: 3924kb

input:

1000
2
2
1
1
0
0
5
0
13
13
13
13
6
13
10
21
10
21
21
21
10
21
21
21
25
12
12
12
12
12
12
25
12
25
25
25
31
31
14
14
14
14
31
14
31
14
31
31
14
31
14
14
31
31
31
12
12
12
12
12
31
12
31
12
31
12
12
31
31
12
11
11
11
34
11
11
34
11
11
34
34
34
11
34
34
34
34
11
11
11
11
11
43
14
14
43
14
43
43
43
14
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #61:

score: 82
Acceptable Answer
time: 33ms
memory: 3956kb

input:

1000
0
2
4
1
0
0
5
0
6
13
13
13
13
6
21
10
10
10
10
10
21
10
21
10
12
25
25
25
25
12
12
25
25
25
25
12
31
31
14
31
31
31
31
31
14
14
31
31
31
31
14
14
12
31
31
31
12
31
31
12
12
31
12
12
12
12
31
31
31
31
34
11
11
34
34
34
11
34
11
11
34
11
34
34
34
11
34
34
11
34
34
34
43
14
14
14
43
14
14
43
14
43...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #62:

score: 82
Acceptable Answer
time: 26ms
memory: 4228kb

input:

1000
2
0
1
4
5
5
5
0
6
13
6
13
13
13
10
21
21
21
21
10
21
10
10
21
12
12
12
25
12
25
25
12
12
12
25
25
31
14
31
14
31
31
14
14
14
14
14
31
31
14
31
31
12
31
31
12
12
31
31
31
31
12
12
31
12
31
31
31
12
12
34
11
11
11
34
11
11
34
34
34
11
11
11
11
11
34
11
34
11
11
11
34
14
43
14
14
14
14
14
14
43
14...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)

Test #63:

score: 82
Acceptable Answer
time: 26ms
memory: 3932kb

input:

1000
0
2
1
4
0
0
5
0
13
6
6
6
6
13
21
21
10
10
21
10
10
21
10
10
12
25
25
12
25
25
25
12
25
12
25
12
14
31
14
31
31
14
31
31
31
31
14
31
31
14
31
14
31
12
31
31
12
12
12
31
12
12
31
31
31
12
12
12
31
12
11
11
11
11
11
34
34
34
34
11
11
34
34
11
34
34
11
34
34
34
11
11
43
14
14
14
14
14
14
14
14
14
4...

output:

Q
4
1
0
3
2
3
0
1
2
Q
4
1
0
3
2
1
2
3
0
Q
6
1
2
0
4
5
3
1
5
0
4
2
3
Q
6
1
2
0
4
5
3
1
2
3
4
5
0
Q
10
1
2
3
4
0
6
7
8
9
5
1
7
3
4
0
6
2
8
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
8
4
0
6
7
3
9
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
9
0
6
7
8
4
5
Q
10
1
2
3
4
0
6
7
8
9
5
1
2
3
4
5
6
7
8
9
0
Q
14
1
2
3
4
5
6
0
8
9
1...

result:

points 0.820 points  0.820 Accepted (partial scores)