QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#20646#2617. Browsing the Collectionuezexh#AC ✓2969ms6232kbC++172.7kb2022-02-17 07:46:042022-05-03 10:55:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-03 10:55:11]
  • 评测
  • 测评结果:AC
  • 用时:2969ms
  • 内存:6232kb
  • [2022-02-17 07:46:04]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <climits>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
template<typename T> void cmin(T &a,const T &b){if(b<a)a=b;}
template<typename T> void cmax(T &a,const T &b){if(a<b)a=b;}

const int N=500,M=5,S=1<<M;
int n,m,a[N][M],pre[N][S],nxt[N][S],ans[N][N],d[N][S],fu[N*S];
int id(int p,int s){return (p<<m)|s;}
int Find(int x){return ~fu[x]?fu[x]=Find(fu[x]):x;}
void bfs(int ed){
	static pii q[N*S],*Head,*Tail;
	static set<int> v[N*S];
	Head=Tail=q;
	memset(d,0x3f,sizeof d);
	for(int p=0;p<n;++p)
		for(int s=0;s<(1<<m);++s)
			v[Find(id(p,s))].insert(p);
	for(int s=0;s<(1<<m);++s)
		d[ed][s]=0,*Tail++={ed,s},v[Find(id(ed,s))].erase(ed);
	int cnt=0;
	while(Head!=Tail){
		auto &[p,s]=*Head++;
		if(!s){
			ans[p][ed]=d[p][s];
			if((++cnt)==n)
				return;
		}
		if(d[pre[p][s]][s]>d[p][s]+1)
			d[pre[p][s]][s]=d[p][s]+1,*Tail++={pre[p][s],s};
		if(d[nxt[p][s]][s]>d[p][s]+1)
			d[nxt[p][s]][s]=d[p][s]+1,*Tail++={nxt[p][s],s};
		for(int i=0;i<m;++i)
			if(!((s>>i)&1) && d[p][s|(1<<i)]>d[p][s]+1)
				d[p][s|(1<<i)]=d[p][s]+1,*Tail++={p,s|(1<<i)};
		for(int i=0;i<m;++i){
			if(!((s>>i)&1))
				continue;
			int t=s^(1<<i);
			auto fd=[](const set<int> &v,int x){
				if(!v.size())
					return -1;
				auto it=v.upper_bound(x);
				if(it==v.begin())
					return *v.rbegin();
				return *--it;
			};
			int g=Find(id(p,t));
			v[g].insert(pre[p][s]);
			for(int q=fd(v[g],p);q!=-1 && (q==p || q!=pre[p][s]);q=fd(v[g],q?q-1:n-1)){
				if(d[q][t]>d[p][s]+1)
					d[q][t]=d[p][s]+1,*Tail++={q,t};
				v[g].erase(q);
			}
		}
	}
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;++i)
		for(int j=0;j<m;++j)
			scanf("%d",a[i]+j);
	memset(fu,0xff,sizeof fu);
	for(int s=0;s<(1<<m);++s){
		map<vector<int>,int> lst;
		for(int p=0;p<n;++p){
			vector<int> v;
			for(int i=0;i<m;++i)
				if((s>>i)&1)
					v.push_back(a[p][i]);
			auto it=lst.find(v);
			if(it!=lst.end()){
				fu[id(p,s)]=id(it->second,s);
				pre[p][s]=it->second;
				it->second=p;
			}else{
				lst.insert({v,p});
			}
		}
		for(int p=0;p<n;++p){
			vector<int> v;
			for(int i=0;i<m;++i)
				if((s>>i)&1)
					v.push_back(a[p][i]);
			auto it=lst.find(v);
			if(it!=lst.end()){
				pre[p][s]=it->second;
				lst.erase(it);
			}
		}
		for(int p=0;p<n;++p)
			if(pre[p][s]>=p){
				nxt[pre[p][s]][s]=p;
				for(int q=pre[p][s];q!=p;q=pre[q][s])
					nxt[pre[q][s]][s]=q;
			}
	}
	for(int i=0;i<n;++i)
		for(int j=0;j<n;++j)
			ans[i][j]=INT_MAX;
	for(int p=0;p<n;++p)
		bfs(p);
	for(int i=0;i<n;++i)
		for(int j=0;j<n;++j)
			printf("%d%c",ans[i][j],j<n-1?32:10);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 4ms
memory: 4172kb

input:

9 3
5 3 7
5 3 4
5 3 7
5 3 2
5 3 4
5 3 7
2 3 7
5 3 7
2 3 7

output:

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

result:

ok 81 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 4100kb

input:

2 2
2 2
1 1

output:

0 1
1 0

result:

ok 4 number(s): "0 1 1 0"

Test #3:

score: 0
Accepted
time: 0ms
memory: 4104kb

input:

2 5
2 1 1 2 1
1 2 1 2 1

output:

0 1
1 0

result:

ok 4 number(s): "0 1 1 0"

Test #4:

score: 0
Accepted
time: 0ms
memory: 4160kb

input:

4 1
4
2
3
2

output:

0 1 1 1
1 0 1 2
1 1 0 1
1 2 1 0

result:

ok 16 numbers

Test #5:

score: 0
Accepted
time: 2ms
memory: 4112kb

input:

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

output:

0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0

result:

ok 16 numbers

Test #6:

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

input:

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

output:

0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0

result:

ok 16 numbers

Test #7:

score: 0
Accepted
time: 1ms
memory: 4120kb

input:

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

output:

0 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1
1 1 0 1 1 1 1 1
1 1 1 0 1 1 1 1
1 1 1 1 0 1 1 1
1 1 1 1 1 0 1 1
1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 0

result:

ok 64 numbers

Test #8:

