QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#518275#4565. Rarest InsectsDan4Life#57.72 416ms118744kbC++231.4kb2024-08-13 19:04:492024-08-13 19:04:50

Judging History

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

  • [2024-08-13 19:04:50]
  • 评测
  • 测评结果:57.72
  • 用时:416ms
  • 内存:118744kb
  • [2024-08-13 19:04:49]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a), end(a)
using vi = vector<int>;
using ll = long long;
using ar2 = array<ll,2>;
using ar3 = array<ll,3>;
const int mxN = (int)2e3+10;
int n, cnt[mxN];
vi v, others;
set<int> S;
map<set<int>,int> M;

void move_in(int i){
	if(S.count(i)) return;
	S.insert(i); move_inside(i);
}

void move_out(int i){
	if(!S.count(i)) return;
	S.erase(i); move_outside(i);
}

int press(){
	if(M.count(S)) return M[S];
	return M[S] = press_button(); 
}

void dnc(int l, int r, vi query){
	if(l>r) return;
	if(l==r or !sz(query)){
		cnt[v[l]]+=sz(query);
		return;
	}
	int mid = (l+r)/2;
	vi qL, qR; qL.clear(), qR.clear();
	for(int i = l; i <= mid; i++) move_in(v[i]);
	for(auto i : query){
		move_in(i);
		if(press()==2) qL.pb(i);
		else qR.pb(i);
		move_out(i);
	}
	for(int i = l; i <= mid; i++) move_out(v[i]);
	dnc(l,mid,qL); dnc(mid+1,r,qR);
}

