QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#750924#8650. Island Hopping275307894a30 9ms3964kbC++141.3kb2024-11-15 16:22:472024-11-15 16:22:49

Judging History

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

  • [2024-11-15 16:22:49]
  • 评测
  • 测评结果:30
  • 用时:9ms
  • 内存:3964kb
  • [2024-11-15 16:22:47]
  • 提交

answer

#include "island.h"
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e5+5,M=N*4+5,K=1000+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,siz[N],fa[N];
int GF(int x){return fa[x]^x?fa[x]=GF(fa[x]):x;}
void solve(int nn, int lim) {
	n=nn;
	for(int i=1;i<=n;i++) siz[i]=1,fa[i]=i;
	for(int i=1;i<=n;i++){
		for(int j=siz[i];j<n;j++){
			int x=query(i,j);
			if(GF(x)==GF(i)||query(x,siz[x])^i) break;
			gdb(x,i,j);
			answer(x,i);siz[x]++;fa[GF(x)]=GF(i);
		}
	}
}

详细

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 1ms
memory: 3856kb

input:

3 9
3
1
0
2
3
3
2
0
1

output:

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

result:

ok 

Test #2:

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

input:

3 9
3
1
0
2
3
3
2
0
1

output:

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

result:

ok 

Test #3:

score: 2
Accepted
time: 1ms
memory: 3900kb

input:

3 9
2
1
0
3
2
3
2
0
1

output:

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

result:

ok 

Subtask #2:

score: 4
Accepted

Test #4:

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

input:

299 89401
79
1
0
213
1
0
20
89
242
2
0
286
2
0
129
271
192
3
0
244
3
0
6
29
69
4
0
227
4
0
148
69
99
5
0
233
5
0
178
52
29
6
0
244
6
0
3
272
7
0
277
7
0
73
147
54
8
0
83
8
0
50
48
67
9
0
149
9
0
145
149
72
10
0
276
10
0
61
162
163
11
0
278
11
0
41
163
196
12
0
226
12
0
29
226
216
13
0
239
13
0
202
1...

output:

1 1
79 1
-1 79
1 2
213 1
-1 213
1 3
20 1
2 1
242 1
-2 242
2 2
286 1
-2 286
2 3
129 1
3 1
192 1
-3 192
3 2
244 1
-3 244
3 3
6 1
4 1
69 1
-4 69
4 2
227 1
-4 227
4 3
148 1
5 1
99 1
-5 99
5 2
233 1
-5 233
5 3
178 1
6 1
29 1
-6 29
6 2
244 2
-6 244
6 3
7 1
272 1
-7 272
7 2
277 1
-7 277
7 3
73 1
8 1
54 1
-...

result:

ok 

Test #5:

score: 4
Accepted
time: 9ms
memory: 3920kb

input:

300 90000
15
1
0
220
1
0
55
27
17
2
0
130
2
0
53
17
10
3
0
200
3
0
174
10
153
4
0
269
4
0
73
153
43
5
0
147
5
0
137
41
12
6
0
36
6
0
162
36
32
7
0
50
7
0
219
50
178
8
0
218
8
0
157
148
14
9
0
181
9
0
158
113
174
10
0
85
174
79
11
0
208
11
0
90
123
261
12
0
36
44
13
0
260
13
0
100
44
295
14
0
20
159
...

output:

1 1
15 1
-1 15
1 2
220 1
-1 220
1 3
55 1
2 1
17 1
-2 17
2 2
130 1
-2 130
2 3
53 1
3 1
10 1
-3 10
3 2
200 1
-3 200
3 3
174 1
4 1
153 1
-4 153
4 2
269 1
-4 269
4 3
73 1
5 1
43 1
-5 43
5 2
147 1
-5 147
5 3
137 1
6 1
12 1
-6 12
6 2
36 1
-6 36
6 3
162 1
7 1
32 1
-7 32
7 2
50 1
-7 50
7 3
219 1
8 1
178 1
-...

result:

ok 

Test #6:

score: 4
Accepted
time: 6ms
memory: 3900kb

input:

300 90000
171
1
0
201
1
0
22
57
20
2
0
209
2
0
12
209
47
3
0
131
3
0
41
47
17
4
0
250
4
0
57
22
208
5
0
284
5
0
153
52
27
6
0
83
6
0
41
47
25
7
0
61
7
0
189
25
119
8
0
196
8
0
10
167
40
9
0
157
9
0
15
157
167
10
0
196
10
0
8
62
11
0
100
11
0
98
100
209
12
0
256
12
0
2
163
13
0
184
13
0
107
163
65
14...

output:

1 1
171 1
-1 171
1 2
201 1
-1 201
1 3
22 1
2 1
20 1
-2 20
2 2
209 1
-2 209
2 3
12 1
3 1
47 1
-3 47
3 2
131 1
-3 131
3 3
41 1
4 1
17 1
-4 17
4 2
250 1
-4 250
4 3
57 1
5 1
208 1
-5 208
5 2
284 1
-5 284
5 3
153 1
6 1
27 1
-6 27
6 2
83 1
-6 83
6 3
41 1
7 1
25 1
-7 25
7 2
61 1
-7 61
7 3
189 1
8 1
119 1
-...

result:

ok 

Test #7:

score: 4
Accepted
time: 6ms
memory: 3920kb

input:

300 90000
176
1
0
297
1
0
55
275
43
2
0
45
2
0
64
43
168
3
0
254
3
0
215
79
100
4
0
285
4
0
149
100
290
5
0
291
5
0
46
207
171
6
0
234
6
0
114
227
121
7
0
299
7
0
68
121
196
8
0
238
8
0
13
238
199
9
0
210
9
0
73
42
189
10
0
232
10
0
150
112
12
11
0
261
11
0
50
146
284
12
0
187
36
238
13
0
251
13
0
8...

output:

1 1
176 1
-1 176
1 2
297 1
-1 297
1 3
55 1
2 1
43 1
-2 43
2 2
45 1
-2 45
2 3
64 1
3 1
168 1
-3 168
3 2
254 1
-3 254
3 3
215 1
4 1
100 1
-4 100
4 2
285 1
-4 285
4 3
149 1
5 1
290 1
-5 290
5 2
291 1
-5 291
5 3
46 1
6 1
171 1
-6 171
6 2
234 1
-6 234
6 3
114 1
7 1
121 1
-7 121
7 2
299 1
-7 299
7 3
68 1
...

result:

ok 

Test #8:

score: 4
Accepted
time: 6ms
memory: 3908kb

input:

300 90000
96
1
0
162
1
0
26
162
28
2
0
282
2
0
266
236
19
3
0
239
3
0
127
19
107
4
0
161
4
0
55
107
160
5
0
165
5
0
56
36
259
6
0
271
6
0
91
271
34
7
0
90
7
0
202
90
114
8
0
169
8
0
88
114
78
9
0
188
9
0
42
78
92
10
0
146
10
0
71
63
219
11
0
226
11
0
97
219
100
12
0
258
12
0
147
60
61
13
0
140
13
0
...