score: 0
Accepted
time: 0ms
memory: 4168kb

input:

16 2
12 15
4 6
16 10
13 3
2 7
2 13
4 1
14 16
14 6
7 11
7 1
13 11
15 7
10 6
4 13
4 13

output:

0 1 1 1 1 1 1 1 2 1 2 2 1 1 2 1
1 0 1 1 1 1 1 1 2 1 2 2 1 1 2 2
1 1 0 1 1 1 1 1 1 1 2 2 1 1 2 2
1 2 1 0 1 1 1 1 1 1 2 2 1 1 2 2
1 2 1 1 0 1 1 1 1 1 2 1 1 1 2 2
1 2 1 1 1 0 1 1 1 1 2 1 1 1 2 2
1 2 1 1 1 1 0 1 1 1 2 1 1 1 1 2
1 2 1 1 1 2 1 0 1 1 1 1 1 1 1 2
1 2 1 1 1 2 2 1 0 1 1 1 1 1 1 2
1 2 1 1 1 2 ...

result:

ok 256 numbers

Test #9:

score: 0
Accepted
time: 4ms
memory: 4192kb

input:

16 5
14 3 2 6 11
9 1 4 3 12
16 14 10 1 5
9 4 13 10 16
3 3 13 11 14
10 2 5 7 15
8 7 3 10 16
1 2 7 7 13
11 6 10 3 3
11 5 15 2 9
16 7 14 12 8
1 13 10 2 9
5 11 13 4 3
5 12 8 16 1
15 1 5 11 13
3 11 15 16 16

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 2
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 2
1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 2
1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 2
1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
1 1 1 1 1 1 ...

result:

ok 256 numbers

Test #10:

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

input:

26 3
3 16 24
12 6 26
3 6 19
25 11 12
5 22 26
17 1 20
16 11 11
11 23 12
7 17 10
12 9 8
22 19 25
21 17 21
3 25 20
16 4 2
25 25 17
23 8 12
24 4 12
24 14 12
16 6 18
19 10 1
16 6 14
16 26 12
11 6 24
25 7 6
16 1 23
4 2 14

output:

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

result:

ok 676 numbers

Test #11:

score: 0
Accepted
time: 0ms
memory: 4276kb

input:

32 5
4 30 20 26 8
29 18 22 5 14
20 22 31 31 28
12 22 27 12 4
13 7 14 32 16
6 29 20 21 25
22 21 21 20 24
4 14 18 4 28
4 9 9 29 11
11 5 11 20 30
19 27 21 6 7
3 11 2 2 12
24 17 18 30 29
13 8 20 28 26
9 17 2 21 3
32 23 31 11 23
16 28 20 2 5
30 30 11 29 6
15 21 30 17 32
15 18 13 19 25
24 17 26 18 4
23 21...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 1024 numbers

Test #12:

score: 0
Accepted
time: 3ms
memory: 4232kb

input:

34 2
26 17
32 10
13 8
14 11
17 30
9 32
31 28
20 23
5 25
34 2
32 22
6 7
8 32
17 11
7 5
33 10
6 19
24 5
28 20
27 8
3 25
20 26
3 6
26 25
30 8
23 19
23 27
12 13
13 17
18 34
8 11
8 24
25 22
24 21

output:

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

result:

ok 1156 numbers

Test #13:

score: 0
Accepted
time: 6ms
memory: 4316kb

input:

64 5
4 16 39 57 15
38 19 6 30 35
24 21 29 50 34
7 18 44 10 24
48 8 51 46 48
38 7 7 6 13
5 29 14 6 44
42 57 49 22 38
53 24 29 42 46
37 34 54 44 55
18 59 38 55 13
46 61 61 53 35
30 54 47 25 51
15 13 47 63 48
34 12 30 3 37
22 43 47 3 61
39 6 62 41 26
30 26 2 14 48
1 3 9 43 44
47 40 53 18 31
19 26 41 42...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 4096 numbers

Test #14:

score: 0
Accepted
time: 3ms
memory: 4456kb

input:

100 3
75 52 18
93 63 78
21 36 95
39 3 64
79 91 97
39 30 41
3 86 24
97 70 70
98 95 12
93 29 51
4 84 49
48 36 5
34 89 86
6 83 21
8 89 14
64 87 57
86 72 69
72 86 56
5 32 54
9 66 12
99 86 14
11 60 56
96 4 71
59 32 46
32 74 98
89 16 37
61 44 76
55 32 1
41 41 63
39 59 73
84 7 87
56 64 81
44 94 41
72 73 12...

output:

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

result:

ok 10000 numbers

Test #15:

score: 0
Accepted
time: 14ms
memory: 4676kb

input:

128 5
122 18 15 41 30
78 109 50 118 101
34 110 71 93 99
98 30 54 126 13
91 99 108 58 97
27 38 75 54 33
47 82 25 25 82
97 23 73 58 117
50 90 92 71 121
39 121 111 73 94
53 8 119 89 80
51 6 40 86 8
90 93 80 35 40
55 30 29 9 114
78 104 61 22 87
83 55 41 55 31
31 66 24 15 8
28 79 38 6 29
57 95 124 104 3
...

output:

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

result:

ok 16384 numbers

Test #16:

score: 0
Accepted
time: 29ms
memory: 4860kb

input:

244 4
190 106 2 214
40 220 21 86
217 147 210 137
244 130 202 68
201 166 70 154
101 148 71 180
137 46 182 62
217 209 81 163
6 101 58 110
234 67 139 212
127 34 147 193
192 235 235 135
17 185 124 132
159 153 13 222
173 224 12 138
236 15 118 33
147 84 224 137
17 114 149 69
53 45 207 24
179 41 202 155
67...

output:

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

