QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#588890#6774. Ancient Machine 2Kevin530797 31ms4400kbC++201.7kb2024-09-25 15:04:522024-09-25 15:04:52

Judging History

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

  • [2024-09-25 15:04:52]
  • 评测
  • 测评结果:97
  • 用时:31ms
  • 内存:4400kb
  • [2024-09-25 15:04:52]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
#include"ancient2.h"
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
const int n=1000;
bitset<1005> bs[1005],bs2[1005];
bool ins(bitset<1005> b)
{
	for(int i=0;i<n;i++)
		if(b[i])
		{
			if(!bs[i][i])
			{
				bs[i]=b;
				return true;
			}
			b^=bs[i];
		}
	return false;
}
int query(int N,int x,int y)
{
	int M=x*2;
	vector<int> A(M),B(M);
	for(int i=0;i<x;i++)
		for(int j=0;j<2;j++)
		{
			A[i*2+j]=((i+1)%x*2+j);
			if(i==y)
				B[i*2+j]=((i+1)%x*2+1-j);
			else
				B[i*2+j]=((i+1)%x*2+j);
		}
	return Query(M,A,B)&1;
}
string Solve(int N)
{
	int tot=0;
	for(int i=1;i<=N&&tot<N;i++)
		for(int j=0;j<i&&tot<N;j++)
		{
			bitset<1005> b;
			for(int k=0;k<N;k++)
				if(k%i==j)
					b[k]=1;
			if(ins(b))
			{
				bs2[tot]=b;
				bs2[tot++][N]=query(N,i,j);
			}
		}
	for(int i=0;i<N;i++)
	{
		if(!bs2[i][i])
		{
			for(int j=i+1;j<N;j++)
				if(bs2[j][i])
				{
					swap(bs2[i],bs2[j]);
					break;
				}
		}
		for(int j=0;j<N;j++)
			if(i!=j&&bs2[j][i])
				bs2[j]^=bs2[i];
	}
	string ret;
	for(int i=0;i<N;i++)
		ret+=(char)('0'+bs2[i][N]);
	return ret;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 97
Acceptable Answer

Test #1:

score: 97
Acceptable Answer
time: 24ms
memory: 4120kb

input:

1000
1
0
3
2
1
0
1
1
1
0
8
8
12
12
13
13
12
12
1
0
1
0
2
3
3
2
3
3
0
0
0
0
21
21
21
21
20
20
21
20
20
21
8
9
8
8
24
24
25
24
25
25
24
24
25
25
24
24
12
12
13
13
12
13
20
21
21
20
21
20
21
21
16
16
17
16
17
17
17
17
28
28
29
29
28
29
29
29
29
29
28
28
28
29
28
28
21
21
20
20
20
21
24
25
24
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #2:

score: 97
Acceptable Answer
time: 22ms
memory: 4084kb

input:

1000
0
1
2
2
0
1
0
1
0
0
9
9
12
13
12
12
13
13
1
1
1
1
2
3
3
3
3
3
1
0
1
0
20
20
21
20
21
21
21
21
20
20
8
9
9
8
25
25
25
25
24
24
24
25
25
25
25
25
13
12
12
12
12
12
21
21
20
21
21
21
20
20
17
17
17
17
16
17
16
17
28
28
29
28
28
29
28
28
28
28
29
29
29
28
29
28
21
21
20
21
21
21
25
24
25
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #3:

score: 97
Acceptable Answer
time: 14ms
memory: 4060kb

input:

1000
1
0
2
3
1
0
1
0
1
0
9
9
12
12
13
13
12
13
0
0
1
0
2
2
3
2
3
3
0
0
0
1
20
21
21
20
21
20
21
20
20
21
8
8
9
8
25
24
24
24
25
25
24
24
25
24
25
24
12
12
12
13
12
12
21
20
20
20
20
20
21
20
16
17
16
16
16
17
17
16
29
29
29
28
29
28
28
28
29
29
29
28
28
29
29
29
20
20
20
20
20
21
24
25
24
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #4:

score: 97
Acceptable Answer
time: 25ms
memory: 4156kb

input:

1000
0
1
3
2
0
0
0
1
0
1
9
9
12
13
12
12
12
13
1
0
0
1
2
2
3
3
3
3
0
1
0
1
21
21
20
21
21
21
20
21
20
21
9
8
8
8
24
25
25
25
25
25
24
24
25
24
24
25
13
13
13
13
12
12
21
20
21
20
20
20
21
21
16
17
17
17
16
17
16
16
29
28
28
28
29
28
29
29
28
29
28
28
29
29
28
28
20
21
21
20
21
20
25
24
25
24
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #5:

score: 97
Acceptable Answer
time: 28ms
memory: 4060kb

input:

1000
0
0
3
3
1
1
0
1
0
1
8
8
13
13
12
13
12
12
1
0
0
1
2
2
3
2
3
3
1
0
0
1
21
21
20
21
20
20
20
21
20
21
8
8
8
8
25
24
25
25
24
25
24
24
24
25
24
24
12
12
13
12
12
12
21
20
20
20
20
20
20
21
17
16
17
16
17
16
17
16
28
29
28
29
29
29
28
29
28
28
29
29
29
28
28
29
21
21
20
20
21
21
25
25
24
24
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #6:

score: 97
Acceptable Answer
time: 20ms
memory: 4400kb

input:

1000
0
1
2
2
0
1
0
0
1
1
8
8
12
13
13
12
13
13
0
0
1
1
2
3
3
3
3
3
1
1
1
1
20
21
20
21
20
21
20
21
20
21
8
8
8
8
24
24
24
24
25
25
25
25
24
24
25
24
13
13
13
13
12
12
20
20
20
20
20
21
21
21
17
17
16
17
17
17
16
16
29
29
28
29
28
29
28
29
29
29
29
29
28
28
29
29
20
21
20
21
20
21
24
24
24
24
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #7:

score: 97
Acceptable Answer
time: 24ms
memory: 3972kb

input:

1000
0
1
2
2
1
1
1
1
0
1
9
9
12
12
12
13
12
13
1
1
0
0
3
3
3
3
2
3
1
0
1
1
20
21
20
20
20
20
20
20
20
21
9
9
9
9
25
24
24
24
25
24
24
25
24
25
25
25
12
13
13
13
13
13
21
21
20
20
21
21
21
21
17
17
16
16
16
16
16
16
28
28
29
29
29
28
28
28
28
29
28
28
28
29
28
28
20
20
20
20
20
21
24
25
25
25
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #8:

score: 97
Acceptable Answer
time: 26ms
memory: 4120kb

input:

1000
1
1
2
3
0
1
0
1
0
0
8
9
13
13
12
13
12
12
0
0
1
0
3
2
3
2
3
2
1
0
1
1
21
20
20
21
20
21
20
21
21
20
8
8
8
8
24
25
24
25
24
25
24
24
25
25
24
25
12
12
12
12
12
13
20
21
21
20
21
20
21
20
16
17
16
17
17
16
17
16
28
29
28
29
28
29
28
29
28
29
28
29
28
28
29
29
21
21
21
21
21
20
24
25
24
25
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #9:

score: 97
Acceptable Answer
time: 26ms
memory: 4100kb

input:

1000
1
0
3
3
0
1
1
0
0
0
9
9
13
13
12
13
13
12
0
1
0
0
2
3
2
3
2
2
1
1
1
1
21
20
21
20
21
21
21
21
20
20
9
8
9
9
24
24
24
25
24
25
25
25
25
25
25
24
13
13
13
13
13
13
20
20
20
20
20
20
20
21
16
16
16
17
16
17
16
16
28
29
28
28
28
28
29
28
29
29
29
28
29
29
29
28
20
21
20
21
20
21
25
25
25
24
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #10:

score: 97
Acceptable Answer
time: 21ms
memory: 4168kb

input:

1000
0
0
3
3
1
1
0
0
0
0
8
8
12
12
12
13
13
13
1
1
1
1
2
2
2
2
2
3
0
0
0
0
20
20
20
20
20
21
21
21
21
21
8
8
8
8
25
25
25
25
25
25
24
24
24
24
24
24
12
12
12
12
12
12
20
20
20
20
20
21
21
21
16
16
16
16
17
17
17
17
28
28
28
28
28
28
28
29
29
29
29
29
29
29
29
29
20
20
20
20
20
20
25
25
25
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #11:

score: 97
Acceptable Answer
time: 22ms
memory: 4380kb

input:

1000
0
0
3
2
1
1
0
0
0
0
9
9
13
13
13
12
12
12
0
0
0
0
2
3
3
3
3
2
0
0
0
0
21
21
21
21
21
20
20
20
20
20
8
8
8
8
24
24
24
24
24
24
25
25
25
25
25
25
12
12
12
12
12
12
21
21
21
21
21
20
20
20
17
17
17
17
16
16
16
16
29
29
29
29
29
29
29
28
28
28
28
28
28
28
29
29
20
20
20
20
20
20
24
24
24
24
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #12:

score: 97
Acceptable Answer
time: 20ms
memory: 4376kb

input:

1000
0
1
2
3
1
0
0
1
1
0
9
9
12
13
13
12
12
13
1
1
1
1
3
3
3
3
3
2
0
0
1
0
21
21
21
21
20
21
21
21
20
20
8
9
9
8
24
24
25
24
24
25
24
25
24
24
24
25
13
12
12
12
13
12
21
20
21
20
20
21
21
21
16
16
17
16
17
16
16
16
28
28
29
29
29
29
29
29
29
29
28
28
28
29
29
28
20
21
21
21
21
20
25
25
24
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #13:

score: 97
Acceptable Answer
time: 10ms
memory: 4344kb

input:

1000
0
1
2
2
1
1
1
1
1
1
8
9
12
13
13
13
12
12
0
0
1
0
3
3
3
2
2
3
1
1
0
0
21
21
20
21
21
20
20
20
20
21
8
8
8
8
25
25
24
25
25
25
25
24
24
25
24
25
13
12
12
13
13
12
21
20
20
21
20
21
21
21
16
17
17
17
16
17
17
16
29
28
29
29
28
28
28
29
28
28
29
28
29
29
29
29
20
21
20
20
20
20
25
24
25
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #14:

score: 97
Acceptable Answer
time: 31ms
memory: 4088kb

input:

1000
1
0
2
2
1
0
1
0
0
0
9
8
12
13
12
13
12
13
0
1
1
0
3
2
2
3
2
3
1
0
1
1
20
21
20
20
21
21
20
20
20
20
8
8
8
8
25
24
24
25
24
24
25
25
25
24
24
25
13
13
13
13
12
12
21
21
20
21
21
21
21
20
16
17
17
16
17
17
16
17
28
28
29
28
29
28
29
28
28
28
28
28
29
28
29
29
21
20
20
21
21
20
24
25
25
25
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #15:

score: 97
Acceptable Answer
time: 28ms
memory: 4092kb

input:

1000
1
0
3
2
0
0
1
0
1
1
8
9
12
12
12
13
12
13
1
0
1
0
3
3
2
2
2
2
1
1
0
0
21
21
21
21
21
20
21
21
21
20
9
8
9
8
24
24
24
25
24
24
25
25
25
25
24
24
12
12
12
13
12
13
20
20
20
20
20
20
20
20
16
17
16
17
17
16
17
17
29
28
28
29
29
28
28
29
29
29
28
29
28
28
29
28
20
20
21
20
20
20
24
25
24
24
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #16:

score: 97
Acceptable Answer
time: 23ms
memory: 4152kb

input:

1000
0
0
3
2
0
0
0
0
0
0
9
8
12
13
12
13
12
13
1
0
1
0
2
3
2
3
2
3
0
0
0
0
20
21
20
21
20
21
20
21
20
21
8
8
8
8
25
24
25
24
25
24
25
24
25
24
25
24
12
12
12
12
12
12
20
21
20
21
20
21
20
21
17
16
17
16
17
16
17
16
28
29
28
29
28
29
28
29
28
29
28
29
28
29
29
29
20
20
20
20
20
20
25
24
25
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #17:

score: 97
Acceptable Answer
time: 23ms
memory: 4380kb

input:

1000
0
0
3
3
0
0
0
0
0
0
8
9
13
12
13
12
13
12
0
1
0
1
2
2
3
2
3
2
0
0
0
0
21
20
21
20
21
20
21
20
21
20
8
8
8
8
24
25
24
25
24
25
24
25
24
25
24
25
12
12
12
12
12
12
21
20
21
20
21
20
21
20
16
17
16
17
16
17
16
17
29
28
29
28
29
28
29
28
29
28
29
28
29
28
29
29
20
20
20
20
20
20
24
25
24
25
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #18:

score: 97
Acceptable Answer
time: 21ms
memory: 4092kb

input:

1000
1
0
2
3
0
1
1
1
0
0
9
9
13
12
13
13
12
12
1
1
0
1
2
2
2
2
3
2
0
1
0
0
20
20
21
21
21
20
20
21
20
20
9
9
9
9
24
25
25
24
24
24
25
25
25
25
24
24
13
12
12
12
13
13
21
20
21
21
21
20
21
21
16
16
16
17
16
16
17
16
28
28
29
28
28
29
29
28
29
28
29
29
28
28
28
28
21
21
21
20
20
20
25
24
25
25
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #19:

score: 97
Acceptable Answer
time: 19ms
memory: 4084kb

input:

1000
1
0
3
2
0
1
1
0
1
0
8
9
13
12
13
12
12
12
0
0
0
1
3
3
2
2
3
2
1
1
0
1
21
20
20
21
20
21
21
21
20
20
9
9
9
8
25
24
24
24
25
25
24
25
24
25
25
25
12
13
12
12
12
13
20
21
20
21
20
20
21
21
16
17
17
17
17
16
17
17
29
29
29
28
29
28
28
29
29
28
29
28
28
29
28
29
20
21
21
20
21
21
24
25
24
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #20:

score: 97
Acceptable Answer
time: 18ms
memory: 4028kb

input:

1000
0
0
2
3
0
1
1
1
0
0
8
8
12
12
13
12
12
13
0
1
0
1
2
3
3
2
3
3
0
0
0
1
21
20
21
21
21
20
21
21
21
21
9
8
8
8
24
25
25
25
25
24
25
24
25
25
24
24
12
13
13
13
13
13
20
21
21
21
21
20
21
20
16
16
16
16
16
16
16
16
28
29
28
29
28
28
28
29
29
29
29
28
29
29
29
28
20
21
20
20
20
21
24
24
25
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #21:

score: 97
Acceptable Answer
time: 28ms
memory: 4344kb

input:

1000
1
0
3
2
1
0
0
1
0
1
8
9
13
12
12
12
13
12
0
0
1
0
3
2
3
3
2
3
1
0
0
1
21
21
21
21
21
20
21
21
21
21
8
9
9
8
24
25
24
25
25
24
24
25
24
25
24
24
12
13
13
13
13
13
21
21
21
20
21
21
20
20
16
16
16
16
16
17
16
16
29
28
28
28
28
29
28
28
28
29
29
29
28
29
29
29
21
20
20
21
20
20
24
24
25
24
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #22:

score: 97
Acceptable Answer
time: 26ms
memory: 4080kb

input:

1000
1
1
2
3
1
0
0
0
0
1
9
9
12
13
13
12
12
12
0
0
1
1
3
3
2
2
3
3
1
1
1
0
21
21
21
20
21
20
21
20
20
20
9
8
9
8
24
24
24
25
24
24
24
24
24
24
24
25
13
13
12
13
12
12
20
21
20
20
21
20
20
21
17
17
16
17
16
17
16
17
28
28
29
29
29
29
28
28
29
29
29
28
29
28
28
28
20
20
20
20
20
20
25
24
24
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #23:

score: 97
Acceptable Answer
time: 27ms
memory: 4100kb

input:

1000
1
1
3
2
0
1
0
0
0
1
9
8
12
13
12
13
13
12
0
0
1
0
2
2
3
2
2
3
1
0
0
0
21
20
21
20
20
20
21
20
21
21
9
9
8
9
24
24
25
24
24
24
25
25
25
24
25
24
13
12
12
13
12
12
21
20
21
21
20
21
20
21
17
16
16
16
16
16
16
17
29
28
28
28
28
29
29
29
28
28
28
28
28
28
29
28
21
20
20
20
20
20
25
24
25
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #24:

score: 97
Acceptable Answer
time: 27ms
memory: 4092kb

input:

1000
0
0
3
2
1
0
0
0
1
0
8
9
12
13
13
13
12
13
1
0
0
0
2
2
3
3
2
3
0
1
1
0
21
21
20
20
21
20
20
20
20
20
8
9
9
9
24
24
24
25
24
25
24
24
24
25
25
25
13
13
12
12
13
12
20
20
21
21
20
20
20
20
16
16
17
16
17
17
16
17
28
29
28
29
29
29
28
29
28
28
28
29
29
28
28
29
21
20
21
21
21
21
25
25
24
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #25:

score: 97
Acceptable Answer
time: 26ms
memory: 4036kb

input:

1000
1
0
3
3
1
0
1
1
0
0
8
9
12
12
12
12
13
12
0
1
1
0
3
3
2
2
2
3
0
0
1
1
21
21
20
21
20
20
20
21
20
21
9
9
9
9
24
24
25
25
24
25
25
25
25
25
24
24
13
13
13
12
13
12
21
20
20
20
21
20
21
20
16
16
16
16
17
17
16
16
28
29
28
28
28
28
28
28
29
29
29
29
28
29
28
29
20
21
20
20
20
20
25
24
24
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #26:

score: 97
Acceptable Answer
time: 27ms
memory: 4084kb

input:

1000
1
0
2
3
1
0
0
0
1
0
8
9
12
13
12
12
12
12
1
0
1
0
2
2
2
2
2
2
1
1
1
1
21
21
20
21
21
20
21
20
20
20
9
8
8
9
24
24
24
25
25
25
24
25
24
24
24
24
13
13
13
13
12
13
21
20
21
21
21
20
21
21
17
16
16
17
17
17
16
17
29
29
28
28
29
28
29
28
28
29
29
28
29
29
29
29
21
20
20
21
21
21
25
24
24
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #27:

score: 97
Acceptable Answer
time: 23ms
memory: 4092kb

input:

1000
0
0
2
3
0
0
0
0
1
0
9
8
12
12
13
12
12
13
0
1
0
0
3
2
3
3
2
3
1
0
0
1
21
21
20
20
20
20
20
21
20
21
9
8
8
9
25
24
24
25
24
25
25
25
24
24
25
25
13
13
12
12
13
12
21
20
21
20
21
21
21
20
16
17
17
16
16
16
16
16
29
28
29
29
29
29
28
29
29
28
28
28
28
28
29
28
21
21
21
21
20
21
24
24
24
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #28:

score: 97
Acceptable Answer
time: 23ms
memory: 4092kb

input:

1000
1
0
2
2
0
0
0
0
0
1
8
8
13
12
13
13
12
13
1
0
1
1
2
3
2
2
3
2
1
0
1
1
20
20
20
21
21
20
20
21
20
20
9
9
8
9
24
24
25
24
24
25
24
24
25
24
25
25
12
13
13
13
12
12
20
21
20
21
21
21
21
20
16
17
17
17
16
17
16
17
29
29
28
28
28
29
29
29
29
29
28
29
29
29
29
28
20
21
20
21
20
20
25
25
24
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #29:

score: 97
Acceptable Answer
time: 15ms
memory: 4092kb

input:

1000
0
0
3
2
1
0
0
1
1
1
9
8
12
12
13
12
13
13
1
0
0
1
2
2
2
2
3
2
1
0
1
0
21
20
20
20
21
20
21
20
20
20
8
8
8
8
25
25
24
24
24
24
25
24
25
24
25
25
12
13
12
12
12
12
20
21
21
21
20
21
21
21
16
17
16
16
16
17
16
17
28
28
28
28
28
28
28
28
29
29
29
29
29
28
29
29
21
21
20
21
20
21
24
24
25
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #30:

score: 97
Acceptable Answer
time: 19ms
memory: 4092kb

input:

1000
0
1
3
3
0
0
0
0
0
0
8
9
13
12
13
13
13
13
0
1
1
0
3
3
3
3
2
3
0
0
0
1
20
21
21
21
20
21
20
21
20
20
9
8
8
9
24
24
24
24
24
24
24
24
25
25
24
25
13
13
12
13
13
12
20
20
21
20
20
20
20
21
16
17
17
17
17
16
17
17
28
28
29
28
29
29
28
28
28
29
28
28
28
28
28
28
20
20
21
20
21
21
24
25
25
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #31:

score: 97
Acceptable Answer
time: 31ms
memory: 4156kb

input:

1000
1
0
2
2
0
0
1
0
0
1
9
9
12
13
13
13
13
13
1
1
1
0
2
2
2
2
3
2
1
1
0
0
20
20
20
21
20
20
21
20
21
20
8
8
9
8
25
25
24
25
24
25
25
24
25
25
24
25
13
13
12
13
12
13
21
21
21
20
21
21
20
20
16
16
16
17
17
16
17
16
28
29
28
28
29
28
29
29
29
28
28
29
28
28
29
28
20
21
21
21
21
20
24
24
24
25
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #32:

score: 97
Acceptable Answer
time: 31ms
memory: 4340kb

input:

1000
0
0
3
2
1
1
0
1
1
1
8
9
13
13
13
12
12
12
0
0
1
0
3
3
3
3
2
3
0
1
0
0
20
20
20
21
20
20
20
20
21
20
8
9
8
9
24
25
25
24
25
25
25
24
24
25
25
25
13
13
13
13
12
12
20
21
21
20
21
20
21
20
16
17
16
16
16
16
16
16
28
28
29
28
29
29
29
29
28
29
29
28
28
28
29
28
20
21
21
20
21
21
24
25
24
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #33:

score: 97
Acceptable Answer
time: 22ms
memory: 4080kb

input:

1000
0
0
2
3
0
1
1
1
0
0
9
8
12
12
12
12
13
13
0
0
1
1
3
2
3
2
3
3
1
0
0
0
20
21
20
20
20
21
20
20
20
21
9
9
9
8
25
24
24
24
24
25
25
24
24
24
24
24
12
13
13
12
12
13
20
20
20
20
21
20
20
21
16
16
17
17
16
17
17
16
29
28
28
29
28
28
29
29
29
29
29
29
29
29
28
29
21
20
20
20
21
21
24
25
25
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #34:

score: 97
Acceptable Answer
time: 26ms
memory: 4092kb

input:

1000
0
0
3
3
1
1
0
0
0
0
9
9
12
13
12
12
12
13
1
0
0
0
2
3
2
3
3
3
0
1
0
1
21
20
20
21
21
21
20
21
20
21
8
8
8
9
24
24
25
25
25
25
24
25
24
24
25
25
12
13
13
13
12
13
20
20
21
20
20
20
20
20
17
16
17
16
16
17
16
17
29
29
29
28
29
29
28
29
29
28
28
28
28
28
28
28
21
21
21
20
20
20
25
24
24
25
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #35:

score: 97
Acceptable Answer
time: 23ms
memory: 4376kb

input:

1000
0
0
2
3
1
1
1
1
1
0
9
9
13
12
13
13
12
13
0
1
1
0
3
2
2
2
2
3
1
0
1
0
20
20
21
20
20
20
20
20
21
20
8
9
8
9
24
25
25
25
25
24
25
24
24
24
25
25
13
13
12
12
13
13
21
20
20
21
20
20
21
20
16
16
17
16
17
17
17
17
29
29
28
29
28
29
28
29
28
28
29
29
28
29
28
28
20
21
21
20
21
21
25
25
25
24
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #36:

score: 97
Acceptable Answer
time: 25ms
memory: 4088kb

input:

1000
0
1
3
3
0
1
0
0
1
0
9
8
12
13
12
13
13
12
1
0
0
0
2
3
2
2
3
2
0
1
0
0
21
20
20
21
21
20
20
21
21
20
8
8
9
8
24
24
24
25
24
25
25
24
25
25
25
24
12
13
13
13
13
12
21
21
21
20
20
21
20
21
17
17
17
16
17
16
16
16
29
28
28
29
29
29
29
29
29
28
29
28
28
29
28
28
20
21
21
20
20
21
25
24
25
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #37:

score: 97
Acceptable Answer
time: 25ms
memory: 4384kb

input:

1000
0
1
3
2
1
1
1
0
0
1
9
9
12
13
13
13
13
12
0
0
0
0
2
3
2
2
2
2
0
1
0
0
20
20
21
20
21
20
21
21
20
20
8
8
9
9
25
25
24
24
24
24
25
24
24
25
24
24
12
13
13
13
12
13
21
20
20
20
20
21
20
20
16
16
16
17
17
17
17
17
28
29
29
29
29
28
29
28
29
29
29
29
28
29
29
28
20
21
20
20
20
21
25
24
24
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #38:

score: 97
Acceptable Answer
time: 20ms
memory: 4080kb

input:

1000
0
0
2
3
0
1
1
1
0
0
8
9
13
13
12
13
12
13
0
0
1
1
2
2
3
2
3
2
1
0
1
0
20
20
20
21
20
21
20
21
20
20
8
8
9
9
24
25
25
25
25
24
25
24
25
25
24
25
12
12
13
12
12
12
20
20
20
20
21
21
20
21
17
16
16
16
16
17
17
17
28
28
29
29
29
28
28
28
28
28
28
28
29
28
29
29
21
21
20
21
20
20
25
24
24
24
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #39:

score: 97
Acceptable Answer
time: 28ms
memory: 4348kb

input:

1000
0
0
3
2
1
0
1
0
1
1
9
9
13
13
13
13
13
13
1
1
0
1
3
2
2
2
2
2
1
1
0
1
20
21
20
20
20
21
20
20
20
20
9
8
8
8
24
24
24
25
24
24
24
25
24
25
25
24
12
12
12
13
12
12
21
21
20
21
20
20
20
20
16
17
16
16
16
17
17
16
28
28
29
29
28
28
28
29
29
28
29
29
29
28
29
28
21
20
21
21
20
20
25
24
24
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #40:

score: 97
Acceptable Answer
time: 31ms
memory: 4084kb

input:

1000
0
1
2
3
1
1
0
0
1
0
9
8
13
13
13
13
12
13
0
0
0
0
3
3
3
2
3
3
0
0
1
1
21
20
21
20
20
20
20
21
21
21
9
9
9
8
24
24
25
24
24
25
25
24
24
25
24
24
13
12
13
12
13
13
20
20
21
20
20
20
21
21
16
17
17
16
16
16
17
16
29
28
29
29
29
29
28
28
28
29
28
28
28
29
29
28
20
21
21
20
20
21
24
24
25
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #41:

score: 97
Acceptable Answer
time: 27ms
memory: 4084kb

input:

1000
0
0
3
3
1
0
1
0
0
1
9
8
12
13
12
13
13
13
0
0
1
1
2
2
3
2
3
3
1
0
0
1
20
20
20
20
20
20
20
21
21
20
8
9
9
9
24
25
24
25
24
24
25
25
24
24
25
25
13
12
13
13
13
13
20
20
21
21
21
20
21
20
16
17
17
17
17
16
16
16
29
29
28
29
29
28
29
28
29
29
29
28
28
28
29
29
20
21
21
21
20
21
25
25
24
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #42:

score: 97
Acceptable Answer
time: 31ms
memory: 4084kb

input:

1000
0
1
3
2
0
0
1
0
1
0
8
8
12
13
13
12
12
12
0
1
0
1
2
2
2
3
2
3
1
0
1
0
21
21
21
21
21
21
21
21
20
20
8
9
8
9
24
24
25
25
25
24
25
25
25
24
25
24
12
12
13
12
13
12
20
21
20
21
21
20
20
21
16
17
16
16
17
17
16
17
29
29
28
28
28
29
28
29
29
28
29
28
29
28
28
29
20
21
21
20
21
20
24
25
24
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #43:

score: 97
Acceptable Answer
time: 25ms
memory: 4060kb

input:

1000
0
1
2
2
1
0
0
1
1
0
9
8
13
13
13
12
12
13
0
0
0
1
3
3
2
2
3
2
0
1
0
0
20
20
21
21
21
21
20
21
21
21
9
9
9
9
24
25
24
25
25
25
24
25
24
25
25
25
13
12
12
13
13
13
20
21
21
20
20
20
20
21
16
16
16
16
16
17
16
16
28
29
28
28
29
29
29
29
28
28
28
29
28
28
29
28
20
21
20
20
20
21
25
24
25
24
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #44:

score: 97
Acceptable Answer
time: 27ms
memory: 4148kb

input:

1000
0
0
3
2
1
0
1
0
0
1
9
9
12
13
12
13
13
12
1
0
0
1
3
2
3
2
3
2
1
0
0
1
21
20
21
21
21
21
21
21
20
20
8
8
9
8
24
25
24
25
24
25
25
24
24
24
25
25
13
12
13
13
13
13
21
21
21
21
21
20
21
20
17
16
17
16
17
17
17
17
28
28
28
28
29
28
29
28
28
29
29
29
28
28
29
29
20
21
21
20
21
21
25
24
25
24
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #45:

score: 97
Acceptable Answer
time: 27ms
memory: 4376kb

input:

1000
0
1
2
3
1
1
0
0
0
0
8
8
13
13
12
13
13
12
0
0
1
1
3
2
3
3
2
3
0
1
0
1
20
21
21
21
21
21
20
21
20
20
8
8
8
9
25
25
24
25
25
24
24
25
25
24
24
25
12
12
12
13
13
13
20
21
21
20
21
20
20
20
17
16
17
17
16
16
17
16
29
28
28
28
29
28
29
29
28
29
28
28
29
29
28
28
21
20
20
21
21
20
25
25
24
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #46:

score: 97
Acceptable Answer
time: 27ms
memory: 4104kb

input:

1000
1
0
3
2
0
0
0
1
1
1
8
8
12
12
12
13
12
12
0
1
0
1
3
3
3
2
3
2
0
0
0
1
21
20
20
21
21
20
21
21
20
21
9
9
9
8
25
25
24
24
24
25
24
25
24
25
25
24
13
13
13
12
12
13
21
21
20
21
21
21
20
21
16
17
17
17
17
17
16
16
29
29
28
28
28
28
29
29
29
28
28
29
29
29
29
29
21
20
21
21
20
20
24
25
25
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #47:

score: 97
Acceptable Answer
time: 20ms
memory: 4080kb

input:

1000
1
0
2
2
0
1
0
0
1
1
8
8
13
13
12
12
13
13
0
0
1
1
3
3
2
2
3
3
1
1
0
0
20
21
20
21
21
20
20
20
20
21
8
8
9
8
25
25
25
24
25
25
25
24
24
25
25
25
13
12
13
13
13
12
20
21
20
20
20
20
21
20
17
16
17
17
17
17
16
17
29
29
29
28
29
28
29
29
29
29
28
28
29
29
28
29
21
21
20
21
21
21
24
24
25
24
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #48:

score: 97
Acceptable Answer
time: 22ms
memory: 4376kb

input:

1000
1
0
2
3
0
0
0
0
1
1
8
8
13
12
13
13
13
13
0
0
1
0
2
2
3
2
3
3
0
0
0
1
20
20
21
20
20
20
20
20
20
21
9
9
8
8
25
24
25
25
25
25
24
24
24
25
25
24
13
13
12
13
13
13
20
21
20
21
20
20
21
21
16
16
17
16
16
16
16
17
28
28
28
29
29
28
28
29
28
29
28
28
28
29
28
29
20
21
21
20
21
20
24
24
24
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #49:

score: 97
Acceptable Answer
time: 31ms
memory: 4124kb

input:

1000
1
0
2
2
0
0
0
1
0
1
9
9
13
13
12
13
13
12
0
0
0
0
2
2
3
2
2
3
1
1
1
1
21
21
20
20
21
21
21
20
20
20
9
8
8
9
25
24
25
25
24
25
25
24
24
25
25
25
13
13
13
13
13
12
21
21
21
21
21
20
20
20
16
17
16
17
16
17
17
17
29
29
28
29
29
28
29
29
29
29
29
29
29
29
28
29
21
20
21
20
21
20
24
24
24
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #50:

score: 97
Acceptable Answer
time: 25ms
memory: 4084kb

input:

1000
0
0
2
2
1
0
1
1
0
0
9
9
13
13
12
12
12
13
1
0
1
1
3
3
2
3
2
2
1
1
0
1
20
21
20
20
20
20
20
20
20
21
9
8
9
8
24
24
24
24
24
24
25
24
25
24
24
25
12
13
12
12
13
12
20
21
20
21
21
21
21
21
17
16
17
16
17
17
16
17
29
29
29
29
28
29
29
29
28
28
28
29
29
29
28
28
21
21
21
21
21
21
25
24
25
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #51:

score: 97
Acceptable Answer
time: 25ms
memory: 4100kb

input:

1000
0
1
2
2
0
0
1
0
1
1
8
9
13
13
12
13
12
13
1
0
1
1
3
3
2
2
2
3
0
1
1
0
20
20
21
21
21
21
21
21
20
21
8
9
9
9
24
24
25
24
24
24
25
24
25
24
24
25
13
12
12
13
13
13
20
21
21
21
20
21
21
21
17
17
17
17
16
16
16
17
29
28
28
28
28
28
29
29
29
28
29
28
28
28
29
29
20
20
20
20
20
20
25
24
25
24
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #52:

score: 97
Acceptable Answer
time: 22ms
memory: 4380kb

input:

1000
0
1
2
3
0
1
0
0
0
1
9
9
13
13
12
13
13
13
0
1
1
1
3
2
2
2
3
3
0
0
0
1
20
21
20
21
20
20
21
21
21
21
8
8
8
8
25
25
24
25
24
24
25
24
25
25
24
24
13
13
12
13
12
13
20
21
20
20
21
21
21
20
17
16
17
17
17
16
16
17
29
28
28
28
29
28
28
28
28
28
28
29
29
29
28
28
20
21
20
20
20
20
24
25
25
25
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #53:

score: 97
Acceptable Answer
time: 18ms
memory: 4168kb

input:

1000
0
0
2
2
1
1
1
0
0
0
8
8
12
13
12
13
13
13
1
0
0
1
2
3
3
3
3
3
0
1
1
0
21
21
20
21
20
21
20
20
20
21
8
9
9
9
25
25
25
25
25
24
25
24
25
24
24
24
13
12
12
12
12
13
21
20
20
21
21
20
21
21
17
17
17
17
16
17
16
16
28
28
29
28
28
28
29
29
29
28
28
28
29
29
29
28
21
21
21
21
20
21
24
25
24
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #54:

score: 97
Acceptable Answer
time: 25ms
memory: 4080kb

input:

1000
0
1
2
3
0
1
0
0
1
0
8
9
12
13
12
13
12
13
1
0
0
0
2
2
3
3
3
3
1
0
1
1
21
21
20
21
21
20
20
21
21
20
9
8
8
9
25
25
24
25
24
24
24
25
25
25
25
24
13
12
12
13
13
13
21
20
20
21
20
21
20
20
17
17
17
16
17
17
17
17
28
29
28
28
28
29
28
28
28
28
29
28
28
28
29
28
21
20
20
21
20
21
25
25
24
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #55:

score: 97
Acceptable Answer
time: 22ms
memory: 4156kb

input:

1000
1
1
2
3
0
0
0
1
0
0
9
9
13
13
12
12
13
12
0
1
0
0
3
2
3
2
2
2
0
0
1
1
20
21
21
21
20
20
21
20
20
21
8
9
9
9
24
25
24
24
24
24
24
24
24
25
24
25
12
12
12
12
12
13
21
20
20
20
20
21
20
20
17
16
16
16
16
16
16
16
28
28
28
29
29
29
29
29
28
28
28
29
28
29
28
28
20
21
20
21
21
20
24
24
24
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #56:

score: 97
Acceptable Answer
time: 24ms
memory: 4168kb

input:

1000
0
0
3
2
1
0
1
0
0
0
9
8
12
12
13
12
13
13
1
0
0
1
2
2
2
2
3
3
0
0
1
0
20
21
21
21
20
20
20
21
20
21
8
9
8
9
25
25
24
24
25
25
25
24
25
25
25
25
13
13
13
12
13
12
21
20
21
21
21
20
20
21
16
17
17
17
17
16
17
17
28
28
29
29
29
28
28
29
28
28
28
29
28
28
29
29
20
20
21
20
20
21
25
25
24
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #57:

score: 97
Acceptable Answer
time: 22ms
memory: 4084kb

input:

1000
0
0
2
3
0
1
1
0
0
1
9
9
12
13
13
12
13
13
1
0
0
1
2
3
3
3
3
2
0
0
1
0
21
20
21
21
21
20
20
21
20
20
9
9
9
8
24
24
25
24
24
25
25
24
24
24
24
25
12
12
13
13
12
12
20
21
21
20
20
21
21
21
16
17
16
17
17
16
16
16
29
29
29
28
29
29
28
28
29
29
29
28
28
29
29
28
20
20
21
21
20
20
25
25
25
25
25
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #58:

score: 97
Acceptable Answer
time: 22ms
memory: 4104kb

input:

1000
1
1
3
2
1
0
1
1
1
1
9
9
13
13
13
13
12
12
1
0
1
1
2
2
2
2
3
2
1
1
1
1
21
21
20
21
21
21
20
21
21
20
9
8
8
9
25
24
25
25
25
24
24
25
24
24
24
24
13
13
13
13
12
12
20
20
20
20
21
20
21
20
16
17
17
16
17
16
17
17
28
29
29
29
28
28
28
29
29
29
29
29
28
29
28
29
20
20
21
21
21
21
24
25
25
24
24
25
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #59:

score: 97
Acceptable Answer
time: 27ms
memory: 4372kb

input:

1000
0
0
2
3
0
1
1
1
1
0
9
8
13
12
12
12
12
13
1
1
1
0
3
3
3
2
2
3
1
1
1
1
21
21
21
21
21
21
20
21
20
20
8
9
8
8
25
24
25
25
25
24
25
24
25
25
25
24
12
13
12
12
12
13
20
21
21
21
20
21
21
20
16
16
16
16
17
16
17
16
28
28
29
28
29
28
29
28
29
29
29
29
29
28
29
29
21
20
20
20
21
20
25
25
25
24
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #60:

score: 97
Acceptable Answer
time: 27ms
memory: 4152kb

input:

1000
0
1
2
2
0
1
1
0
0
1
8
9
13
13
13
13
13
12
0
1
1
1
2
2
2
3
3
2
0
1
0
0
21
20
21
20
21
21
21
20
21
21
8
9
9
9
25
25
24
24
24
24
24
24
25
24
25
25
12
13
12
12
13
12
21
21
21
20
21
20
20
21
16
16
17
17
17
17
16
16
29
29
29
28
28
28
28
29
28
29
28
29
29
28
29
28
21
21
20
20
20
21
24
25
25
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #61:

score: 97
Acceptable Answer
time: 31ms
memory: 4092kb

input:

1000
1
0
2
3
1
0
0
0
0
1
9
9
13
12
13
13
13
13
1
0
0
0
3
3
3
3
3
3
1
0
0
0
20
21
20
20
20
20
20
21
20
21
9
8
8
8
25
24
25
25
25
25
24
24
25
25
25
25
12
12
12
12
12
12
20
20
20
20
21
21
21
20
17
16
16
17
17
16
17
16
28
29
29
28
29
29
29
29
29
28
28
29
29
29
29
28
21
21
21
20
20
21
25
24
25
25
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #62:

score: 97
Acceptable Answer
time: 26ms
memory: 4156kb

input:

1000
1
1
2
2
0
1
0
1
1
1
8
8
13
12
13
12
13
13
0
1
1
1
2
2
3
2
2
2
1
0
0
0
21
20
21
21
21
21
20
21
20
20
8
8
9
8
24
24
24
24
25
24
25
25
24
24
24
25
13
12
12
13
12
12
21
21
20
20
20
21
20
21
16
17
17
16
17
17
17
16
29
29
28
29
28
29
29
28
28
28
28
28
29
29
28
29
21
21
21
20
20
21
25
24
25
25
24
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)

Test #63:

score: 97
Acceptable Answer
time: 12ms
memory: 4120kb

input:

1000
1
0
2
2
0
0
0
0
0
1
9
9
13
13
12
12
12
12
1
0
1
0
2
2
3
3
3
3
0
1
0
0
21
21
21
20
20
21
20
20
21
20
9
9
8
8
24
24
25
25
24
25
25
25
24
25
24
25
12
13
13
13
12
12
21
21
21
20
21
21
20
21
17
17
17
16
17
16
17
17
29
28
29
28
29
29
28
29
29
29
29
28
29
29
28
29
21
20
21
20
20
21
25
25
24
25
25
24
2...

output:

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

result:

points 0.970 points  0.970 Accepted (partial scores)