QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#518288#4565. Rarest InsectsDan4Life#57.88 405ms118696kbC++231.4kb2024-08-13 19:10:072024-08-13 19:10:08

Judging History

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

  • [2024-08-13 19:10:08]
  • 评测
  • 测评结果:57.88
  • 用时:405ms
  • 内存:118696kb
  • [2024-08-13 19:10:07]
  • 提交

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(sz(S)==1) return 1;
	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 = mid+1; i <= r; i++) move_out(v[i]);
	for(auto i : query){
		move_in(i);
		if(press()==2) qL.pb(i);
		else qR.pb(i);
		move_out(i);
	}
	dnc(l,mid,qL); 
	for(int i = l; i <= mid; i++) move_out(v[i]);
	for(int i = mid+1; i <= r; i++) move_in(v[i]);
	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) cnt[u]++;
	dnc(0,sz(v)-1,others);
	for(auto u : v) ans = min(ans, cnt[u]);
	return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

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

output:

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

result:

ok 

Test #2:

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

input:

2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1

output:

8
0 0
8
0 1
8
2
8
3 1

result:

ok 

Test #4:

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

input:

3
1
2
1

output:

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

result:

ok 

Test #5:

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

input:

5
2
1
2
2
1
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

input:

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

result:

ok 

Test #8:

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

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
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
8
0 ...

result:

ok 

Test #9:

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

input:

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

output:

8
0 110
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 86
8...

result:

ok 

Test #10:

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

input:

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

output:

8
0 110
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 143...

result:

ok 

Test #11:

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

input:

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

output:

8
0 110
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
8
2...

result:

ok 

Test #12:

score: 10
Accepted
time: 6ms
memory: 4912kb

input:

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

output:

8
0 110
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 143
...

result:

ok 

Test #13:

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

input:

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

output:

8
0 110
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
8
1...

result:

ok 

Test #14:

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

input:

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

output:

8
0 110
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
8
2
...

result:

ok 

Test #15:

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

input:

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

output:

8
0 110
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 166
8
...

result:

ok 

Test #16:

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

input:

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

output:

8
0 110
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
0 1...

result:

ok 

Test #17:

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

input:

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

output:

8
0 110
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 116
...

result:

ok 

Test #18:

score: 10
Accepted
time: 6ms
memory: 4140kb

input:

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

output:

8
0 110
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
1 11...

result:

ok 

Test #19:

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

input:

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

output:

8
0 110
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
8
2
...

result:

ok 

Test #20:

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

input:

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

output:

8
0 110
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 86
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 110
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
8
0...

result:

ok 

Test #22:

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

input:

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

output:

8
0 110
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 192
...

result:

ok 

Test #23:

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

input:

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

output:

8
0 110
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 192
8...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

input:

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

result:

ok 

Test #25:

score: 15
Accepted
time: 37ms
memory: 27396kb

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

result:

ok 

Test #26:

score: 15
Accepted
time: 30ms
memory: 7408kb

input:

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

output:

8
0 110
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
8
2...

result:

ok 

Test #27:

score: 15
Accepted
time: 27ms
memory: 7476kb

input:

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

output:

8
0 110
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
8
2...

result:

ok 

Test #28:

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

input:

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

result:

ok 

Test #29:

score: 15
Accepted
time: 55ms
memory: 27748kb

input:

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

output:

8
0 110
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
8
2...

result:

ok 

Test #30:

score: 15
Accepted
time: 18ms
memory: 4828kb

input:

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

output:

8
0 110
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 602
8...

result:

ok 

Test #31:

score: 15
Accepted
time: 34ms
memory: 7356kb

input:

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

output:

8
0 110
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
8
0...

result:

ok 

Test #32:

score: 15
Accepted
time: 23ms
memory: 4744kb

input:

1000
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
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 929
8
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 110
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
0 6...

result:

ok 

Test #34:

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

input:

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

output:

8
0 110
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
8
2...

result:

ok 

Test #35:

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

input:

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

output:

8
0 110
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 720
8
...

result:

ok 

Test #36:

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

input:

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

output:

8
0 110
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
0 5...

result:

ok 

Test #37:

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

input:

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

output:

8
0 110
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 826
...

result:

ok 

Test #38:

score: 15
Accepted
time: 34ms
memory: 9180kb

input:

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

output:

8
0 110
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 826
8...

result:

ok 

Test #39:

score: 15
Accepted
time: 26ms
memory: 13224kb