result:

ok 59536 numbers

Test #17:

score: 0
Accepted
time: 38ms
memory: 5236kb

input:

256 5
197 131 211 151 128
133 74 92 247 210
81 173 69 34 33
213 153 59 17 54
95 193 174 114 210
10 154 196 59 95
107 101 91 211 149
74 68 84 179 120
191 54 173 3 33
26 218 211 90 69
229 236 137 153 183
250 75 60 18 42
157 249 173 55 142
216 29 111 254 106
76 192 2 108 124
105 33 12 55 64
182 84 91 9...

output:

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

result:

ok 65536 numbers

Test #18:

score: 0
Accepted
time: 28ms
memory: 4932kb

input:

297 3
294 106 225
285 214 198
37 160 58
130 53 190
195 103 224
202 234 19
241 105 214
227 289 93
253 79 146
292 48 163
168 116 55
47 8 244
215 240 285
74 200 70
156 114 276
59 157 134
85 84 272
289 91 283
263 108 244
291 22 172
208 102 239
182 13 114
84 9 220
55 83 297
164 199 11
124 2 87
65 43 269
...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 ...

result:

ok 88209 numbers

Test #19:

score: 0
Accepted
time: 146ms
memory: 5956kb

input:

500 5
476 371 300 184 275
302 264 130 67 432
301 54 107 319 223
268 93 476 39 401
166 401 342 165 479
270 277 148 65 306
176 20 212 476 476
56 308 41 224 62
115 421 231 477 331
147 323 442 19 407
285 388 417 158 99
388 440 293 453 75
222 64 139 49 7
54 85 304 142 171
487 276 14 274 106
11 271 203 32...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #20:

score: 0
Accepted
time: 144ms
memory: 6044kb

input:

500 5
399 86 156 285 15
372 30 448 8 255
108 51 324 477 58
308 273 278 202 107
426 70 272 207 382
225 500 292 309 182
440 286 235 437 373
214 375 155 177 463
372 153 36 128 336
23 79 161 97 353
70 139 154 465 34
89 68 395 302 15
496 174 174 229 29
270 127 415 92 89
347 206 105 490 397
154 283 453 3 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #21:

score: 0
Accepted
time: 165ms
memory: 6000kb

input:

500 5
342 382 243 44 16
263 277 158 364 366
91 88 130 325 391
445 191 116 152 16
140 119 143 25 252
165 32 386 205 267
283 184 288 88 184
230 253 247 223 452
318 141 152 40 68
358 291 313 327 384
114 87 243 74 4
60 301 350 9 214
303 422 267 364 200
287 338 439 371 431
221 207 364 394 317
357 10 89 1...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #22:

score: 0
Accepted
time: 167ms
memory: 6092kb

input:

500 5
406 17 369 227 383
378 200 300 167 170
11 89 478 170 479
341 374 293 409 121
362 355 184 144 173
380 24 259 408 178
382 442 309 280 69
498 168 44 198 490
393 261 296 340 197
341 474 91 490 368
96 228 110 436 72
316 230 413 32 121
366 71 268 187 42
399 67 463 128 1
199 69 409 409 333
261 364 28...

output:

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

result:

ok 250000 numbers

Test #23:

score: 0
Accepted
time: 195ms
memory: 6056kb

input:

500 5
441 212 155 469 25
215 434 175 2 333
56 455 394 79 402
385 57 436 50 124
96 277 169 287 259
213 392 134 58 45
376 455 101 139 149
309 353 52 129 253
55 455 399 331 149
397 49 101 139 215
36 87 286 353 140
308 250 394 274 292
96 55 89 277 220
103 215 40 480 371
270 185 190 273 427
84 436 465 18...

output:

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

result:

ok 250000 numbers

Test #24:

score: 0
Accepted
time: 243ms
memory: 6096kb

input:

500 5
44 198 349 481 393
312 305 16 380 239
391 210 82 72 126
1 351 466 163 71
437 181 178 104 437
203 349 386 350 73
101 286 354 387 395
236 319 495 199 63
403 491 354 417 493
281 195 82 238 307
412 73 214 481 393
405 208 4 112 435
9 198 354 136 63
445 215 326 14 437
267 208 231 455 150
31 246 87 2...

output:

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

result:

ok 250000 numbers

Test #25:

score: 0
Accepted
time: 316ms
memory: 6016kb

input:

500 5
165 146 232 478 317
366 69 411 23 290
457 309 457 478 78
2 228 384 231 158
444 216 292 95 354
322 387 386 21 371
341 468 234 490 439
210 1 331 23 32
464 397 161 147 160
434 228 331 258 236
136 487 457 140 2
434 365 348 365 160
341 428 311 147 167
426 69 46 206 310
154 428 14 370 236
165 116 45...

output:

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

result:

ok 250000 numbers

Test #26:

score: 0
Accepted
time: 444ms
memory: 6068kb

input:

500 5
388 287 233 175 313
462 340 182 175 257
243 262 191 202 78
388 280 191 202 82
243 17 181 224 158
199 107 76 318 257
199 107 389 175 244
199 460 445 318 276
121 483 219 224 376
373 280 187 95 257
121 133 445 152 218
134 439 191 175 158
440 280 191 202 196
223 279 191 149 257
199 107 187 175 26
...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 2 1 1 2 1 1 2 1 1 1 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 2 2 2 1 1 2 2 1 2 1 1 2 1 1 2 2 2 2 2 1 2 1 2 1 2 1 1 2 2 2 2 1 1 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 1 2 1 2 2 1 2 2 2 2 1 2 2 1 1 2 2 ...

result:

ok 250000 numbers

Test #27:

score: 0
Accepted
time: 746ms
memory: 6012kb

input:

500 5
262 287 355 51 171
86 55 127 51 104
199 287 174 419 104
262 240 75 41 452
39 307 164 41 437
262 307 174 470 104
262 465 399 470 437
256 287 355 51 68
231 52 174 50 11
359 464 399 51 104
256 55 81 41 342
256 55 154 51 104
231 55 127 470 45
160 55 174 470 11
256 55 174 270 437
256 287 174 41 11
...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 1 2 2 1 1 1 1 1 2 1 2 1 1 1 2 2 1 2 1 1 2 2 1 1 1 1 2 2 2 2 2 2 2 1 2 2 1 1 2 2 1 1 2 2 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 2 2 2 2 2 2 1 2 2 1 2 2 1 2 1 1 2 2 2 2 2 2 2 1 3 2 3 2 2 2 2 2 2 2 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 2 3 2 3 1 2 2 1 2 2 1 3 1 ...

result:

ok 250000 numbers

Test #28:

score: 0
Accepted
time: 1245ms
memory: 6096kb

input:

500 5
328 350 179 118 475
330 14 495 316 146
76 350 96 316 70
200 350 179 174 63
76 314 495 272 63
330 314 96 50 475
330 350 179 272 351
301 350 1 272 63
330 350 495 323 351
301 350 1 316 475
200 350 179 316 283
330 350 179 316 475
330 350 197 316 146
330 23 495 272 351
330 350 179 50 146
200 44 495...

output:

0 1 1 1 1 1 1 1 1 2 1 3 1 1 2 1 2 2 1 1 2 2 1 1 2 3 3 1 2 2 3 2 3 2 3 2 2 2 2 3 1 3 1 2 2 2 2 3 3 4 3 1 3 2 2 2 2 2 2 2 2 3 2 1 2 2 3 1 1 1 2 2 1 3 2 1 2 1 3 3 4 2 4 3 3 2 3 2 3 3 1 3 3 3 2 3 2 3 3 3 2 3 3 3 2 3 4 3 3 4 4 3 4 3 3 2 2 3 3 2 3 2 3 1 3 3 1 3 2 2 2 3 2 2 2 3 2 3 3 4 4 3 4 2 3 2 2 1 2 3 ...

result:

ok 250000 numbers

Test #29:

score: 0
Accepted
time: 1997ms
memory: 6148kb

input:

500 5
179 212 356 214 238
174 212 425 214 238
179 212 356 239 238
276 196 356 214 245
179 212 356 14 238
34 93 356 214 238
174 212 356 214 238
179 212 356 214 238
174 212 169 214 238
174 212 356 239 183
179 93 356 214 245
174 93 169 214 238
174 93 356 239 245
174 214 356 214 245
179 212 425 214 238
...

output:

0 1 1 1 1 1 2 3 1 1 2 2 2 1 2 2 2 3 1 1 2 3 2 3 3 4 3 2 2 4 4 4 2 4 2 4 2 1 1 3 2 2 1 2 3 3 2 3 5 4 3 3 1 2 3 3 2 2 2 2 3 4 4 4 4 3 4 2 1 3 2 2 4 2 3 3 1 3 3 4 3 2 4 4 4 3 3 3 3 5 3 5 4 4 2 4 4 4 2 3 4 2 4 5 4 4 3 4 2 4 4 4 3 4 4 2 4 4 2 3 3 4 5 4 4 2 2 3 4 4 5 4 4 2 5 4 4 2 4 4 5 5 5 4 3 5 4 5 4 2 ...

result:

ok 250000 numbers

Test #30:

score: 0
Accepted
time: 1952ms
memory: 6232kb

input:

500 5
68 11 60 249 375
68 11 60 396 375
68 11 60 468 375
68 372 60 396 375
68 11 153 396 375
68 11 60 468 375
68 11 60 396 375
68 11 60 468 375
432 372 60 396 477
68 11 60 396 402
68 11 60 396 375
68 11 60 396 375
68 11 60 396 375
68 11 60 396 375
68 372 364 396 375
68 11 60 396 375
68 372 153 249 3...

output:

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

result:

ok 250000 numbers

Test #31:

score: 0
Accepted
time: 2356ms
memory: 6120kb

input:

500 5
61 310 443 489 80
61 310 443 270 80
61 310 443 270 80
61 310 443 270 80
61 310 443 270 80
61 310 443 270 80
61 310 443 270 343
61 310 443 270 80
61 310 443 270 80
61 310 443 270 80
61 310 443 270 80
61 67 443 270 80
61 310 443 270 80
61 310 443 270 80
61 310 443 270 80
61 310 443 270 80
61 310...

output:

0 1 2 3 4 3 1 3 4 4 3 1 3 4 5 6 6 5 4 3 1 3 4 5 4 3 1 3 4 5 6 5 4 2 4 5 6 7 8 9 8 7 6 5 4 2 4 4 2 4 5 6 7 8 9 9 8 7 6 5 3 5 3 5 5 3 5 6 7 8 7 6 5 4 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 18 17 16 15 14 13 12 11 10 9 8 7 6 4 6 7 8 9 10 9 8 7 6 4 4 3 1 3 4 5 6 5 3 5 6 7 8 9 10 11 11 10 9 8 7 6 5 ...

result:

ok 250000 numbers

Test #32:

score: 0
Accepted
time: 2201ms
memory: 6232kb

input:

500 5
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 233 369 485
441 40 23...

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok 250000 numbers

Test #33:

score: 0
Accepted
time: 2969ms
memory: 6036kb

input:

500 5
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 79 234 85
485 1 ...

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok 250000 numbers

Test #34:

score: 0
Accepted
time: 2956ms
memory: 6088kb

input:

500 5
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 402 75 226
259 293 4...

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok 250000 numbers