output:

1 1
96 1
-1 96
1 2
162 1
-1 162
1 3
26 1
2 1
28 1
-2 28
2 2
282 1
-2 282
2 3
266 1
3 1
19 1
-3 19
3 2
239 1
-3 239
3 3
127 1
4 1
107 1
-4 107
4 2
161 1
-4 161
4 3
55 1
5 1
160 1
-5 160
5 2
165 1
-5 165
5 3
56 1
6 1
259 1
-6 259
6 2
271 1
-6 271
6 3
91 1
7 1
34 1
-7 34
7 2
90 1
-7 90
7 3
202 1
8 1
11...

result:

ok 

Subtask #3:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 5ms
memory: 3964kb

input:

299 598
43
1
0
151
1
0
66
43
91
2
0
119
2
0
124
36
7
3
0
130
3
0
181
7
115
4
0
139
4
0
129
115
50
5
0
109
5
0
55
50
157
6
0
176
6
0
107
157
181
7
0
130
106
8
0
138
8
0
18
103
147
9
0
235
9
0
82
24
44
10
0
197
10
0
100
44
31
11
0
64
11
0
79
31
150
12
0
210
12
0
71
25
195
13
0
271
13
0
178
155
113
14
...

output:

1 1
43 1
-1 43
1 2
151 1
-1 151
1 3
66 1
2 1
91 1
-2 91
2 2
119 1
-2 119
2 3
124 1
3 1
7 1
-3 7
3 2
130 1
-3 130
3 3
181 1
4 1
115 1
-4 115
4 2
139 1
-4 139
4 3
129 1
5 1
50 1
-5 50
5 2
109 1
-5 109
5 3
55 1
6 1
157 1
-6 157
6 2
176 1
-6 176
6 3
107 1
7 2
181 1
-7 181
7 3
8 1
106 1
-8 106
8 2
138 1
...

result:

wrong answer Wrong Answer [3]

Subtask #4:

score: 9
Accepted

Test #15:

score: 9
Accepted
time: 0ms
memory: 3916kb

input:

299 89401
29
1
0
35
1
0
171
1
0
87
35
153
2
0
230
2
0
163
230
166
3
0
181
3
0
7
166
54
4
0
266
4
0
70
54
65
5
0
159
5
0
77
132
75
6
0
176
6
0
217
75
166
7
0
241
7
0
3
9
8
0
83
8
0
22
83
250
9
0
83
88
10
0
141
10
0
136
141
19
11
0
68
19
193
12
0
224
12
0
125
63
154
13
0
215
13
0
119
154
26
14
0
228
1...

output:

1 1
29 1
-1 29
1 2
35 1
-1 35
1 3
171 1
-1 171
1 4
87 1
2 1
153 1
-2 153
2 2
230 1
-2 230
2 3
163 1
3 1
166 1
-3 166
3 2
181 1
-3 181
3 3
7 1
4 1
54 1
-4 54
4 2
266 1
-4 266
4 3
70 1
5 1
65 1
-5 65
5 2
159 1
-5 159
5 3
77 1
6 1
75 1
-6 75
6 2
176 1
-6 176
6 3
217 1
7 1
166 2
-7 166
7 2
241 1
-7 241
...

result:

ok 

Test #16:

score: 9
Accepted
time: 3ms
memory: 3776kb

input:

300 90000
28
1
0
60
1
0
183
1
0
26
60
74
2
0
142
2
0
5
74
200
3
0
229
3
0
96
186
257
4
0
295
4
0
14
257
74
5
0
221
5
0
2
67
6
0
25
67
119
7
0
163
7
0
143
119
23
8
0
276
8
0
226
62
185
9
0
231
9
0
116
131
239
10
0
277
10
0
178
39
244
11
0
285
11
0
57
172
19
12
0
132
12
0
148
19
109
13
0
173
13
0
143
...

output:

1 1
28 1
-1 28
1 2
60 1
-1 60
1 3
183 1
-1 183
1 4
26 1
2 1
74 1
-2 74
2 2
142 1
-2 142
2 3
5 1
3 1
200 1
-3 200
3 2
229 1
-3 229
3 3
96 1
4 1
257 1
-4 257
4 2
295 1
-4 295
4 3
14 1
5 1
74 2
-5 74
5 2
221 1
-5 221
5 3
6 1
67 1
-6 67
6 2
25 1
7 1
119 1
-7 119
7 2
163 1
-7 163
7 3
143 1
8 1
23 1
-8 23...

result:

ok 

Test #17:

score: 9
Accepted
time: 0ms
memory: 3920kb

input:

300 90000
24
1
0
162
1
0
167
1
0
16
72
129
2
0
268
2
0
31
129
21
3
0
285
3
0
93
21
151
4
0
225
4
0
244
151
32
5
0
258
5
0
207
32
68
6
0
248
6
0
121
125
19
7
0
260
7
0
126
13
133
8
0
292
8
0
134
60
152
9
0
195
9
0
43
23
30
10
0
173
10
0
107
30
27
11
0
149
11
0
138
27
200
12
0
267
12
0
145
144
37
13
0...

output:

1 1
24 1
-1 24
1 2
162 1
-1 162
1 3
167 1
-1 167
1 4
16 1
2 1
129 1
-2 129
2 2
268 1
-2 268
2 3
31 1
3 1
21 1
-3 21
3 2
285 1
-3 285
3 3
93 1
4 1
151 1
-4 151
4 2
225 1
-4 225
4 3
244 1
5 1
32 1
-5 32
5 2
258 1
-5 258
5 3
207 1
6 1
68 1
-6 68
6 2
248 1
-6 248
6 3
121 1
7 1
19 1
-7 19
7 2
260 1
-7 26...

result:

ok 

Test #18:

score: 9
Accepted
time: 0ms
memory: 3940kb

input:

300 90000
107
1
0
138
1
0
277
1
0
62
33
125
2
0
178
2
0
68
19
147
3
0
196
3
0
162
147
143
4
0
158
4
0
71
63
199
5
0
282
5
0
194
145
56
6
0
202
6
0
50
47
54
7
0
201
7
0
202
54
205
8
0
206
8
0
169
22
67
9
0
136
9
0
92
67
155
10
0
214
10
0
74
131
18
11
0
270
11
0
154
14
112
12
0
279
12
0
103
73
77
13
0...

output:

1 1
107 1
-1 107
1 2
138 1
-1 138
1 3
277 1
-1 277
1 4
62 1
2 1
125 1
-2 125
2 2
178 1
-2 178
2 3
68 1
3 1
147 1
-3 147
3 2
196 1
-3 196
3 3
162 1
4 1
143 1
-4 143
4 2
158 1
-4 158
4 3
71 1
5 1
199 1
-5 199
5 2
282 1
-5 282
5 3
194 1
6 1
56 1
-6 56
6 2
202 1
-6 202
6 3
50 1
7 1
54 1
-7 54
7 2
201 1
...

result:

ok 

Test #19:

score: 9
Accepted
time: 0ms
memory: 3860kb

input:

300 90000
65
1
0
88
1
0
283
1
0
4
232
54
2
0
267
2
0
84
32
189
3
0
274
3
0
153
189
232
4
0
283
4
0
1
81
5
0
128
5
0
42
86
168
6
0
276
6
0
49
276
243
7
0
246
7
0
194
11
108
8
0
225
8
0
166
96
216
9
0
254
9
0
149
66
123
10
0
143
10
0
53
143
19
11
0
194
11
0
242
19
220
12
0
287
12
0
110
107
45
13
0
182...

output:

1 1
65 1
-1 65
1 2
88 1
-1 88
1 3
283 1
-1 283
1 4
4 1
2 1
54 1
-2 54
2 2
267 1
-2 267
2 3
84 1
3 1
189 1
-3 189
3 2
274 1
-3 274
3 3
153 1
4 1
232 1
-4 232
4 2
283 2
-4 283
4 3
5 1
81 1
-5 81
5 2
128 1
-5 128
5 3
42 1
6 1
168 1
-6 168
6 2
276 1
-6 276
6 3
49 1
7 1
243 1
-7 243
7 2
246 1
-7 246
7 3
...

result:

ok 

Test #20:

score: 9
Accepted
time: 8ms
memory: 3900kb

input:

299 89401
124
1
0
149
1
0
153
1
0
13
124
18
2
0
254
2
0
31
4
76
3
0
202
3
0
228
76
23
4
0
31
4
0
18
31
27
5
0
196
5
0
81
196
112
6
0
193
6
0
75
193
130
7
0
215
7
0
181
130
66
8
0
119
8
0
116
80
85
9
0
247
9
0
35
43
163
10
0
185
10
0
54
163
39
11
0
259
11
0
106
39
28
12
0
126
12
0
43
28
124
13
0
180
...

output:

1 1
124 1
-1 124
1 2
149 1
-1 149
1 3
153 1
-1 153
1 4
13 1
2 1
18 1
-2 18
2 2
254 1
-2 254
2 3
31 1
3 1
76 1
-3 76
3 2
202 1
-3 202
3 3
228 1
4 1
23 1
-4 23
4 2
31 1
-4 31
4 3
18 2
5 1
27 1
-5 27
5 2
196 1
-5 196
5 3
81 1
6 1
112 1
-6 112
6 2
193 1
-6 193
6 3
75 1
7 1
130 1
-7 130
7 2
215 1
-7 215
...

result:

ok 

Test #21:

score: 9
Accepted
time: 0ms
memory: 3956kb

input:

300 90000
107
1
0
159
1
0
183
1
0
224
63
151
2
0
263
2
0
122
170
196
3
0
210
3
0
44
179
68
4
0
86
4
0
95
86
165
5
0
276
5
0
123
151
198
6
0
286
6
0
20
26
133
7
0
176
7
0
102
8
102
8
0
137
8
0
49
137
136
9
0
138
9
0
131
136
75
10
0
78
10
0
132
75
73
11
0
222
11
0
12
73
73
12
0
153
12
0
11
58
13
0
74
...

output:

1 1
107 1
-1 107
1 2
159 1
-1 159
1 3
183 1
-1 183
1 4
224 1
2 1
151 1
-2 151
2 2
263 1
-2 263
2 3
122 1
3 1
196 1
-3 196
3 2
210 1
-3 210
3 3
44 1
4 1
68 1
-4 68
4 2
86 1
-4 86
4 3
95 1
5 1
165 1
-5 165
5 2
276 1
-5 276
5 3
123 1
6 1
198 1
-6 198
6 2
286 1
-6 286
6 3
20 1
7 1
133 1
-7 133
7 2
176 1...

result:

ok 

Test #22:

score: 9
Accepted
time: 0ms
memory: 3900kb

input:

300 90000
38
1
0
112
1
0
211
1
0
50
38
244
2
0
261
2
0
54
114
265
3
0
290
3
0
77
134
125
4
0
126
4
0
64
126
224
5
0
264
5
0
106
221
67
6
0
98
6
0
66
98
79
7
0
148
7
0
62
56
61
8
0
162
8
0
50
38
76
9
0
177
9
0
157
82
227
10
0
229
10
0
107
227
137
11
0
197
11
0
182
197
145
12
0
217
12
0
236
145
31
13
...

output:

1 1
38 1
-1 38
1 2
112 1
-1 112
1 3
211 1
-1 211
1 4
50 1
2 1
244 1
-2 244
2 2
261 1
-2 261
2 3
54 1
3 1
265 1
-3 265
3 2
290 1
-3 290
3 3
77 1
4 1
125 1
-4 125
4 2
126 1
-4 126
4 3
64 1
5 1
224 1
-5 224
5 2
264 1
-5 264
5 3
106 1
6 1
67 1
-6 67
6 2
98 1
-6 98
6 3
66 1
7 1
79 1
-7 79
7 2
148 1
-7 14...

result:

ok 

Subtask #5:

score: 0
Wrong Answer

Test #23:

score: 0
Wrong Answer
time: 0ms
memory: 3900kb

input:

299 897
140
1
0
269
1
0
276
1
0
57
256
39
2
0
121
2
0
87
34
67
3
0
86
3
0
54
86
214
4
0
262
4
0
55
214
234
5
0
244
5
0
84
159
122
6
0
146
6
0
245
146
174
7
0
240
7
0
69
131
227
8
0
237
8
0
123
227
206
9
0
281
9
0
48
91
65
10
0
275
10
0
172
241
41
11
0
254
11
0
38
41
211
12
0
272
12
0
161
211
117
13
...

output:

1 1
140 1
-1 140
1 2
269 1
-1 269
1 3
276 1
-1 276
1 4
57 1
2 1
39 1
-2 39
2 2
121 1
-2 121
2 3
87 1
3 1
67 1
-3 67
3 2
86 1
-3 86
3 3
54 1
4 1
214 1
-4 214
4 2
262 1
-4 262
4 3
55 1
5 1
234 1
-5 234
5 2
244 1
-5 244
5 3
84 1
6 1
122 1
-6 122
6 2
146 1
-6 146
6 3
245 1
7 1
174 1
-7 174
7 2
240 1
-7 ...

result:

wrong answer Wrong Answer [3]

Subtask #6:

score: 15
Accepted

Test #32:

score: 15
Accepted
time: 8ms
memory: 3960kb

input:

300 90000
133
1
0
179
1
0
89
133
82
2
0
47
82
65
3
0
165
65
266
4
0
283
4
0
48
128
29
5
0
40
5
0
59
5
0
11
29
24
6
0
35
6
0
41
6
0
132
41
28
7
0
234
7
0
18
234
86
8
0
199
86
186
9
0
299
54
109
10
0
231
10
0
271
10
0
51
109
29
11
0
221
11
0
5
105
12
0
112
12
0
131
12
0
17
131
128
13
0
277
13
0
48
128...

output:

1 1
133 1
-1 133
1 2
179 1
-1 179
1 3
89 1
2 1
82 1
-2 82
2 2
47 1
3 1
65 1
-3 65
3 2
165 1
4 1
266 1
-4 266
4 2
283 1
-4 283
4 3
48 1
5 1
29 1
-5 29
5 2
40 1
-5 40
5 3
59 1
-5 59
5 4
11 1
6 1
24 1
-6 24
6 2
35 1
-6 35
6 3
41 1
-6 41
6 4
132 1
7 1
28 1
-7 28
7 2
234 1
-7 234
7 3
18 1
8 1
86 1
-8 86
...

result:

ok 

Test #33:

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

input:

300 90000
293
1
0
136
88
82
2
0
108
2
0
193
2
0
57
108
168
3
0
218
3
0
43
102
123
4
0
208
4
0
258
4
0
22
258
196
5
0
284
83
8
6
0
254
6
0
256
6
0
18
8
12
7
0
78
12
18
8
0
192
8
0
26
192
71
9
0
127
9
0
77
71
122
10
0
246
10
0
264
10
0
143
195
44
11
0
61
11
0
198
11
0
97
24
78
12
0
132
12
0
66
132
238...

output:

1 1
293 1
-1 293
1 2
136 1
2 1
82 1
-2 82
2 2
108 1
-2 108
2 3
193 1
-2 193
2 4
57 1
3 1
168 1
-3 168
3 2
218 1
-3 218
3 3
43 1
4 1
123 1
-4 123
4 2
208 1
-4 208
4 3
258 1
-4 258
4 4
22 1
5 1
196 1
-5 196
5 2
284 1
6 1
8 1
-6 8
6 2
254 1
-6 254
6 3
256 1
-6 256
6 4
18 1
7 1
12 1
-7 12
7 2
78 1
8 2
1...

result:

ok 

Test #34:

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

input:

300 90000
14
1
0
84
1
0
62
84
4
2
0
93
2
0
189
2
0
46
4
114
3
0
185
3
0
100
129
46
4
0
297
4
0
93
200
5
0
170
126
175
6
0
26
10
286
7
0
288
7
0
91
42
156
8
0
169
8
0
234
8
0
13
234
201
9
0
199
180
26
10
0
208
10
0
219
10
0
120
208
216
11
0
280
11
0
58
105
140
12
0
80
81
234
13
0
8
180
14
0
184
14
0
...

output:

1 1
14 1
-1 14
1 2
84 1
-1 84
1 3
62 1
2 1
4 1
-2 4
2 2
93 1
-2 93
2 3
189 1
-2 189
2 4
46 1
3 1
114 1
-3 114
3 2
185 1
-3 185
3 3
100 1
4 2
46 1
-4 46
4 3
297 1
-4 297
4 4
5 1
200 1
-5 200
5 2
170 1
6 1
175 1
-6 175
6 2
26 1
7 1
286 1
-7 286
7 2
288 1
-7 288
7 3
91 1
8 1
156 1
-8 156
8 2
169 1
-8 1...

result:

ok 

Test #35:

score: 15
Accepted
time: 4ms
memory: 3912kb

input:

300 90000
79
1
0
293
79
89
2
0
137
2
0
193
2
0
55
54
20
3
0
61
20
15
4
0
54
4
0
185
4
0
24
15
65
5
0
101
5
0
157
5
0
71
50
187
6
0
209
40
56
7
0
99
7
0
164
7
0
70
37
110
8
0
122
8
0
228
8
0
190
47
26
9
0
149
26
29
10
0
232
29
141
11
0
109
141
168
12
0
128
168
14
13
0
63
13
0
115
13
0
152
14
152
14
0...

output:

1 1
79 1
-1 79
1 2
293 1
2 1
89 1
-2 89
2 2
137 1
-2 137
2 3
193 1
-2 193
2 4
55 1
3 1
20 1
-3 20
3 2
61 1
4 1
15 1
-4 15
4 2
54 1
-4 54
4 3
185 1
-4 185
4 4
24 1
5 1
65 1
-5 65
5 2
101 1
-5 101
5 3
157 1
-5 157
5 4
71 1
6 1
187 1
-6 187
6 2
209 1
7 1
56 1
-7 56
7 2
99 1
-7 99
7 3
164 1
-7 164
7 4
7...

result:

ok 

Test #36:

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

input:

300 90000
67
1
0
154
1
0
241
1
0
142
67
88
2
0
232
88
226
3
0
151
66
149
4
0
192
4
0
201
4
0
115
60
90
5
0
109
5
0
208
5
0
13
109
10
6
0
42
6
0
116
6
0
59
116
162
7
0
13
109
44
8
0
77
8
0
173
8
0
30
173
257
9
0
102
38
168
10
0
242
10
0
42
275
11
0
107
275
231
12
0
56
231
109
13
0
162
13
0
217
13
0
5...

output:

1 1
67 1
-1 67
1 2
154 1
-1 154
1 3
241 1
-1 241
1 4
142 1
2 1
88 1
-2 88
2 2
232 1
3 1
226 1
-3 226
3 2
151 1
4 1
149 1
-4 149
4 2
192 1
-4 192
4 3
201 1
-4 201
4 4
115 1
5 1
90 1
-5 90
5 2
109 1
-5 109
5 3
208 1
-5 208
5 4
13 1
6 1
10 1
-6 10
6 2
42 1
-6 42
6 3
116 1
-6 116
6 4
59 1
7 1
162 1
-7 1...

result:

ok 

Test #37:

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

input:

300 90000
248
1
0
285
1
0
290
1
0
209
64
293
2
0
109
293
230
3
0
26
230
121
4
0
24
121
80
5
0
196
80
161
6
0
211
6
0
249
6
0
54
211
28
7
0
165
7
0
267
7
0
13
28
175
8
0
142
175
146
9
0
167
58
179
10
0
238
10
0
239
10
0
119
179
156
11
0
164
20
138
12
0
216
12
0
245
12
0
68
137
28
13
0
7
28
14
0
7
203...

output:

1 1
248 1
-1 248
1 2
285 1
-1 285
1 3
290 1
-1 290
1 4
209 1
2 1
293 1
-2 293
2 2
109 1
3 1
230 1
-3 230
3 2
26 1
4 1
121 1
-4 121
4 2
24 1
5 1
80 1
-5 80
5 2
196 1
6 1
161 1
-6 161
6 2
211 1
-6 211
6 3
249 1
-6 249
6 4
54 1
7 1
28 1
-7 28
7 2
165 1
-7 165
7 3
267 1
-7 267
7 4
13 1
8 1
175 1
-8 175
...

result:

ok 

Test #38:

score: 15
Accepted
time: 6ms
memory: 3920kb

input:

299 89401
75
1
0
202
1
0
85
121
33
2
0
240
2
0
136
33
66
3
0
5
66
74
4
0
86
4
0
25
86
66
5
0
3
97
6
0
163
6
0
236
97
66
7
0
3
17
8
0
205
8
0
42
17
66
9
0
3
55
10
0
237
10
0
151
140
66
11
0
3
22
12
0
186
12
0
130
71
43
13
0
231
13
0
98
43
66
14
0
3
36
15
0
125
15
0
183
50
170
16
0
277
16
0
77
129
42
...

output:

1 1
75 1
-1 75
1 2
202 1
-1 202
1 3
85 1
2 1
33 1
-2 33
2 2
240 1
-2 240
2 3
136 1
3 1
66 1
-3 66
3 2
5 1
4 1
74 1
-4 74
4 2
86 1
-4 86
4 3
25 1
5 1
66 2
-5 66
5 2
6 1
97 1
-6 97
6 2
163 1
-6 163
6 3
236 1
7 1
66 3
-7 66
7 2
8 1
17 1
-8 17
8 2
205 1
-8 205
8 3
42 1
9 1
66 4
-9 66
9 2
10 1
55 1
-10 5...

result:

ok 

Test #39:

score: 15
Accepted
time: 8ms
memory: 3916kb

input:

300 90000
243
1
0
3
243
31
2
0
232
2
0
48
163
243
3
0
1
243
4
0
1
52
5
0
106
5
0
60
28
102
6
0
239
6
0
96
138
182
7
0
236
7
0
92
154
192
8
0
255
8
0
72
255
243
9
0
1
243
10
0
1
33
11
0
107
11
0
39
100
243
12
0
1
67
13
0
267
13
0
63
112
243
14
0
1
243
15
0
1
120
16
0
130
16
0
158
130
36
17
0
175
17
0...

output:

1 1
243 1
-1 243
1 2
3 1
2 1
31 1
-2 31
2 2
232 1
-2 232
2 3
48 1
3 1
243 2
-3 243
3 2
4 1
243 3
-4 243
4 2
5 1
52 1
-5 52
5 2
106 1
-5 106
5 3
60 1
6 1
102 1
-6 102
6 2
239 1
-6 239
6 3
96 1
7 1
182 1
-7 182
7 2
236 1
-7 236
7 3
92 1
8 1
192 1
-8 192
8 2
255 1
-8 255
8 3
72 1
9 1
243 4
-9 243
9 2
1...

result:

ok 

Test #40:

score: 15
Accepted
time: 6ms
memory: 3852kb

input:

300 90000
2
1
0
5
2
5
2
0
8
5
4
3
0
6
4
6
4
0
7
6
8
5
0
1
7
6
0
3
10
7
0
4
9
8
0
2
10
9
0
5
12
10
0
6
12
11
0
10
15
12
0
7
14
13
0
16
14
16
14
0
18
15
18
15
0
10
18
16
0
13
20
17
0
23
20
21
18
0
12
22
19
0
24
21
23
20
0
25
23
24
21
0
15
24
22
0
21
25
23
0
17
26
24
0
18
27
25
0
20
28
26
0
21
29
27
0
...

output:

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

result:

ok 

Test #41:

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

input:

300 90000
123
1
0
89
123
101
2
0
102
101
80
3
0
4
80
80
4
0
3
109
5
0
227
109
33
6
0
74
33
55
7
0
19
55
96
8
0
186
96
87
9
0
63
87
42
10
0
162
42
127
11
0
184
82
56
12
0
40
56
115
13
0
206
76
34
14
0
170
34
116
15
0
28
116
75
16
0
46
75
90
17
0
191
90
107
18
0
87
63
55
19
0
7
98
20
0
222
77
67
21
0
...

output:

1 1
123 1
-1 123
1 2
89 1
2 1
101 1
-2 101
2 2
102 1
3 1
80 1
-3 80
3 2
4 1
4 1
80 2
-4 80
4 2
5 1
109 1
-5 109
5 2
227 1
6 1
33 1
-6 33
6 2
74 1
7 1
55 1
-7 55
7 2
19 1
8 1
96 1
-8 96
8 2
186 1
9 1
87 1
-9 87
9 2
63 1
10 1
42 1
-10 42
10 2
162 1
11 1
127 1
-11 127
11 2
184 1
12 1
56 1
-12 56
12 2
4...

result:

ok 

Test #42:

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

input:

300 90000
265
1
0
106
265
240
2
0
255
149
49
3
0
119
49
298
4
0
169
29
60
5
0
86
52
212
6
0
198
129
229
7
0
228
118
147
8
0
251
112
216
9
0
61
216
102
10
0
79
39
200
11
0
144
200
105
12
0
24
105
128
13
0
209
128
151
14
0
47
151
133
15
0
40
133
120
16
0
77
120
196
17
0
230
67
215
18
0
186
141
142
19
...

output:

1 1
265 1
-1 265
1 2
106 1
2 1
240 1
-2 240
2 2
255 1
3 1
49 1
-3 49
3 2
119 1
4 1
298 1
-4 298
4 2
169 1
5 1
60 1
-5 60
5 2
86 1
6 1
212 1
-6 212
6 2
198 1
7 1
229 1
-7 229
7 2
228 1
8 1
147 1
-8 147
8 2
251 1
9 1
216 1
-9 216
9 2
61 1
10 1
102 1
-10 102
10 2
79 1
11 1
200 1
-11 200
11 2
144 1
12 1...

result:

ok 

Test #43:

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

input:

299 89401
89
1
0
149
1
0
253
1
0
291
1
0
297
1
0
298
1
0
299
1
0
103
53
204
2
0
277
204
40
3
0
100
40
56
4
0
186
12
155
5
0
105
155
136
6
0
138
136
254
7
0
87
254
260
8
0
130
260
94
9
0
14
94
187
10
0
54
187
77
11
0
98
63
186
12
0
56
186
227
13
0
260
130
94
14
0
9
180
15
0
129
59
124
16
0
240
124
24...

output:

1 1
89 1
-1 89
1 2
149 1
-1 149
1 3
253 1
-1 253
1 4
291 1
-1 291
1 5
297 1
-1 297
1 6
298 1
-1 298
1 7
299 1
-1 299
1 8
103 1
2 1
204 1
-2 204
2 2
277 1
3 1
40 1
-3 40
3 2
100 1
4 1
56 1
-4 56
4 2
186 1
5 1
155 1
-5 155
5 2
105 1
6 1
136 1
-6 136
6 2
138 1
7 1
254 1
-7 254
7 2
87 1
8 1
260 1
-8 260...

result:

ok 

Test #44:

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

input:

300 90000
150
1
0
223
1
0
279
1
0
280
1
0
287
1
0
290
1
0
295
1
0
298
1
0
299
1
0
300
1
0
60
295
256
2
0
182
116
242
3
0
206
242
159
4
0
98
159
247
5
0
147
32
140
6
0
90
24
232
7
0
94
59
12
8
0
169
12
259
9
0
275
111
139
10
0
186
75
63
11
0
112
63
169
12
0
282
91
207
13
0
144
207
269
14
0
287
255
10...

output:

1 1
150 1
-1 150
1 2
223 1
-1 223
1 3
279 1
-1 279
1 4
280 1
-1 280
1 5
287 1
-1 287
1 6
290 1
-1 290
1 7
295 1
-1 295
1 8
298 1
-1 298
1 9
299 1
-1 299
1 10
300 1
-1 300
1 11
60 1
2 1
256 1
-2 256
2 2
182 1
3 1
242 1
-3 242
3 2
206 1
4 1
159 1
-4 159
4 2
98 1
5 1
247 1
-5 247
5 2
147 1
6 1
140 1
-6...

result:

ok 

Test #45:

score: 15
Accepted
time: 9ms
memory: 3896kb

input:

299 89401
202
1
0
235
3
240
2
0
235
3
133
3
0
235
3
0
4
86
86
4
0
235
4
0
3
100
5
0
235
5
0
3
97
6
0
235
6
0
3
265
7
0
235
9
205
8
0
235
9
213
9
0
235
9
0
3
55
10
0
235
11
235
11
0
241
11
0
3
186
12
0
235
12
0
3
231
13
0
235
14
215
14
0
235
14
0
3
125
15
0
235
16
235
16
0
277
16
0
3
42
17
0
235
17
0...

output:

1 1
202 1
-1 202
1 2
235 1
2 1
240 1
-2 240
2 2
235 1
3 1
133 1
-3 133
3 2
235 1
-3 235
3 3
4 1
4 1
86 1
-4 86
4 2
235 2
-4 235
4 3
5 1
100 1
-5 100
5 2
235 3
-5 235
5 3
6 1
97 1
-6 97
6 2
235 4
-6 235
6 3
7 1
265 1
-7 265
7 2
235 5
8 1
205 1
-8 205
8 2
235 5
9 1
213 1
-9 213
9 2
235 5
-9 235
9 3
10...

result:

ok 

Test #46:

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

input:

300 90000
142
1
0
94
2
94
2
0
232
2
0
3
94
94
3
0
281
3
0
2
94
4
0
268
4
0
2
52
5
0
94
6
94
6
0
239
6
0
2
182
7
0
94
9
255
8
0
94
9
94
9
0
237
9
0
2
116
10
0
94
11
94
11
0
107
11
0
2
56
12
0
94
15
267
13
0
94
15
97
14
0
94
15
18
15
0
94
15
0
2
94
16
0
130
16
0
2
36
17
0
94
17
0
2
94
207
19
0
94
21
2...

output:

1 1
142 1
-1 142
1 2
94 1
2 1
94 1
-2 94
2 2
232 1
-2 232
2 3
3 1
3 1
94 2
-3 94
3 2
281 1
-3 281
3 3
4 1
94 3
-4 94
4 2
268 1
-4 268
4 3
5 1
52 1
-5 52
5 2
94 4
6 1
94 4
-6 94
6 2
239 1
-6 239
6 3
7 1
182 1
-7 182
7 2
94 5
8 1
255 1
-8 255
8 2
94 5
9 1
94 5
-9 94
9 2
237 1
-9 237
9 3
10 1
116 1
-10...

result:

ok 

Test #47:

score: 15
Accepted
time: 8ms
memory: 3820kb

input:

300 90000
6
1
0
255
1
0
108
67
4
2
0
25
2
0
33
2
0
39
2
0
71
2
0
84
2
0
86
2
0
100
2
0
101
2
0
126
2
0
130
2
0
152
2
0
157
2
0
162
2
0
167
2
0
177
2
0
199
2
0
226
2
0
228
2
0
232
2
0
234
2
0
262
2
0
263
2
0
264
2
0
278
2
0
294
2
0
299
2
0
8
71
254
3
0
300
3
0
69
127
239
4
0
25
136
5
0
249
5
0
104
24...

output:

1 1
6 1
-1 6
1 2
255 1
-1 255
1 3
108 1
2 1
4 1
-2 4
2 2
25 1
-2 25
2 3
33 1
-2 33
2 4
39 1
-2 39
2 5
71 1
-2 71
2 6
84 1
-2 84
2 7
86 1
-2 86
2 8
100 1
-2 100
2 9
101 1
-2 101
2 10
126 1
-2 126
2 11
130 1
-2 130
2 12
152 1
-2 152
2 13
157 1
-2 157
2 14
162 1
-2 162
2 15
167 1
-2 167
2 16
177 1
-2 1...

result:

ok 

Test #48:

score: 15
Accepted
time: 6ms
memory: 3916kb

input:

300 90000
2
1
0
236
1
0
3
2
3
2
0
9
2
0
12
2
0
30
2
0
39
2
0
51
2
0
74
2
0
87
2
0
94
2
0
97
2
0
104
2
0
106
2
0
127
2
0
151
2
0
163
2
0
180
2
0
199
2
0
238
2
0
252
2
0
272
2
0
297
2
0
14
87
108
3
0
1
22
4
0
32
4
0
68
22
201
5
0
257
5
0
125
118
290
6
0
300
6
0
15
154
29
7
0
175
7
0
43
98
40
8
0
114
8...

output:

1 1
2 1
-1 2
1 2
236 1
-1 236
1 3
3 1
2 2
3 1
-2 3
2 3
9 1
-2 9
2 4
12 1
-2 12
2 5
30 1
-2 30
2 6
39 1
-2 39
2 7
51 1
-2 51
2 8
74 1
-2 74
2 9
87 1
-2 87
2 10
94 1
-2 94
2 11
97 1
-2 97
2 12
104 1
-2 104
2 13
106 1
-2 106
2 14
127 1
-2 127
2 15
151 1
-2 151
2 16
163 1
-2 163
2 17
180 1
-2 180
2 18
1...

result:

ok 

Test #49:

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

input:

299 89401
17
1
0
19
1
0
69
1
0
239
1
0
2
239
239
2
0
1
117
3
0
30
112
169
4
0
234
4
0
52
19
149
5
0
34
149
91
6
0
266
6
0
17
91
46
7
0
51
7
0
110
7
0
199
46
74
8
0
152
8
0
246
74
44
9
0
55
9
0
80
9
0
116
9
0
227
9
0
38
44
192
10
0
260
87
153
11
0
286
11
0
299
11
0
94
134
131
12
0
244
12
0
71
244
164...

output:

1 1
17 1
-1 17
1 2
19 1
-1 19
1 3
69 1
-1 69
1 4
239 1
-1 239
1 5
2 1
2 1
239 2
-2 239
2 2
3 1
117 1
-3 117
3 2
30 1
4 1
169 1
-4 169
4 2
234 1
-4 234
4 3
52 1
5 1
149 1
-5 149
5 2
34 1
6 1
91 1
-6 91
6 2
266 1
-6 266
6 3
17 2
7 1
46 1
-7 46
7 2
51 1
-7 51
7 3
110 1
-7 110
7 4
199 1
8 1
74 1
-8 74
8...

result:

ok 

Test #50:

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

input:

300 90000
55
1
0
253
1
0
261
1
0
58
144
39
2
0
206
2
0
99
29
153
3
0
6
104
53
4
0
95
4
0
191
4
0
70
53
56
5
0
270
5
0
95
270
104
6
0
153
6
0
3
10
7
0
256
7
0
123
97
150
8
0
249
8
0
34
150
51
9
0
120
51
287
10
0
42
277
72
11
0
264
72
171
12
0
30
171
47
13
0
148
47
45
14
0
87
14
0
173
28
160
15
0
246
...

output:

1 1
55 1
-1 55
1 2
253 1
-1 253
1 3
261 1
-1 261
1 4
58 1
2 1
39 1
-2 39
2 2
206 1
-2 206
2 3
99 1
3 1
153 1
-3 153
3 2
6 1
4 1
53 1
-4 53
4 2
95 1
-4 95
4 3
191 1
-4 191
4 4
70 1
5 1
56 1
-5 56
5 2
270 1
-5 270
5 3
95 2
6 1
104 1
-6 104
6 2
153 2
-6 153
6 3
7 1
10 1
-7 10
7 2
256 1
-7 256
7 3
123 1...

result:

ok 

Test #51:

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

input:

300 90000
70
1
0
126
1
0
125
126
27
2
0
156
2
0
54
27
116
3
0
218
3
0
62
178
180
4
0
211
4
0
14
96
80
5
0
151
57
67
6
0
255
6
0
70
255
26
7
0
73
7
0
202
7
0
146
9
167
8
0
14
96
146
9
0
282
9
0
26
146
89
10
0
90
10
0
168
10
0
177
10
0
30
81
226
11
0
285
226
206
12
0
74
51
44
13
0
152
13
0
253
13
0
12...

output:

1 1
70 1
-1 70
1 2
126 1
-1 126
1 3
125 1
2 1
27 1
-2 27
2 2
156 1
-2 156
2 3
54 1
3 1
116 1
-3 116
3 2
218 1
-3 218
3 3
62 1
4 1
180 1
-4 180
4 2
211 1
-4 211
4 3
14 1
5 1
80 1
-5 80
5 2
151 1
6 1
67 1
-6 67
6 2
255 1
-6 255
6 3
70 2
7 1
26 1
-7 26
7 2
73 1
-7 73
7 3
202 1
-7 202
7 4
146 1
8 1
167 ...

result:

ok 

Test #52:

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

input:

300 90000
297
1
0
55
267
64
2
0
109
2
0
269
2
0
175
64
57
3
0
168
3
0
164
51
149
4
0
253
4
0
100
149
154
5
0
207
5
0
291
5
0
46
270
26
6
0
114
6
0
171
6
0
265
6
0
71
26
121
7
0
222
7
0
299
7
0
50
222
13
8
0
196
8
0
23
13
73
9
0
298
9
0
199
73
202
10
0
27
74
146
11
0
187
11
0
286
34
36
12
0
261
12
0
...

output:

1 1
297 1
-1 297
1 2
55 1
2 1
64 1
-2 64
2 2
109 1
-2 109
2 3
269 1
-2 269
2 4
175 1
3 1
57 1
-3 57
3 2
168 1
-3 168
3 3
164 1
4 1
149 1
-4 149
4 2
253 1
-4 253
4 3
100 1
5 1
154 1
-5 154
5 2
207 1
-5 207
5 3
291 1
-5 291
5 4
46 1
6 1
26 1
-6 26
6 2
114 1
-6 114
6 3
171 1
-6 171
6 4
265 1
-6 265
6 5...

result:

ok 

Test #53:

score: 15
Accepted
time: 8ms
memory: 3916kb

input:

300 90000
7
1
0
96
1
0
162
1
0
105
37
59
2
0
273
43
271
3
0
189
6
179
4
0
267
51
240
5
0
279
22
150
6
0
189
6
0
16
189
96
51
8
0
184
51
34
9
0
194
9
0
22
172
19
10
0
175
19
224
11
0
84
224
160
12
0
52
160
89
13
0
176
89
108
14
0
65
108
142
15
0
218
15
0
96
105
189
16
0
6
168
17
0
178
17
0
249
17
0
2...

output:

1 1
7 1
-1 7
1 2
96 1
-1 96
1 3
162 1
-1 162
1 4
105 1
2 1
59 1
-2 59
2 2
273 1
3 1
271 1
-3 271
3 2
189 1
4 1
179 1
-4 179
4 2
267 1
5 1
240 1
-5 240
5 2
279 1
6 1
150 1
-6 150
6 2
189 1
-6 189
6 3
16 1
7 2
8 1
51 1
-8 51
8 2
184 1
9 1
34 1
-9 34
9 2
194 1
-9 194
9 3
22 1
10 1
19 1
-10 19
10 2
175 ...

result:

ok 

Test #54:

score: 15
Accepted
time: 5ms
memory: 3796kb

input:

300 90000
190
1
0
221
88
80
2
0
248
2
0
167
97
91
3
0
153
3
0
53
153
234
4
0
67
10
115
5
0
87
18
133
6
0
52
133
134
7
0
123
134
188
8
0
220
8
0
113
60
159
9
0
119
40
67
10
0
99
10
0
184
10
0
214
10
0
105
28
206
11
0
188
113
101
12
0
150
12
0
235
12
0
297
12
0
33
22
208
13
0
237
54
219
14
0
168
219
2...

output:

1 1
190 1
-1 190
1 2
221 1
2 1
80 1
-2 80
2 2
248 1
-2 248
2 3
167 1
3 1
91 1
-3 91
3 2
153 1
-3 153
3 3
53 1
4 1
234 1
-4 234
4 2
67 1
5 1
115 1
-5 115
5 2
87 1
6 1
133 1
-6 133
6 2
52 1
7 1
134 1
-7 134
7 2
123 1
8 1
188 1
-8 188
8 2
220 1
-8 220
8 3
113 1
9 1
159 1
-9 159
9 2
119 1
10 1
67 1
-10 ...

result:

ok 

Test #55:

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

input:

300 90000
6
1
0
255
1
0
108
67
4
2
0
25
2
0
33
2
0
39
2
0
71
2
0
84
2
0
86
2
0
100
2
0
101
2
0
126
2
0
130
2
0
152
2
0
157
2
0
162
2
0
167
2
0
177
2
0
199
2
0
226
2
0
228
2
0
232
2
0
234
2
0
262
2
0
263
2
0
264
2
0
278
2
0
294
2
0
299
2
0
8
71
254
3
0
300
3
0
69
127
239
4
0
25
136
5
0
249
5
0
104
24...

output:

1 1
6 1
-1 6
1 2
255 1
-1 255
1 3
108 1
2 1
4 1
-2 4
2 2
25 1
-2 25
2 3
33 1
-2 33
2 4
39 1
-2 39
2 5
71 1
-2 71
2 6
84 1
-2 84
2 7
86 1
-2 86
2 8
100 1
-2 100
2 9
101 1
-2 101
2 10
126 1
-2 126
2 11
130 1
-2 130
2 12
152 1
-2 152
2 13
157 1
-2 157
2 14
162 1
-2 162
2 15
167 1
-2 167
2 16
177 1
-2 1...

result:

ok 

Test #56:

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

input:

300 90000
2
1
0
236
1
0
3
2
3
2
0
9
2
0
12
2
0
30
2
0
39
2
0
51
2
0
74
2
0
87
2
0
94
2
0
97
2
0
104
2
0
106
2
0
127
2
0
151
2
0
163
2
0
180
2
0
199
2
0
238
2
0
252
2
0
272
2
0
297
2
0
14
87
108
3
0
1
22
4
0
32
4
0
68
22
201
5
0
257
5
0
125
118
290
6
0
300
6
0
15
154
29
7
0
175
7
0
43
98
40
8
0
114
8...

output:

1 1
2 1
-1 2
1 2
236 1
-1 236
1 3
3 1
2 2
3 1
-2 3
2 3
9 1
-2 9
2 4
12 1
-2 12
2 5
30 1
-2 30
2 6
39 1
-2 39
2 7
51 1
-2 51
2 8
74 1
-2 74
2 9
87 1
-2 87
2 10
94 1
-2 94
2 11
97 1
-2 97
2 12
104 1
-2 104
2 13
106 1
-2 106
2 14
127 1
-2 127
2 15
151 1
-2 151
2 16
163 1
-2 163
2 17
180 1
-2 180
2 18
1...

result:

ok 

Test #57:

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

input:

300 90000
103
1
0
231
1
0
193
2
8
2
0
20
2
0
58
2
0
83
2
0
101
2
0
102
2
0
115
2
0
139
2
0
149
2
0
165
2
0
178
2
0
193
2
0
198
2
0
203
2
0
205
2
0
221
2
0
228
2
0
243
2
0
250
2
0
261
2
0
290
2
0
294
2
0
298
2
0
5
57
163
3
0
233
163
207
4
0
236
143
57
5
0
115
5
0
2
172
6
0
191
6
0
134
44
71
7
0
229
7...

output:

1 1
103 1
-1 103
1 2
231 1
-1 231
1 3
193 1
2 1
8 1
-2 8
2 2
20 1
-2 20
2 3
58 1
-2 58
2 4
83 1
-2 83
2 5
101 1
-2 101
2 6
102 1
-2 102
2 7
115 1
-2 115
2 8
139 1
-2 139
2 9
149 1
-2 149
2 10
165 1
-2 165
2 11
178 1
-2 178
2 12
193 1
-2 193
2 13
198 1
-2 198
2 14
203 1
-2 203
2 15
205 1
-2 205
2 16
...

result:

ok 

Subtask #7:

score: 0
Wrong Answer

Test #58:

score: 0
Wrong Answer
time: 8ms
memory: 3920kb

input:

300 900
201
1
0
228
1
0
171
10
88
2
0
262
88
97
3
0
104
3
0
101
97
35
4
0
183
4
0
236
4
0
61
34
96
5
0
98
5
0
269
5
0
58
96
70
6
0
138
6
0
163
70
60
7
0
141
7
0
13
141
23
8
0
80
8
0
290
8
0
112
143
46
9
0
51
39
76
10
0
171
10
0
40
76
43
11
0
180
11
0
206
11
0
36
43
69
12
0
203
12
0
280
12
0
151
69
1...

output:

1 1
201 1
-1 201
1 2
228 1
-1 228
1 3
171 1
2 1
88 1
-2 88
2 2
262 1
3 1
97 1
-3 97
3 2
104 1
-3 104
3 3
101 1
4 1
35 1
-4 35
4 2
183 1
-4 183
4 3
236 1
-4 236
4 4
61 1
5 1
96 1
-5 96
5 2
98 1
-5 98
5 3
269 1
-5 269
5 4
58 1
6 1
70 1
-6 70
6 2
138 1
-6 138
6 3
163 1
7 1
60 1
-7 60
7 2
141 1
-7 141
7...

result:

wrong answer Wrong Answer [3]

Subtask #8:

score: 0
Wrong Answer

Test #84:

score: 0
Wrong Answer
time: 2ms
memory: 3896kb

input:

299 598
86
1
0
94
1
0
224
94
79
2
0
228
2
0
42
57
49
3
0
166
3
0
234
23
124
4
0
138
83
257
5
0
262
5
0
296
5
0
77
110
51
6
0
129
6
0
158
6
0
40
129
214
7
0
55
51
20
8
0
206
8
0
28
20
50
9
0
64
9
0
105
9
0
32
24
177
10
0
262
77
200
11
0
209
11
0
186
26
238
12
0
150
35
66
13
0
223
13
0
122
223
15
14
0...

output:

1 1
86 1
-1 86
1 2
94 1
-1 94
1 3
224 1
2 1
79 1
-2 79
2 2
228 1
-2 228
2 3
42 1
3 1
49 1
-3 49
3 2
166 1
-3 166
3 3
234 1
4 1
124 1
-4 124
4 2
138 1
5 1
257 1
-5 257
5 2
262 1
-5 262
5 3
296 1
-5 296
5 4
77 1
6 1
51 1
-6 51
6 2
129 1
-6 129
6 3
158 1
-6 158
6 4
40 1
7 1
214 1
-7 214
7 2
55 1
8 1
20...

result:

wrong answer Wrong Answer [3]