int min_cardinality(int N) {
	n = N; int ans = n;
	vector<int> xd(n,0); iota(all(xd),0);
	random_shuffle(all(xd));
	for(int i = 0; i < n; i++){
		move_in(xd[i]); v.pb(xd[i]);
		if(press()==2) 
			move_out(xd[i]), v.pop_back(), others.pb(xd[i]);
	}
	for(auto u : v) move_out(u);
	for(auto u : v) cnt[u]++;
	dnc(0,sz(v)-1,others);
	for(auto u : v) ans = min(ans, cnt[u]);
	return ans;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
1
2
2
2
2
2
2
2
1
2

output:

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

result:

ok 

Test #2:

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

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2
1

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
1
2
2
1
2

output:

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

result:

ok 

Test #6:

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

input:

8
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2

output:

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

result:

ok 

Test #7:

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

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
1 51
8
0 11
8
2
8
1 11
8
0 69
8
2
8
1 69
8
0 119
8
2
8
1 119
8
0 142
8
2
8
1 142
8
0 17
8
2
8
1 17
8
0 109
8
2
8
1 109
8
0 164
8
2
8
1 164
8
0 101
8
2
8
1 101
8
0 115
8
2
8
1 115
8
0 39
8
2
8
1 39
8
0 108
8
2
8
1 108
8
0 2
8
2
8
1 2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59...

result:

ok 

Test #8:

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

input:

200
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
0 39
8
2
8
0 108
8
2
8
0 2
8
2
8
0 75
8
2
8
0 56
8
2
8
0 59
8
2
8
0 166
8
2
8
0 153
8
2
8
0 116
8
2
8
0 143
8
2
8
0 86
8
2
8
0 57
8
2
8
0 133
8
2
8
0 169
8
2
8
0 192
8
2
...

result:

ok 

Test #9:

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

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
1 119
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
0 164
8
2
8
1 164
8
0 101
8
2
8
1 101
8
0 115
8
2
8
1 115
8
0 39
8
2
8
0 108
8
2
8
0 2
8
2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59
8
2
8
0 166
8
2
8
0 153
8
2
8
0 116
8
2
8
0 143
8
2
8
1 143
8
0 ...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
2
1
1
2
1
1
1
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
1 119
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
1 109
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
0 39
8
2
8
1 39
8
0 108
8
2
8
0 2
8
2
8
1 2
8
0 75
8
2
8
0 56
8
2
8
1 56
8
0 59
8
2
8
1 59
8
0 166
8
2
8
1 166
8
0 153
8
2
8
1 153
8
0 116
8
2
8
1 116
8
0...

result:

ok 

Test #11:

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

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
1 51
8
0 11
8
2
8
1 11
8
0 69
8
2
8
1 69
8
0 119
8
2
8
1 119
8
0 142
8
2
8
1 142
8
0 17
8
2
8
1 17
8
0 109
8
2
8
1 109
8
0 164
8
2
8
1 164
8
0 101
8
2
8
1 101
8
0 115
8
2
8
1 115
8
0 39
8
2
8
1 39
8
0 108
8
2
8
1 108
8
0 2
8
2
8
1 2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59...

result:

ok 

Test #12:

score: 10
Accepted
time: 5ms
memory: 5184kb

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
1 11
8
0 69
8
2
8
1 69
8
0 119
8
2
8
1 119
8
0 142
8
2
8
1 142
8
0 17
8
2
8
1 17
8
0 109
8
2
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
1 115
8
0 39
8
2
8
0 108
8
2
8
0 2
8
2
8
1 2
8
0 75
8
2
8
0 56
8
2
8
0 59
8
2
8
1 59
8
0 166
8
2
8
1 166
8
0 153
8
2
8
0 116
8
2
8
0 ...

result:

ok 

Test #13:

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

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
1 51
8
0 11
8
2
8
0 69
8
2
8
1 69
8
0 119
8
2
8
0 142
8
2
8
1 142
8
0 17
8
2
8
1 17
8
0 109
8
2
8
0 164
8
2
8
1 164
8
0 101
8
2
8
1 101
8
0 115
8
2
8
1 115
8
0 39
8
2
8
1 39
8
0 108
8
2
8
1 108
8
0 2
8
2
8
1 2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59
8
2
8
1 59
8
0 166
8
2...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
1
1
1
2
1
2
2
1
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
1 109
8
0 164
8
2
8
0 101
8
2
8
1 101
8
0 115
8
2
8
1 115
8
0 39
8
2
8
0 108
8
2
8
1 108
8
0 2
8
2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
0 59
8
2
8
1 59
8
0 166
8
2
8
1 166
8
0 153
8
2
8
1 153
8
0 116
8
2
8
0 143
...

result:

ok 

Test #15:

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

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
1 69
8
0 119
8
2
8
1 119
8
0 142
8
2
8
0 17
8
2
8
1 17
8
0 109
8
2
8
1 109
8
0 164
8
2
8
0 101
8
2
8
1 101
8
0 115
8
2
8
1 115
8
0 39
8
2
8
1 39
8
0 108
8
2
8
1 108
8
0 2
8
2
8
1 2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59
8
2
8
1 59
8
0 166
8
2
8
1 16...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
2
2
2
1
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
1 119
8
0 142
8
2
8
1 142
8
0 17
8
2
8
1 17
8
0 109
8
2
8
0 164
8
2
8
0 101
8
2
8
1 101
8
0 115
8
2
8
0 39
8
2
8
1 39
8
0 108
8
2
8
1 108
8
0 2
8
2
8
1 2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59
8
2
8
1 59
8
0 166
8
2
8
0 153
8
2
8
1 153
8...

result:

ok 

Test #17:

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

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
1 119
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
0 164
8
2
8
0 101
8
2
8
1 101
8
0 115
8
2
8
0 39
8
2
8
1 39
8
0 108
8
2
8
0 2
8
2
8
1 2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59
8
2
8
1 59
8
0 166
8
2
8
1 166
8
0 153
8
2
8
1 153
8
0 116
8
2
8
1 ...

result:

ok 

Test #18:

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

input:

196
1
1
2
1
1
1
1
2
2
2
1
2
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
1 11
8
0 69
8
2
8
0 119
8
2
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
1 109
8
0 164
8
2
8
1 164
8
0 101
8
2
8
1 101
8
0 115
8
2
8
0 39
8
2
8
1 39
8
0 108
8
2
8
0 2
8
2
8
0 75
8
2
8
0 56
8
2
8
1 56
8
0 59
8
2
8
1 59
8
0 166
8
2
8
1 166
8
0 153
8
2
8
1 153
8
0 116
8
2
8
...

result:

ok 

Test #19:

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

input:

196
1
1
1
2
1
1
2
2
1
1
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
1 69
8
0 119
8
2
8
0 142
8
2
8
0 17
8
2
8
1 17
8
0 109
8
2
8
1 109
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
1 115
8
0 39
8
2
8
0 108
8
2
8
1 108
8
0 2
8
2
8
1 2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
1 56
8
0 59
8
2
8
0 166
8
2
8
1 166
8
0 153
8
2
8
1 153
8
0 116
...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
2
1
2
2
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
1 119
8
0 142
8
2
8
0 17
8
2
8
1 17
8
0 109
8
2
8
1 109
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
0 39
8
2
8
0 108
8
2
8
0 2
8
2
8
0 75
8
2
8
0 56
8
2
8
0 59
8
2
8
0 166
8
2
8
1 166
8
0 153
8
2
8
1 153
8
0 116
8
2
8
1 116
8
0 143
8
2
8
1 143
8
0...

result:

ok 

Test #21:

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

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
0 142
8
2
8
0 17
8
2
8
1 17
8
0 109
8
2
8
1 109
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
0 39
8
2
8
0 108
8
2
8
0 2
8
2
8
0 75
8
2
8
1 75
8
0 56
8
2
8
0 59
8
2
8
0 166
8
2
8
1 166
8
0 153
8
2
8
0 116
8
2
8
0 143
8
2
8
0 86
8
2
8
1 86
8
0 57
8
2...

result:

ok 

Test #22:

score: 10
Accepted
time: 9ms
memory: 4964kb

input:

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

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
0 39
8
2
8
0 108
8
2
8
0 2
8
2
8
0 75
8
2
8
0 56
8
2
8
0 59
8
2
8
0 166
8
2
8
1 166
8
0 153
8
2
8
0 116
8
2
8
0 143
8
2
8
0 86
8
2
8
0 57
8
2
8
0 133
8
2
8
0 169
8
2
8
0 ...

result:

ok 

Test #23:

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

input:

198
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
2
1
2
1
1
1
2
1
1
1
2
2
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
1
2
1
2
1
1
1
1
1
1
1
1
1
2
2
2
1
1
1
1
2
2
2
1
1
1
2
1
2
1
2
1
2
2
1
1
2
1
1
1
2
2
2
2
1
2
1
2
1
2
2
1
1
2
1
...

output:

8
0 110
8
2
8
0 51
8
2
8
0 11
8
2
8
0 69
8
2
8
0 119
8
2
8
0 142
8
2
8
0 17
8
2
8
0 109
8
2
8
0 164
8
2
8
0 101
8
2
8
0 115
8
2
8
0 39
8
2
8
0 108
8
2
8
0 2
8
2
8
0 75
8
2
8
0 56
8
2
8
0 59
8
2
8
0 166
8
2
8
0 153
8
2
8
0 116
8
2
8
0 143
8
2
8
0 86
8
2
8
1 86
8
0 57
8
2
8
0 133
8
2
8
0 169
8
2
8
0 1...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

input:

1000
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 110
8
2
8
0 290
8
2
8
1 290
8
0 701
8
2
8
1 701
8
0 69
8
2
8
1 69
8
0 560
8
2
8
1 560
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 896
8
2
8
1 896
8
0 164
8
2
8
1 164
8
0 926
8
2
8
1 926
8
0 795
8
2
8
1 795
8
0 322
8
2
8
1 322
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
...

result:

ok 

Test #25:

score: 15
Accepted
time: 24ms
memory: 27708kb

input:

1000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
0 795
8
2
8
0 322
8
2
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
0 720
8
2
8
0 589
8
2
8
0 826
8
2
8
0 420
8
2
8
0 578
8
2
8
0 363
8
2
8
0...

result:

ok 

Test #26:

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

input:

999
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
2
1
2
1
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
1 701
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
1 926
8
0 795
8
2
8
0 322
8
2
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
1 602
8
0 929
8
2
8
0 643
8
2
8
0 720
8
2
8
0 589
8
2
8
1 589
8
0 826
8
2
8
0 420...

result:

ok 

Test #27:

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

input:

999
1
1
1
1
2
2
1
1
1
1
1
2
2
1
1
1
2
1
2
2
2
1
2
2
2
1
1
1
1
1
2
1
1
1
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
1 560
8
0 468
8
2
8
1 468
8
0 706
8
2
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
0 795
8
2
8
0 322
8
2
8
1 322
8
0 361
8
2
8
1 361
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
1 602
8
0 929
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 720
8
0 589...

result:

ok 

Test #28:

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

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
1 290
8
0 701
8
2
8
1 701
8
0 69
8
2
8
1 69
8
0 560
8
2
8
1 560
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 896
8
2
8
1 896
8
0 164
8
2
8
1 164
8
0 926
8
2
8
1 926
8
0 795
8
2
8
1 795
8
0 322
8
2
8
1 322
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
...

result:

ok 

Test #29:

score: 15
Accepted
time: 61ms
memory: 27832kb

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
1 701
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 896
8
2
8
0 164
8
2
8
1 164
8
0 926
8
2
8
1 926
8
0 795
8
2
8
1 795
8
0 322
8
2
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
1 929
8
0 643
8
2
8
0 720
8
2
8
1 720
8
0 589...

result:

ok 

Test #30:

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

input:

998
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
1 701
8
0 69
8
2
8
0 560
8
2
8
1 560
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 896
8
2
8
1 896
8
0 164
8
2
8
1 164
8
0 926
8
2
8
1 926
8
0 795
8
2
8
1 795
8
0 322
8
2
8
1 322
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
1 792
8
0 602
8
2
8
1 6...

result:

ok 

Test #31:

score: 15
Accepted
time: 39ms
memory: 7716kb

input:

998
1
1
1
1
1
1
1
2
1
1
2
2
1
1
1
1
1
1
1
2
2
1
2
2
2
1
1
1
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
1 896
8
0 164
8
2
8
0 926
8
2
8
0 795
8
2
8
1 795
8
0 322
8
2
8
1 322
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
0 720
8
2
8
1 720
8
0 589
8
2
8
1 589
8
0 826
8
2...

result:

ok 

Test #32:

score: 15
Accepted
time: 16ms
memory: 4788kb

input:

1000
1
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
1 69
8
0 560
8
2
8
0 468
8
2
8
1 468
8
0 706
8
2
8
0 896
8
2
8
1 896
8
0 164
8
2
8
1 164
8
0 926
8
2
8
1 926
8
0 795
8
2
8
1 795
8
0 322
8
2
8
1 322
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
1 792
8
0 602
8
2
8
1 602
8
0 92...

result:

ok 

Test #33:

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

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
1 560
8
0 468
8
2
8
1 468
8
0 706
8
2
8
0 896
8
2
8
1 896
8
0 164
8
2
8
1 164
8
0 926
8
2
8
1 926
8
0 795
8
2
8
0 322
8
2
8
1 322
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 567
8
2
8
0 792
8
2
8
1 792
8
0 602
8
2
8
1 602
8
0 929
8
2
8
1 929
8...

result:

ok 

Test #34:

score: 15
Accepted
time: 16ms
memory: 5436kb

input:

1000
1
1
2
1
1
2
2
2
2
2
1
2
1
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
1 701
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 896
8
2
8
1 896
8
0 164
8
2
8
1 164
8
0 926
8
2
8
1 926
8
0 795
8
2
8
0 322
8
2
8
1 322
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
0 602
8
2
8
1 602
8
0 929
8
2
8
1 929
8
0 643...

result:

ok 

Test #35:

score: 15
Accepted
time: 22ms
memory: 5600kb

input:

1000
1
1
1
2
1
1
2
1
1
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
1 69
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
1 926
8
0 795
8
2
8
1 795
8
0 322
8
2
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
0 602
8
2
8
1 602
8
0 929
8
2
8
1 929
8
0 643
8
2
8
0 72...

result:

ok 

Test #36:

score: 15
Accepted
time: 19ms
memory: 6224kb

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
1 560
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
0 795
8
2
8
0 322
8
2
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
0 602
8
2
8
1 602
8
0 929
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 720
8...

result:

ok 

Test #37:

score: 15
Accepted
time: 16ms
memory: 6428kb

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
1 69
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
1 896
8
0 164
8
2
8
0 926
8
2
8
1 926
8
0 795
8
2
8
0 322
8
2
8
0 361
8
2
8
1 361
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 720
8
0 589
8
2
8
0 ...

result:

ok 

Test #38:

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

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
1 896
8
0 164
8
2
8
0 926
8
2
8
1 926
8
0 795
8
2
8
0 322
8
2
8
1 322
8
0 361
8
2
8
0 2
8
2
8
1 2
8
0 567
8
2
8
1 567
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
0 589
8
2
8
0 8...

result:

ok 

Test #39:

score: 15
Accepted
time: 36ms
memory: 13244kb

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
1 926
8
0 795
8
2
8
1 795
8
0 322
8
2
8
1 322
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
0 720
8
2
8
1 720
8
0 589
8
2
8
0 826
8
2
8
1 826...

result:

ok 

Test #40:

score: 15
Accepted
time: 62ms
memory: 20012kb

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
0 795
8
2
8
0 322
8
2
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
1 792
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
0 720
8
2
8
0 589
8
2
8
0 826
8
2
8
0 420
8
2
8
0 578
8
2
8
0 363...

result:

ok 

Test #41:

score: 15
Accepted
time: 72ms
memory: 29512kb

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
0 795
8
2
8
0 322
8
2
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
0 720
8
2
8
0 589
8
2
8
1 589
8
0 826
8
2
8
0 420
8
2
8
0 578
8
2
8
0 363...

result:

ok 

Test #42:

score: 15
Accepted
time: 62ms
memory: 32652kb

input:

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

output:

8
0 110
8
2
8
0 290
8
2
8
0 701
8
2
8
0 69
8
2
8
0 560
8
2
8
0 468
8
2
8
0 706
8
2
8
0 896
8
2
8
0 164
8
2
8
0 926
8
2
8
0 795
8
2
8
0 322
8
2
8
0 361
8
2
8
0 2
8
2
8
0 567
8
2
8
0 792
8
2
8
0 602
8
2
8
0 929
8
2
8
0 643
8
2
8
0 720
8
2
8
0 589
8
2
8
0 826
8
2
8
0 420
8
2
8
0 578
8
2
8
0 363
8
2
8
0...

result:

ok 

Subtask #3:

score: 32.72
Acceptable Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2
1

output:

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

result:

ok 

Test #46:

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

input:

6
1
2
2
1
2
2
2
2

output:

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

result:

ok 

Test #47:

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

input:

10
1
1
2
2
2
2
2
2
2
2
1
2
2
2
1
1
2
2

output:

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

result:

ok 

Test #48:

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

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
1 1190
8
0 701
8
2
8
1 701
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
...

result:

ok 

Test #49:

score: 75
Accepted
time: 150ms
memory: 97932kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
0 420
8
2
8
0 1701
...

result:

ok 

Test #50:

score: 50.12
Acceptable Answer
time: 61ms
memory: 13788kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
1 1979
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
...

result:

points 0.66826666670 points  0.66826666670

Test #51:

score: 50.31
Acceptable Answer
time: 59ms
memory: 13796kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
1 1556
8
0...

result:

points 0.67080 points  0.67080

Test #52:

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

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
1 1190
8
0 701
8
2
8
1 701
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
...

result:

ok 

Test #53:

score: 49.99
Acceptable Answer
time: 276ms
memory: 99168kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
1 701
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0...

result:

points 0.66653333330 points  0.66653333330

Test #54:

score: 72.85
Acceptable Answer
time: 33ms
memory: 6064kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8...

result:

points 0.97133333330 points  0.97133333330

Test #55:

score: 49.99
Acceptable Answer
time: 47ms
memory: 13828kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
1 1194
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
...

result:

points 0.66653333330 points  0.66653333330

Test #56:

score: 73.27
Acceptable Answer
time: 18ms
memory: 5768kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8...

result:

points 0.97693333330 points  0.97693333330

Test #57:

score: 70.37
Acceptable Answer
time: 27ms
memory: 6408kb

input:

1999
1
2
1
1
2
1
1
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1204
8
2
8
0 1190
8
2
8
1 1190
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0 1416
8
2
8
1 1...

result:

points 0.93826666670 points  0.93826666670

Test #58:

score: 68.12
Acceptable Answer
time: 19ms
memory: 7048kb

input:

1997
1
1
1
1
2
1
2
2
2
1
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0 1416
8...

result:

points 0.90826666670 points  0.90826666670

Test #59:

score: 66.53
Acceptable Answer
time: 17ms
memory: 7708kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0 1416
8
2
8
0 1194
8
2
8...

result:

points 0.88706666670 points  0.88706666670

Test #60:

score: 64.9
Acceptable Answer
time: 3ms
memory: 8044kb

input:

1996
1
1
1
1
1
1
2
2
1
2
1
2
2
1
2
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0 1416
8
2
8
0 1194
8
2
8
1 1194
8...

result:

points 0.86533333330 points  0.86533333330

Test #61:

score: 61.64
Acceptable Answer
time: 40ms
memory: 9108kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0 1416
8
2
8
1 1416
8
0 1194
8
2
8
0 643
8
2
8
0 72...

result:

points 0.82186666670 points  0.82186666670

Test #62:

score: 48.36
Acceptable Answer
time: 39ms
memory: 14928kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
1 1979
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
1 720
8
0 1575
8
2
8
0 1556
8
2
8
0 ...

result:

points 0.64480 points  0.64480

Test #63:

score: 40.47
Acceptable Answer
time: 86ms
memory: 23832kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
1 1556
8
0 420
8
2
...

result:

points 0.53960 points  0.53960

Test #64:

score: 35.46
Acceptable Answer
time: 117ms
memory: 39888kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 720
8
0 1575
8
2
8
0 1556
8
2
8
0 4...

result:

points 0.47280 points  0.47280

Test #65:

score: 32.72
Acceptable Answer
time: 180ms
memory: 76944kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
2
2
1
2
1
1
2
1
1
1
1
1
2
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2...

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
0 420
8
2
8
0 1701
...

result:

points 0.43626666670 points  0.43626666670

Test #66:

score: 33.55
Acceptable Answer
time: 270ms
memory: 105892kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
0 420
8
2
8
1 420
8...

result:

points 0.44733333330 points  0.44733333330

Test #67:

score: 37.19
Acceptable Answer
time: 273ms
memory: 118744kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1...

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
0 420
8
2
8
0 1701
...

result:

points 0.49586666670 points  0.49586666670

Test #68:

score: 46.43
Acceptable Answer
time: 54ms
memory: 16552kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 792
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
...

result:

points 0.61906666670 points  0.61906666670

Test #69:

score: 46.43
Acceptable Answer
time: 67ms
memory: 16556kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 792
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
...

result:

points 0.61906666670 points  0.61906666670

Test #70:

score: 57.81
Acceptable Answer
time: 30ms
memory: 11268kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
1 1735
8
0 792
8
2
8
0 1416
8
2
8
1 1416
8
0 1194
8
2
8
1 1194
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 ...

result:

points 0.77080 points  0.77080

Test #71:

score: 57.81
Acceptable Answer
time: 38ms
memory: 11056kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
1 1735
8
0 792
8
2
8
0 1416
8
2
8
1 1416
8
0 1194
8
2
8
1 1194
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 ...

result:

points 0.77080 points  0.77080

Test #72:

score: 46.43
Acceptable Answer
time: 53ms
memory: 16872kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2...

result:

points 0.61906666670 points  0.61906666670

Test #73:

score: 46.43
Acceptable Answer
time: 61ms
memory: 16640kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
0 1575
8
2
8
1 1575
8
0 1556...

result:

points 0.61906666670 points  0.61906666670

Test #74:

score: 39.4
Acceptable Answer
time: 115ms
memory: 26628kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
1 720
8
0 1575
8
2
8
0 1556
8
2
8
1 1556
8
0 ...

result:

points 0.52533333330 points  0.52533333330

Test #75:

score: 39.35
Acceptable Answer
time: 87ms
memory: 26808kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
1 720
8
0 1575
8
2
8
0 1556
8
2
8
1 1556
8
0 ...

result:

points 0.52466666670 points  0.52466666670

Test #76:

score: 46.73
Acceptable Answer
time: 78ms
memory: 16444kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 792
8
2
8
0 1416
8
2
8
1 1416
8
0 1194
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
0 1575
8
2
8
1 1575
8...

result:

points 0.62306666670 points  0.62306666670

Test #77:

score: 46.74
Acceptable Answer
time: 66ms
memory: 16140kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
0 1735
8
2
8
1 1735
8
0 792
8
2
8
0 1416
8
2
8
0 1194
8
2
8
1 1194
8
0 643
8
2
8
0 720
8
2
8
0 ...

result:

points 0.62320 points  0.62320

Test #78:

score: 46.43
Acceptable Answer
time: 75ms
memory: 16568kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2...

result:

points 0.61906666670 points  0.61906666670

Test #79:

score: 46.43
Acceptable Answer
time: 65ms
memory: 16632kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2...

result:

points 0.61906666670 points  0.61906666670

Test #80:

score: 39.34
Acceptable Answer
time: 93ms
memory: 26940kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
0 420
8
2
8
0 1701
...

result:

points 0.52453333330 points  0.52453333330

Test #81:

score: 39.34
Acceptable Answer
time: 111ms
memory: 26928kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
0 420
8
2
8
0 1701
...

result:

points 0.52453333330 points  0.52453333330

Test #82:

score: 46.56
Acceptable Answer
time: 55ms
memory: 16540kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
1 468
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
8
2
8
0 1575
8
2
8
0 1556
8
2
8
0 420
8
2
8...

result:

points 0.62080 points  0.62080

Test #83:

score: 46.56
Acceptable Answer
time: 45ms
memory: 16848kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
0 1649
8
2
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 720
8
0 1575
8
2
8
0 1556
...

result:

points 0.62080 points  0.62080

Test #84:

score: 71.27
Acceptable Answer
time: 11ms
memory: 4416kb

input:

540
1
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 110
8
2
8
0 290
8
2
8
0 11
8
2
8
1 11
8
0 69
8
2
8
1 69
8
0 209
8
2
8
0 468
8
2
8
1 468
8
0 17
8
2
8
1 17
8
0 293
8
2
8
1 293
8
0 164
8
2
8
1 164
8
0 350
8
2
8
1 350
8
0 115
8
2
8
1 115
8
0 322
8
2
8
0 361
8
2
8
1 361
8
0 2
8
2
8
1 2
8
0 446
8
2
8
1 446
8
0 281
8
2
8
1 281
8
0 400
8
2
8
1 400
8
...

result:

points 0.95026666670 points  0.95026666670

Test #85:

score: 70.36
Acceptable Answer
time: 16ms
memory: 5980kb

input:

1834
1
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
1 701
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
0 1735
8
2
8
1 1735
8
0 792...

result:

points 0.93813333330 points  0.93813333330

Test #86:

score: 75
Accepted
time: 13ms
memory: 4792kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
1 1190
8
0 701
8
2
8
1 701
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
1 468
8
0 706
8
2
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 17...

result:

ok 

Test #87:

score: 49.99
Acceptable Answer
time: 121ms
memory: 99736kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
1 468
8
0 706
8
2
8
1 706
8
0 1131
8
2
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
0 1735
8
2
8
0 1979
8
2
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
1 643
8
0 720
8
2
8
1 720...

result:

points 0.66653333330 points  0.66653333330

Test #88:

score: 49.99
Acceptable Answer
time: 416ms
memory: 99288kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
1 1190
8
0 701
8
2
8
0 1768
8
2
8
1 1768
8
0 1059
8
2
8
1 1059
8
0 468
8
2
8
0 706
8
2
8
0 1131
8
2
8
1 1131
8
0 164
8
2
8
0 1195
8
2
8
1 1195
8
0 1213
8
2
8
1 1213
8
0 1029
8
2
8
1 1029
8
0 361
8
2
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0 141...

result:

points 0.66653333330 points  0.66653333330

Test #89:

score: 49.99
Acceptable Answer
time: 258ms
memory: 98744kb

input:

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

output:

8
0 1204
8
2
8
0 1190
8
2
8
0 701
8
2
8
0 1768
8
2
8
0 1059
8
2
8
0 468
8
2
8
1 468
8
0 706
8
2
8
0 1131
8
2
8
0 164
8
2
8
1 164
8
0 1195
8
2
8
0 1213
8
2
8
0 1029
8
2
8
0 361
8
2
8
1 361
8
0 1649
8
2
8
1 1649
8
0 1735
8
2
8
1 1735
8
0 1979
8
2
8
1 1979
8
0 1416
8
2
8
0 1194
8
2
8
0 643
8
2
8
0 720
...

result:

points 0.66653333330 points  0.66653333330