Test #35:

score: 0
Accepted
time: 2229ms
memory: 6096kb

input:

500 5
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 489 371 295
434 395 129 371 295
434 395 489 37...

output:

0 1 2 3 4 5 6 7 7 6 5 4 3 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ...

result:

ok 250000 numbers

Test #36:

score: 0
Accepted
time: 2334ms
memory: 6036kb

input:

500 5
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 438 110
312 110 337 43...

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok 250000 numbers

Test #37:

score: 0
Accepted
time: 1325ms
memory: 6080kb

input:

500 5
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446 44 286 153
93 446...

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 12 11 10 9 8 7 6 5 4 3 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 8...

result:

ok 250000 numbers

Test #38:

score: 0
Accepted
time: 1130ms
memory: 6012kb

input:

500 5
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41 265 66 122
198 41...

output:

0 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 1 3 4 5 6 7 7 6 5 4 3 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1 3 4 3 1 3 4 5 6 5 4 ...

result:

ok 250000 numbers

Test #39:

score: 0
Accepted
time: 1023ms
memory: 6012kb

input:

500 5
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 252 38 96 129
236 25...

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1 3 1 3 3 1 3 3 1 3 3 1 3 4 4 3 1 3 4 5 4 3 1 1 3 4 3 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1 3 4 5 6 7 8 9 9...

result:

ok 250000 numbers

Test #40:

score: 0
Accepted
time: 951ms
memory: 6132kb

input:

500 5
391 229 172 423 130
391 229 446 423 130
391 229 172 423 130
391 229 172 423 130
391 229 172 423 130
391 229 172 423 99
391 379 172 423 130
391 229 172 423 130
391 229 172 423 130
391 229 172 423 130
391 118 172 423 130
391 229 172 423 130
391 229 172 423 130
391 229 172 423 130
391 229 172 423...

output:

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

result:

ok 250000 numbers

Test #41:

score: 0
Accepted
time: 794ms
memory: 6068kb

input:

500 5
357 490 321 94 30
357 490 321 94 55
357 490 321 98 30
499 490 321 94 30
357 490 321 94 78
357 490 321 94 30
357 441 304 94 30
357 196 321 94 30
357 490 321 94 423
357 490 321 94 30
391 490 321 325 30
357 490 321 94 30
357 490 321 86 30
357 490 321 94 30
357 490 321 94 30
357 490 321 94 30
357 ...

output:

0 1 1 1 1 3 1 1 1 3 1 3 1 3 4 3 1 1 3 1 1 1 3 1 3 3 1 1 1 3 3 1 1 3 3 1 1 3 1 2 1 1 3 1 3 3 1 1 1 1 1 1 3 1 1 3 4 4 3 1 1 1 3 3 1 1 1 3 1 3 3 1 1 1 3 3 1 1 3 3 1 1 1 1 1 3 3 1 3 1 1 1 1 1 1 3 1 1 3 4 5 5 4 3 1 2 3 1 3 1 1 1 1 1 3 4 4 3 1 3 1 1 1 1 1 3 1 1 1 1 3 1 3 3 1 3 1 1 3 3 1 3 3 1 3 4 5 4 3 1 ...

result:

ok 250000 numbers

Test #42:

score: 0
Accepted
time: 648ms
memory: 6036kb

input:

500 5
481 201 117 360 252
308 201 117 360 252
70 201 117 360 252
389 201 117 360 252
337 201 117 360 252
132 201 117 360 252
284 201 117 360 252
400 201 117 360 252
399 201 117 360 252
244 201 117 360 252
439 201 117 360 252
13 201 117 360 252
289 201 117 360 252
331 201 117 360 252
351 201 117 360 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #43:

score: 0
Accepted
time: 639ms
memory: 6024kb

input:

500 5
47 79 121 187 386
47 79 121 187 470
47 79 121 187 159
47 79 121 187 192
47 79 121 187 491
47 79 121 187 29
47 79 121 187 298
47 79 121 187 115
47 79 121 187 487
47 79 121 187 438
47 79 121 187 23
47 79 121 187 315
47 79 121 187 60
47 79 121 187 282
47 79 121 187 297
47 79 121 187 128
47 79 121...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #44:

score: 0
Accepted
time: 643ms
memory: 6012kb

input:

500 5
31 311 462 360 125
31 311 462 360 58
31 311 462 360 496
31 4 462 360 171
31 311 462 360 493
31 311 462 360 318
31 311 462 360 262
31 311 462 360 328
31 311 462 360 339
31 311 462 360 393
31 311 462 360 141
31 311 462 360 330
31 311 462 360 256
31 311 462 360 79
31 311 462 360 363
31 311 462 36...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #45:

score: 0
Accepted
time: 707ms
memory: 6052kb

input:

500 5
206 181 410 39 78
87 181 410 39 78
185 181 410 39 78
90 181 410 39 78
211 181 410 39 78
310 181 410 39 78
58 181 410 39 78
102 181 410 39 78
325 181 410 39 78
366 181 410 39 78
52 181 410 39 78
289 181 410 39 78
369 181 410 39 78
281 181 410 39 78
35 181 410 39 78
371 181 410 39 78
131 181 410...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #46:

score: 0
Accepted
time: 673ms
memory: 6040kb

input:

500 5
189 77 111 179 368
189 87 111 179 368
189 92 111 179 368
189 314 111 179 368
189 102 111 179 368
189 113 111 179 368
189 15 111 179 368
189 465 111 179 368
189 86 111 179 368
189 7 111 179 368
189 140 111 179 368
189 124 111 179 368
189 344 111 179 368
189 158 111 179 368
189 389 111 179 368
1...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #47:

score: 0
Accepted
time: 685ms
memory: 6040kb

input:

500 5
270 315 367 225 448
270 488 367 225 448
270 186 367 225 448
270 78 367 225 448
270 420 367 225 448
270 77 367 225 448
270 391 367 225 448
270 477 367 225 448
52 345 367 225 448
270 242 367 225 448
270 13 367 225 448
270 291 367 225 448
270 63 367 225 448
270 426 367 225 448
270 227 367 225 448...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #48:

score: 0
Accepted
time: 684ms
memory: 6092kb

input:

500 5
68 438 260 247 482
239 438 260 247 220
15 487 260 247 182
15 438 260 247 41
15 438 260 247 190
15 438 260 247 7
15 438 260 247 268
15 438 260 247 498
15 438 260 397 108
15 438 260 247 27
15 438 260 247 456
15 438 260 247 175
15 438 260 247 214
471 438 260 247 301
15 438 260 247 53
15 438 260 2...

output:

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

result:

ok 250000 numbers

Test #49:

score: 0
Accepted
time: 514ms
memory: 6128kb

input:

500 5
280 328 163 342 53
280 328 163 70 53
280 178 163 482 159
280 328 163 293 53
280 328 163 467 91
280 328 163 284 228
280 328 163 360 53
280 328 163 10 53
280 328 163 371 53
280 328 163 60 53
280 328 163 119 418
280 328 163 209 53
249 328 163 230 53
280 328 163 492 53
280 328 132 422 53
312 328 1...

output:

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

result:

ok 250000 numbers

Test #50:

score: 0
Accepted
time: 344ms
memory: 6056kb

input:

500 5
133 457 20 281 102
133 457 90 281 222
133 457 247 281 494
133 457 327 281 390
133 457 21 281 209
133 457 308 281 156
133 457 427 281 281
133 457 125 281 411
133 457 159 281 270
133 457 102 281 438
133 457 15 281 457
133 457 430 281 212
133 457 428 281 200
133 457 78 281 385
133 457 144 281 169...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #51:

score: 0
Accepted
time: 359ms
memory: 6032kb

input:

500 5
110 283 308 170 356
246 73 308 170 356
398 224 308 170 356
204 174 308 170 356
156 194 308 170 356
274 256 308 170 356
262 349 308 170 356
293 203 308 170 356
437 248 308 170 356
220 324 308 170 356
213 435 308 170 356
500 444 308 170 356
325 139 308 170 356
190 302 308 170 356
447 443 308 170...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #52:

score: 0
Accepted
time: 370ms
memory: 6068kb

input:

500 5
474 440 116 60 491
127 440 116 362 491
191 440 116 378 491
352 440 116 445 491
188 440 116 294 491
155 440 116 493 491
19 440 116 325 491
448 440 116 134 491
412 440 116 230 491
491 440 116 343 491
393 440 116 196 491
356 440 116 151 491
379 440 116 98 491
499 440 116 118 491
216 440 116 490 4...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #53:

score: 0
Accepted
time: 385ms
memory: 6056kb

input:

500 5
494 417 303 1 401
494 59 303 168 401
494 364 303 378 401
494 101 303 178 401
494 318 303 163 401
494 314 303 253 401
494 490 303 484 401
494 211 303 459 401
494 220 303 183 401
494 251 303 209 401
494 498 303 375 401
494 396 303 249 401
494 184 303 117 401
494 369 303 84 401
494 476 303 125 40...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #54:

score: 0
Accepted
time: 366ms
memory: 6004kb

input:

500 5
72 65 297 381 256
329 65 297 304 256
113 65 297 477 256
307 65 297 135 256
401 65 297 65 256
179 65 297 100 256
83 65 297 391 256
292 65 297 101 256
408 65 297 462 256
36 65 297 368 256
80 65 297 421 256
499 65 297 119 256
135 65 297 116 256
432 65 297 355 256
17 65 297 362 256
298 65 297 294 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #55:

score: 0
Accepted
time: 375ms
memory: 6080kb

input:

500 5
318 178 362 33 203
318 19 254 33 203
318 478 1 33 203
318 436 30 33 203
318 102 57 33 203
318 40 13 33 203
318 195 220 33 203
318 457 68 33 203
318 347 152 33 203
318 200 371 33 203
318 479 146 33 203
318 189 463 33 203
318 60 378 33 203
318 194 486 33 203
318 238 140 33 203
318 90 437 33 203
...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #56:

score: 0
Accepted
time: 383ms
memory: 6036kb

input:

500 5
284 389 156 327 210
284 173 156 467 118
284 27 156 294 118
284 155 156 137 118
284 379 156 128 118
284 5 156 97 118
284 214 156 150 118
284 123 156 159 118
284 495 156 275 118
284 210 156 68 118
284 432 156 79 398
284 136 156 155 118
284 369 156 117 118
284 453 156 59 473
284 358 156 117 118
2...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #57:

score: 0
Accepted
time: 315ms
memory: 6056kb

input:

500 5
45 38 99 206 39
117 38 10 206 39
365 36 172 390 39
145 38 112 206 39
1 38 296 206 163
338 38 336 206 39
98 38 421 364 39
252 38 73 206 39
497 38 481 206 39
332 38 215 206 39
194 38 338 206 157
44 38 383 206 11
199 38 451 206 39
104 38 107 244 39
313 38 323 206 39
79 38 199 206 39
336 38 252 20...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #58:

score: 0
Accepted
time: 211ms
memory: 6012kb

input:

500 5
79 465 200 388 338
180 433 210 388 338
322 136 481 388 338
283 352 247 388 338
39 48 78 388 338
484 447 343 388 338
494 369 187 388 338
252 45 253 388 338
341 268 305 388 338
407 102 355 388 338
92 476 366 388 338
144 387 22 388 338
369 288 99 388 338
140 153 497 388 338
377 397 104 388 338
15...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #59:

score: 0
Accepted
time: 208ms
memory: 6012kb

input:

500 5
53 423 437 416 387
426 423 437 291 272
395 423 437 267 12
259 423 437 454 92
39 423 437 355 263
65 423 437 371 443
231 423 437 158 194
98 423 437 326 412
412 423 437 455 473
218 423 437 405 218
2 423 437 98 367
188 423 437 164 160
226 423 437 92 141
208 423 437 24 14
306 423 437 163 352
468 42...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #60:

score: 0
Accepted
time: 215ms
memory: 5972kb

input:

500 5
338 371 50 10 8
338 169 34 405 8
338 423 83 23 8
338 478 170 334 8
338 285 204 172 8
338 175 363 95 8
338 234 106 361 8
338 336 7 306 8
338 469 62 288 8
338 74 445 120 8
338 330 85 428 8
338 80 69 447 8
338 499 349 109 8
338 131 241 2 8
338 428 365 212 8
338 390 308 237 8
338 391 135 458 8
338...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #61:

score: 0
Accepted
time: 213ms
memory: 5996kb

input:

500 5
487 238 457 365 13
187 299 431 365 13
428 376 394 365 13
36 345 187 365 13
122 128 165 365 13
479 263 472 365 13
280 69 224 365 13
486 372 433 365 13
96 298 113 365 13
388 201 42 365 13
81 167 415 365 13
182 217 106 365 13
423 467 294 365 13
456 407 154 365 13
463 140 132 365 13
498 234 97 365...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #62:

score: 0
Accepted
time: 219ms
memory: 6016kb

input:

500 5
279 125 436 477 203
279 125 426 349 268
279 125 346 300 431
279 125 34 372 459
279 125 236 336 301
279 125 56 192 66
279 125 11 92 367
279 125 262 60 172
279 125 287 375 11
279 125 214 435 51
279 125 431 129 360
279 125 65 149 409
279 125 392 12 143
279 125 129 29 159
279 125 139 457 491
279 1...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #63:

score: 0
Accepted
time: 220ms
memory: 6144kb

input:

500 5
189 390 230 190 436
8 82 230 182 436
390 45 230 277 436
273 61 230 447 436
138 398 230 156 436
186 97 230 275 436
96 332 339 489 436
35 242 230 171 436
11 26 230 92 436
348 297 230 45 436
500 260 230 419 436
370 418 230 474 436
226 225 230 287 436
102 293 230 379 436
453 294 230 3 436
295 86 2...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #64:

score: 0
Accepted
time: 245ms
memory: 6076kb

input:

500 5
65 460 283 356 13
120 460 283 261 378
191 460 283 357 126
435 460 283 122 278
314 460 283 469 461
277 460 283 87 455
25 460 283 176 388
256 460 283 463 176
16 460 283 369 66
242 460 283 376 23
59 460 283 121 344
452 460 283 189 232
295 460 283 107 328
225 460 283 240 356
278 460 283 308 18
470...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #65:

score: 0
Accepted
time: 227ms
memory: 6036kb

input:

500 5
353 218 34 213 306
353 30 321 385 306
224 280 260 113 306
353 294 84 141 306
353 292 337 205 306
353 114 119 208 306
353 170 420 80 306
353 454 356 266 306
353 48 397 313 306
353 146 125 233 306
353 284 456 384 427
353 53 90 257 306
395 451 14 65 489
353 10 413 434 306
353 94 118 229 306
353 2...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #66:

score: 0
Accepted
time: 150ms
memory: 6056kb

input:

500 5
12 202 410 281 300
388 170 420 281 259
425 428 122 281 28
87 199 438 281 106
93 447 98 281 13
308 204 263 281 358
98 152 357 281 46
244 185 376 281 113
448 359 374 281 150
270 357 78 281 64
366 494 480 281 463
461 79 164 281 294
401 247 182 281 198
85 402 338 281 4
413 67 391 281 134
328 412 2...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #67:

score: 0
Accepted
time: 153ms
memory: 6044kb

input:

500 5
384 294 404 366 433
102 14 404 268 68
334 196 404 68 430
134 280 404 425 41
114 402 404 424 317
298 432 404 120 339
194 331 404 376 395
143 148 404 101 334
107 82 404 164 104
499 326 404 361 300
129 371 404 195 10
218 146 404 306 355
422 109 404 52 164
203 465 404 440 242
494 89 404 279 81
95 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #68:

score: 0
Accepted
time: 151ms
memory: 6004kb

input:

500 5
127 466 376 111 282
500 348 353 111 160
161 434 85 111 345
378 301 441 111 122
288 134 481 111 355
34 101 127 111 383
83 482 186 111 148
435 306 161 111 312
439 33 292 111 311
496 322 164 111 105
143 157 182 111 43
145 491 129 111 435
177 64 139 111 152
440 488 54 111 240
390 69 449 111 467
38...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #69:

score: 0
Accepted
time: 145ms
memory: 5936kb

input:

500 5
303 244 46 181 226
420 384 318 119 226
32 53 249 460 226
407 312 325 136 226
267 92 156 277 226
397 164 444 375 226
196 132 353 317 226
232 254 89 115 226
63 110 178 499 226
37 264 5 252 226
192 300 239 199 226
310 45 164 382 226
322 38 259 322 226
178 304 12 390 226
418 495 228 446 226
132 17...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #70:

score: 0
Accepted
time: 138ms
memory: 5964kb

input:

500 5
172 250 124 344 292
192 327 124 38 12
155 482 124 101 478
457 378 124 494 234
379 465 124 391 202
75 363 124 71 84
288 48 124 309 446
63 270 124 315 75
256 360 124 322 5
500 377 124 105 465
165 312 124 292 190
257 273 124 202 267
5 117 124 346 432
12 456 124 445 121
132 181 124 416 133
96 197 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #71:

score: 0
Accepted
time: 146ms
memory: 5996kb

input:

500 5
413 63 380 142 14
146 63 468 91 248
380 63 224 17 388
318 113 377 309 247
110 63 371 312 213
336 63 243 403 434
271 63 432 363 224
288 63 218 78 35
357 63 488 303 94
442 63 348 356 258
178 63 210 168 260
403 63 55 205 400
163 63 226 32 93
399 63 254 385 366
458 63 309 436 148
339 63 259 135 45...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #72:

score: 0
Accepted
time: 157ms
memory: 6068kb

input:

500 5
78 99 203 359 338
86 125 470 383 322
482 23 470 17 302
141 39 470 281 97
375 97 470 292 96
59 177 470 64 413
430 338 470 107 165
321 93 470 143 4
354 314 470 342 284
489 7 470 449 391
462 152 116 363 376
200 84 470 184 367
117 30 470 303 229
64 279 470 340 8
90 79 470 79 355
102 308 173 120 57...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #73:

score: 0
Accepted
time: 154ms
memory: 6028kb

input:

500 5
3 126 138 200 55
3 135 158 253 312
3 485 222 299 187
3 166 128 383 362
419 160 398 492 43
3 6 391 70 47
3 391 474 251 324
3 180 32 183 150
3 106 393 348 257
3 314 346 305 126
3 227 491 305 340
3 71 79 62 448
3 252 19 311 366
3 148 243 428 247
3 332 315 365 22
3 495 127 248 356
3 109 23 329 179...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #74:

score: 0
Accepted
time: 115ms
memory: 5992kb

input:

500 5
211 64 433 130 345
317 265 115 446 425
118 220 368 7 69
68 107 394 312 490
468 185 201 200 454
3 174 305 346 436
143 182 235 333 201
394 145 328 122 306
33 360 56 152 137
470 373 114 315 246
418 341 285 344 283
66 426 245 450 41
98 444 286 42 388
93 479 339 227 448
455 89 270 97 19
429 86 397 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #75:

score: 0
Accepted
time: 118ms
memory: 6020kb

input:

500 5
397 104 129 201 228
40 86 390 143 256
199 384 121 337 101
118 269 139 434 327
270 429 342 73 308
225 244 483 130 185
15 488 465 171 495
498 409 190 322 297
161 237 207 457 207
237 375 242 42 363
309 255 426 97 491
388 83 498 199 14
209 87 98 275 341
268 341 387 182 487
7 23 91 469 402
289 182 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #76:

score: 0
Accepted
time: 112ms
memory: 6032kb

input:

500 5
154 9 496 87 424
93 21 418 292 426
199 301 262 257 196
6 441 265 21 58
363 169 450 466 356
164 269 435 310 107
192 395 402 358 433
416 127 282 124 103
384 45 64 9 3
27 173 116 302 168
291 351 245 180 180
371 183 13 138 81
432 8 164 350 317
217 312 466 304 35
415 106 50 230 148
113 486 149 209 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #77:

score: 0
Accepted
time: 103ms
memory: 5992kb

input:

500 5
327 137 82 117 219
110 453 273 294 465
245 296 154 331 56
126 200 143 92 289
280 147 134 464 178
164 34 374 120 477
492 312 336 180 92
399 445 333 209 407
258 272 257 405 368
169 144 252 90 59
463 323 314 244 460
240 372 233 442 83
77 237 497 497 305
465 150 58 266 285
458 118 321 39 90
132 47...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #78:

score: 0
Accepted
time: 115ms
memory: 5940kb

input:

500 5
187 142 19 119 424
39 308 222 81 65
78 311 384 102 164
436 184 275 429 209
344 158 18 207 131
58 156 79 198 121
424 113 23 69 486
285 276 288 170 165
163 15 113 282 172
13 282 408 449 426
211 52 22 417 381
33 289 311 40 223
427 136 476 487 246
322 421 351 168 456
56 489 290 471 397
92 400 382 ...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #79:

score: 0
Accepted
time: 121ms
memory: 6004kb

input:

500 5
441 264 229 408 374
437 202 247 278 154
40 495 377 213 251
462 20 449 351 407
119 98 153 449 305
226 270 100 359 450
228 255 58 111 409
287 375 95 229 232
368 9 55 1 146
58 234 22 41 77
453 25 312 14 422
235 364 340 281 467
252 305 433 38 100
234 487 56 56 385
33 280 492 134 344
155 1 27 263 3...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #80:

score: 0
Accepted
time: 115ms
memory: 6044kb

input:

500 5
126 120 236 448 448
491 6 342 107 309
194 99 335 242 347
305 137 498 238 382
301 219 246 219 436
394 328 117 20 483
179 259 418 389 26
266 244 49 259 474
432 26 160 240 24
339 139 358 390 499
354 432 24 197 401
8 78 304 394 490
198 260 277 447 229
376 102 78 306 16
159 207 90 324 244
53 410 36...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers

Test #81:

score: 0
Accepted
time: 140ms
memory: 6136kb

input:

500 5
213 401 495 228 342
273 449 238 256 12
313 413 179 140 460
421 308 487 227 272
147 61 404 385 119
123 70 374 196 399
34 148 465 245 95
204 317 397 120 445
48 62 471 132 313
145 405 402 312 122
187 464 192 394 179
499 202 283 36 231
183 465 207 258 300
287 133 156 11 265
201 275 208 454 163
391...

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 250000 numbers