input:

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

output:

8
0 110
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
8
0...

result:

ok 

Test #40:

score: 15
Accepted
time: 60ms
memory: 19916kb

input:

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

output:

8
0 110
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
8
2...

result:

ok 

Test #41:

score: 15
Accepted
time: 71ms
memory: 29252kb

input:

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

output:

8
0 110
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
8
2...

result:

ok 

Test #42:

score: 15
Accepted
time: 68ms
memory: 32588kb

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

output:

8
0 110
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 192...

result:

ok 

Subtask #3:

score: 32.88
Acceptable Answer

Test #43:

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

input:

2
2

output:

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

result:

ok 

Test #44:

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

input:

2
1

output:

8
0 0
8
0 1
8
2
8
3 1

result:

ok 

Test #45:

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

input:

3
1
2
1

output:

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

result:

ok 

Test #46:

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

input:

6
2
2
1
2
2
2
2

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

input:

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

result:

ok 

Test #49:

score: 75
Accepted
time: 155ms
memory: 97904kb

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

result:

ok 

Test #50:

score: 50.23
Acceptable Answer
time: 70ms
memory: 13704kb

input:

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

output:

8
0 1204
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
2
8
...

result:

points 0.66973333330 points  0.66973333330

Test #51:

score: 50.43
Acceptable Answer
time: 60ms
memory: 14036kb

input:

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

output:

8
0 1204
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 420...

result:

points 0.67240 points  0.67240

Test #52:

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

input:

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

result:

ok 

Test #53:

score: 50.01
Acceptable Answer
time: 278ms
memory: 99148kb

input:

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

output:

8
0 1204
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 141...

result:

points 0.66680 points  0.66680

Test #54:

score: 72.85
Acceptable Answer
time: 19ms
memory: 5972kb

input:

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

output:

8
0 1204
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
1 1...

result:

points 0.97133333330 points  0.97133333330

Test #55:

score: 50.1
Acceptable Answer
time: 49ms
memory: 13716kb

input:

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

output:

8
0 1204
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
2
8
...

result:

points 0.6680 points  0.6680

Test #56:

score: 73.27
Acceptable Answer
time: 29ms
memory: 5728kb

input:

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

output:

8
0 1204
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
0 1...

result:

points 0.97693333330 points  0.97693333330

Test #57:

score: 70.37
Acceptable Answer
time: 17ms
memory: 6432kb

input:

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

output:

8
0 1204
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 1416
...

result:

points 0.93826666670 points  0.93826666670

Test #58:

score: 68.13
Acceptable Answer
time: 31ms
memory: 6952kb

input:

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

output:

8
0 1204
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
2
8...

result:

points 0.90840 points  0.90840

Test #59:

score: 66.54
Acceptable Answer
time: 28ms
memory: 7300kb

input:

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

output:

8
0 1204
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
1 1...

result:

points 0.88720 points  0.88720

Test #60:

score: 64.91
Acceptable Answer
time: 26ms
memory: 8276kb

input:

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

output:

8
0 1204
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
0 6...

result:

points 0.86546666670 points  0.86546666670

Test #61:

score: 61.67
Acceptable Answer
time: 52ms
memory: 9060kb

input:

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

output:

8
0 1204
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 720
8
...

result:

points 0.82226666670 points  0.82226666670

Test #62:

score: 48.46
Acceptable Answer
time: 23ms
memory: 14868kb

input:

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

output:

8
0 1204
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 420
...

result:

points 0.64613333330 points  0.64613333330

Test #63:

score: 40.62
Acceptable Answer
time: 98ms
memory: 23816kb

input:

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

output:

8
0 1204
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
8
0 ...

result:

points 0.54160 points  0.54160

Test #64:

score: 35.69
Acceptable Answer
time: 134ms
memory: 39824kb

input:

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

output:

8
0 1204
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 420
8...

result:

points 0.47586666670 points  0.47586666670

Test #65:

score: 32.88
Acceptable Answer
time: 185ms
memory: 76624kb

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

output:

8
0 1204
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
8
2
...

result:

points 0.43840 points  0.43840

Test #66:

score: 34.3
Acceptable Answer
time: 319ms
memory: 105868kb

input:

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

output:

8
0 1204
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
0 1...

result:

points 0.45733333330 points  0.45733333330

Test #67:

score: 38.69
Acceptable Answer
time: 269ms
memory: 118696kb

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

output:

8
0 1204
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
8
2
...

result:

points 0.51586666670 points  0.51586666670

Test #68:

score: 46.48
Acceptable Answer
time: 59ms
memory: 16516kb

input:

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

output:

8
0 1204
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
8
0 ...

result:

points 0.61973333330 points  0.61973333330

Test #69:

score: 46.48
Acceptable Answer
time: 47ms
memory: 16528kb

input:

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

output:

8
0 1204
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
8
0 ...

result:

points 0.61973333330 points  0.61973333330

Test #70:

score: 57.84
Acceptable Answer
time: 35ms
memory: 11204kb

input:

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

output:

8
0 1204
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 720
...

result:

points 0.77120 points  0.77120

Test #71:

score: 57.84
Acceptable Answer
time: 41ms
memory: 10992kb

input:

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

output:

8
0 1204
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 720
...

result:

points 0.77120 points  0.77120

Test #72:

score: 46.49
Acceptable Answer
time: 63ms
memory: 16808kb

input:

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

output:

8
0 1204
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
8
0...

result:

points 0.61986666670 points  0.61986666670

Test #73:

score: 46.49
Acceptable Answer
time: 78ms
memory: 16796kb

input:

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

output:

8
0 1204
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
8
2...

result:

points 0.61986666670 points  0.61986666670

Test #74:

score: 39.51
Acceptable Answer
time: 73ms
memory: 26464kb

input:

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

output:

8
0 1204
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 420
...

result:

points 0.52680 points  0.52680

Test #75:

score: 39.46
Acceptable Answer
time: 59ms
memory: 26456kb

input:

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

output:

8
0 1204
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 420
...

result:

points 0.52613333330 points  0.52613333330

Test #76:

score: 46.81
Acceptable Answer
time: 70ms
memory: 16224kb

input:

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

output:

8
0 1204
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
0 1...

result:

points 0.62413333330 points  0.62413333330

Test #77:

score: 46.82
Acceptable Answer
time: 56ms
memory: 16120kb

input:

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

output:

8
0 1204
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 1575...

result:

points 0.62426666670 points  0.62426666670

Test #78:

score: 46.49
Acceptable Answer
time: 63ms
memory: 16512kb

input:

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

output:

8
0 1204
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
8
0...

result:

points 0.61986666670 points  0.61986666670

Test #79:

score: 46.48
Acceptable Answer
time: 46ms
memory: 16516kb

input:

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

output:

8
0 1204
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
8
0...

result:

points 0.61973333330 points  0.61973333330

Test #80:

score: 39.44
Acceptable Answer
time: 99ms
memory: 26968kb

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

output:

8
0 1204
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
8
2
...

result:

points 0.52586666670 points  0.52586666670

Test #81:

score: 39.45
Acceptable Answer
time: 80ms
memory: 26896kb

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

output:

8
0 1204
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
8
2
...

result:

points 0.5260 points  0.5260

Test #82:

score: 46.64
Acceptable Answer
time: 56ms
memory: 16524kb

input:

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

output:

8
0 1204
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
0 1...

result:

points 0.62186666670 points  0.62186666670

Test #83:

score: 46.63
Acceptable Answer
time: 52ms
memory: 16504kb

input:

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

output:

8
0 1204
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
8
2
...

result:

points 0.62173333330 points  0.62173333330

Test #84:

score: 71.29
Acceptable Answer
time: 11ms
memory: 4624kb

input:

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

output:

8
0 110
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
0 37...

result:

points 0.95053333330 points  0.95053333330

Test #85:

score: 70.37
Acceptable Answer
time: 22ms
memory: 5888kb

input:

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

output:

8
0 1204
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
8
2...

result:

points 0.93826666670 points  0.93826666670

Test #86:

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

input:

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

output:

8
0 1204
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 1735
8...

result:

ok 

Test #87:

score: 50.01
Acceptable Answer
time: 121ms
memory: 99524kb

input:

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

output:

8
0 1204
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
8
0...

result:

points 0.66680 points  0.66680

Test #88:

score: 50.01
Acceptable Answer
time: 405ms
memory: 99260kb

input:

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

output:

8
0 1204
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 1416
8
...

result:

points 0.66680 points  0.66680

Test #89:

score: 50.01
Acceptable Answer
time: 227ms
memory: 98996kb

input:

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

output:

8
0 1204
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
8
2
...

result:

points 0.66680 points  0.66680