QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#697247#4088. 총 쏘기Matutino21 3078ms127700kbC++173.3kb2024-11-01 12:26:052024-11-01 12:26:06

Judging History

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

  • [2024-11-01 12:26:06]
  • 评测
  • 测评结果:21
  • 用时:3078ms
  • 内存:127700kb
  • [2024-11-01 12:26:05]
  • 提交

answer

#include<bits/stdc++.h>
#define reg register
inline bool cmax(reg int &x,reg int y){return x<y?x=y,1:0;}
const int N=5e5+10;
int n,a[N],b[N],rk[N],g[N];
std::vector<int> vc[N];
struct BIT{
	int c[N];
	inline void mdf(reg int x,reg int k){for (;x<=n;x+=x&-x) cmax(c[x],k);}
	inline int qry(reg int x){reg int res=0;for (;x;x-=x&-x) cmax(res,c[x]); return res;}
}T;
namespace DS{
	int rt[N<<2],ls[N<<7],rs[N<<7],mx[N<<7],idx;
	void modify(reg int &o,reg int l,reg int r,reg int x,reg int k){
		if (!o) o=++idx; cmax(mx[o],k); if (l==r) return; reg int mid=l+r>>1;
		x<=mid?modify(ls[o],l,mid,x,k):modify(rs[o],mid+1,r,x,k);
	}
	void Modify(reg int o,reg int l,reg int r,reg int x,reg int y,reg int k){
		modify(rt[o],1,n,y,k); if (l==r) return; reg int mid=l+r>>1;
		x<=mid?Modify(o<<1,l,mid,x,y,k):Modify(o<<1|1,mid+1,r,x,y,k);
	}
	int query(reg int o,reg int l,reg int r,reg int L,reg int R){
		if (!o) return 0; if (L<=l&&r<=R) return mx[o]; reg int mid=l+r>>1,res=0;
		if (L<=mid) cmax(res,query(ls[o],l,mid,L,R)); if (R>mid) cmax(res,query(rs[o],mid+1,r,L,R)); return res;
	}
	int Query(reg int o,reg int l,reg int r,reg int L,reg int R,reg int p,reg int q){
		if (L<=l&&r<=R) return query(rt[o],1,n,L,R); reg int mid=l+r>>1,res=0;
		if (L<=mid) cmax(res,Query(o<<1,l,mid,L,R,p,q)); if (R>mid) cmax(res,Query(o<<1|1,mid+1,r,L,R,p,q)); return res;
	}
}
struct Segment{
	std::pair<int,int> mx[N<<2];
	void modify(reg int o,reg int l,reg int r,reg int x,reg std::pair<int,int> k){
		if (l==r) return mx[o]=k,void(); reg int mid=l+r>>1;
		x<=mid?modify(o<<1,l,mid,x,k):modify(o<<1|1,mid+1,r,x,k); mx[o]=std::max(mx[o<<1],mx[o<<1|1]);
	}
	std::pair<int,int> query(reg int o,reg int l,reg int r,reg int L,reg int R){
		if (L<=l&&r<=R) return mx[o]; reg int mid=l+r>>1; reg std::pair<int,int> res={0,0};
		if (L<=mid) res=std::max(res,query(o<<1,l,mid,L,R)); if (R>mid) res=std::max(res,query(o<<1|1,mid+1,r,L,R)); return res;
	}
}T2;
std::vector<std::pair<int,int>> min_shooting_buildings(std::vector<int> H){
	n=H.size(); for (reg int i=0;i<n;i++) g[a[i+1]=H[i]]=i+1; 
	for (reg int i=n;i;i--) vc[b[i]=T.qry(a[i])+1].push_back(i),T.mdf(a[i],b[i]);
	for (reg int i=1,cnt=0;i<=n;i++){
		std::sort(vc[i].begin(),vc[i].end(),[](reg int x,reg int y){
			if (x<y){if (a[x]>a[y]) return false; return DS::Query(1,1,n,x,y-1,1,a[x])<DS::Query(1,1,n,y,n,a[x]+1,a[y]);}
			else{if (a[x]<a[y]) return false; return DS::Query(1,1,n,x,n,a[y]+1,a[x])<DS::Query(1,1,n,y,x-1,1,a[y]);}
		});
		for (auto it:vc[i]) DS::Modify(1,1,n,it,a[it],rk[it]=++cnt);
	}
	std::priority_queue<std::pair<int,int>> pq;
	std::vector<std::pair<int,int>> ans;
	std::set<int> s;
	for (reg int i=1,pre=0;i<=n;i++){
		T2.modify(1,1,n,i,{a[i],i});
		if (pre<a[i]) pq.push({rk[i],i}),s.insert(a[i]),pre=a[i];
	}
	auto del=[&](reg int x)->void {
		s.erase(a[x]),T2.modify(1,1,n,x,{0,0});
		auto it=s.upper_bound(x);
		reg int r=it==s.end()?n:g[*it]-1,mn=0;
		if (it!=s.begin()) mn=*--it;
		while (x<r){
			auto [v,p]=T2.query(1,1,n,x,r); if (v<=mn) break;
			s.insert(v),pq.push({rk[p],p}),r=p-1;
		}
	};
	while (!pq.empty()){
		auto [px,x]=pq.top(); pq.pop();
		// std::cerr<<x<<"\n";
		if (!pq.empty()){
			auto [py,y]=pq.top(); pq.pop();
			ans.push_back({a[x],a[y]}),del(y); 
		}else ans.push_back({a[x],a[x]}); del(x);
	}
	return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 17
Accepted
time: 0ms
memory: 24284kb

input:

8
4 3 8 2 1 7 6 5

output:

4
8 4
3 7
2 6
1 5

result:

ok Correct

Test #2:

score: 17
Accepted
time: 0ms
memory: 24316kb

input:

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

output:

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

result:

ok Correct

Test #3:

score: 0
Wrong Answer
time: 3ms
memory: 24608kb

input:

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

output:

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

result:

wrong answer Incorrect

Subtask #2:

score: 12
Accepted

Test #26:

score: 12
Accepted
time: 3ms
memory: 24348kb

input:

8
5 6 7 1 2 8 3 4

output:

4
7 6
5 8
1 2
3 4

result:

ok Correct

Test #27:

score: 12
Accepted
time: 3ms
memory: 24608kb

input:

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

output:

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

result:

ok Correct

Test #28:

score: 12
Accepted
time: 3ms
memory: 24348kb

input:

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

output:

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

result:

ok Correct

Test #29:

score: 12
Accepted
time: 0ms
memory: 22304kb

input:

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

output:

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

result:

ok Correct

Test #30:

score: 12
Accepted
time: 0ms
memory: 22352kb

input:

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

output:

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

result:

ok Correct

Test #31:

score: 12
Accepted
time: 0ms
memory: 22284kb

input:

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

output:

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

result:

ok Correct

Test #32:

score: 12
Accepted
time: 0ms
memory: 24384kb

input:

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

output:

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

result:

ok Correct

Test #33:

score: 12
Accepted
time: 3ms
memory: 22792kb

input:

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

output:

248
341 340
333 332
329 328
326 322
320 319
318 315
312 309
306 305
304 302
301 300
299 297
293 291
289 285
284 282
281 279
278 277
276 275
272 270
269 268
267 265
263 260
259 256
254 253
252 251
250 248
245 243
242 240
239 237
236 235
232 231
230 229
228 227
225 223
219 212
211 209
208 206
205 204
...

result:

ok Correct

Test #34:

score: 12
Accepted
time: 3ms
memory: 22484kb

input:

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

output:

248
361 359
358 357
356 355
350 340
339 337
335 334
332 331
324 320
318 317
316 308
306 303
300 297
294 290
289 288
287 285
284 281
279 278
277 274
273 271
270 268
265 260
258 254
253 252
248 246
245 241
240 239
234 233
231 227
225 224
223 222
220 219
217 216
213 212
211 209
208 206
205 199
197 195
...

result:

ok Correct

Test #35:

score: 12
Accepted
time: 3ms
memory: 24648kb

input:

497
6 1 2 10 11 3 12 4 15 5 7 8 16 17 18 19 21 25 26 30 31 9 32 13 14 20 33 35 37 40 41 43 22 45 23 46 24 27 49 50 28 52 53 29 54 58 59 34 36 38 39 42 44 47 61 48 51 63 55 67 68 69 56 57 72 60 62 77 78 79 80 64 65 82 85 87 88 66 89 91 98 102 70 104 71 111 112 113 117 118 120 73 125 129 130 74 75 131...

output:

249
371 370
368 367
366 364
363 362
360 357
356 353
352 349
347 345
343 342
336 334
332 331
329 328
327 326
325 324
317 316
312 309
306 305
304 303
301 300
295 294
292 291
290 288
287 286
285 283
281 278
277 272
270 269
268 267
264 262
261 260
259 258
253 252
251 249
248 247
245 242
241 240
235 231
...

result:

ok Correct

Test #36:

score: 12
Accepted
time: 3ms
memory: 22572kb

input:

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

output:

249
323 322
321 320
318 316
313 312
310 309
307 306
304 302
300 297
294 293
290 288
287 286
285 282
281 280
276 275
274 272
271 269
268 266
265 264
261 259
258 256
253 249
241 240
239 237
233 230
229 226
224 220
219 216
215 214
213 210
208 207
202 200
199 197
195 194
193 191
188 185
184 183
180 179
...

result:

ok Correct

Test #37:

score: 12
Accepted
time: 0ms
memory: 22632kb

input:

499
5 7 11 12 13 1 17 18 20 22 24 2 3 25 26 27 4 29 31 6 32 33 8 9 10 14 15 34 35 16 19 21 23 28 41 30 36 37 42 45 38 39 46 49 40 50 51 43 52 44 47 48 54 59 53 65 55 67 68 71 56 57 74 75 78 79 58 81 86 87 88 89 60 91 61 98 99 100 102 103 112 62 113 63 114 64 115 116 66 117 69 120 70 121 72 122 124 7...

output:

250
380 379
378 377
373 371
367 366
364 362
357 356
355 354
353 352
351 350
348 345
344 341
339 337
332 331
330 328
326 325
324 323
322 321
319 316
315 314
312 309
307 302
297 294
293 291
290 289
287 286
282 281
280 275
274 273
271 269
268 261
259 258
257 253
250 248
246 244
243 242
241 240
239 238
...

result:

ok Correct

Test #38:

score: 12
Accepted
time: 2ms
memory: 22808kb

input:

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

output:

250
363 362
360 359
358 357
355 351
349 346
342 339
338 336
327 322
321 320
318 317
316 315
314 313
309 308
307 306
305 304
303 302
301 299
297 294
293 290
289 284
283 281
279 273
272 267
266 265
263 258
256 255
254 253
251 248
247 245
243 241
239 238
237 233
231 230
227 225
221 220
219 218
217 215
...

result:

ok Correct

Test #39:

score: 12
Accepted
time: 108ms
memory: 30544kb

input:

7495
1 3 5 7 8 2 10 4 11 13 6 14 17 9 21 12 15 23 25 26 16 18 31 19 20 32 35 36 37 42 22 45 46 24 27 28 47 48 49 29 51 52 58 60 30 33 34 38 62 63 39 40 64 65 66 70 72 73 41 74 43 75 77 44 50 53 78 79 54 81 82 55 56 83 57 87 88 89 93 59 61 67 68 97 69 100 102 107 108 110 112 113 118 119 120 71 124 12...

output:

3748
5128 5126
5125 5122
5119 5116
5115 5114
5111 5110
5108 5107
5104 5103
5102 5101
5100 5099
5096 5095
5094 5091
5090 5086
5084 5082
5079 5076
5074 5072
5070 5069
5067 5066
5063 5062
5061 5060
5058 5057
5055 5051
5050 5049
5048 5047
5045 5044
5043 5040
5039 5037
5036 5034
5029 5028
5026 5023
5020 ...

result:

ok Correct

Test #40:

score: 12
Accepted
time: 100ms
memory: 30324kb

input:

7496
4 8 9 14 16 1 19 2 3 5 6 20 21 23 7 25 32 10 33 34 35 36 38 11 39 12 40 13 15 17 43 45 46 47 18 48 51 54 22 58 61 24 62 67 68 26 27 28 72 29 73 75 76 80 30 81 31 37 41 42 82 83 44 85 49 87 50 91 100 52 53 55 56 57 101 103 104 105 106 59 107 109 112 60 63 64 114 122 65 124 66 126 69 70 71 74 127...

output:

3748
5165 5162
5159 5156
5154 5151
5150 5147
5146 5143
5142 5140
5138 5134
5133 5130
5129 5128
5126 5125
5124 5120
5119 5118
5117 5116
5114 5111
5110 5109
5108 5106
5103 5102
5101 5099
5098 5096
5094 5089
5086 5085
5080 5079
5078 5073
5072 5063
5059 5057
5056 5055
5054 5052
5050 5046
5042 5036
5035 ...

result:

ok Correct

Test #41:

score: 12
Accepted
time: 102ms
memory: 28476kb

input:

7497
4 1 7 11 14 15 18 22 2 23 3 5 26 34 35 6 8 36 38 9 10 12 13 39 40 43 44 45 16 17 47 48 49 19 50 57 59 60 20 21 24 25 62 27 28 64 67 68 29 30 31 71 76 77 79 32 81 33 82 84 85 86 87 88 37 41 90 92 93 95 42 96 97 103 105 46 51 52 53 107 108 109 110 54 55 111 112 113 56 115 58 61 63 117 65 118 119 ...

output:

3749
5134 5133
5132 5130
5129 5128
5127 5124
5121 5120
5119 5114
5111 5110
5108 5107
5106 5105
5104 5103
5102 5101
5100 5098
5097 5096
5095 5094
5093 5091
5086 5085
5083 5081
5080 5079
5078 5077
5076 5075
5074 5073
5072 5070
5066 5062
5060 5059
5058 5057
5056 5055
5054 5051
5048 5047
5046 5044
5043 ...

result:

ok Correct

Test #42:

score: 12
Accepted
time: 108ms
memory: 30136kb

input:

7498
4 5 6 1 9 2 3 7 8 13 10 16 17 20 21 25 11 26 28 12 14 15 18 19 22 23 24 30 31 27 33 29 32 39 48 34 35 49 36 51 37 54 38 40 55 41 56 42 43 57 58 59 44 61 64 65 45 71 46 47 50 52 72 53 73 77 78 60 62 88 92 93 63 66 95 99 67 68 100 69 70 74 75 101 76 79 102 103 106 80 81 109 115 116 117 82 120 124...

output:

3749
5162 5156
5155 5151
5149 5148
5146 5145
5143 5137
5136 5133
5130 5127
5126 5123
5115 5114
5113 5110
5108 5107
5106 5105
5100 5099
5097 5096
5095 5094
5090 5087
5082 5080
5078 5077
5072 5071
5069 5064
5063 5062
5060 5057
5055 5054
5052 5051
5049 5048
5047 5046
5044 5043
5041 5040
5037 5036
5033 ...

result:

ok Correct

Test #43:

score: 12
Accepted
time: 108ms
memory: 30236kb

input:

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

output:

3750
5053 5051
5050 5049
5046 5045
5042 5041
5038 5035
5033 5032
5028 5026
5025 5023
5022 5021
5019 5017
5016 5013
5012 5011
5008 5007
5006 5004
5001 5000
4999 4998
4993 4992
4988 4984
4983 4982
4981 4979
4978 4976
4973 4972
4971 4970
4969 4968
4967 4966
4960 4959
4955 4953
4951 4949
4948 4946
4944 ...

result:

ok Correct

Test #44:

score: 12
Accepted
time: 98ms
memory: 30228kb

input:

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

output:

3750
5120 5117
5116 5115
5114 5113
5112 5111
5110 5109
5108 5107
5106 5105
5103 5100
5099 5098
5094 5092
5091 5090
5089 5088
5087 5086
5085 5080
5076 5072
5071 5069
5066 5063
5062 5056
5055 5050
5047 5046
5044 5038
5036 5034
5033 5029
5027 5026
5023 5022
5018 5015
5013 5010
5009 5008
5005 5004
5002 ...

result:

ok Correct

Test #45:

score: 12
Accepted
time: 3033ms
memory: 125240kb

input:

99995
4 5 6 8 10 1 11 2 3 14 16 19 21 7 22 9 24 26 27 12 29 31 35 43 13 47 15 17 48 18 51 20 23 25 28 52 53 55 30 56 58 32 60 61 33 34 36 63 37 38 64 65 39 66 70 40 72 77 86 88 89 41 42 44 45 46 91 49 93 94 95 98 100 50 101 54 102 103 57 59 62 67 104 108 68 112 116 117 118 119 69 120 71 73 74 123 12...

output:

49998
67444 67442
67441 67438
67436 67433
67431 67429
67427 67426
67425 67423
67422 67420
67413 67412
67410 67408
67406 67403
67402 67401
67400 67397
67394 67392
67391 67390
67389 67385
67384 67382
67381 67380
67376 67370
67369 67368
67367 67364
67363 67362
67361 67359
67357 67351
67350 67346
67343 ...

result:

ok Correct

Test #46:

score: 12
Accepted
time: 3078ms
memory: 123512kb

input:

99996
4 1 2 5 7 3 6 10 8 9 16 17 18 11 20 12 13 14 21 15 27 28 30 31 32 19 22 23 33 37 38 40 41 24 25 42 43 44 47 26 29 48 34 35 50 36 39 53 45 59 46 62 49 51 63 69 70 52 54 73 55 75 82 83 89 96 56 97 98 99 57 100 58 101 107 60 109 110 112 61 64 65 66 113 114 67 116 120 122 130 68 131 71 137 72 74 7...

output:

49998
67242 67241
67239 67238
67236 67234
67233 67232
67229 67228
67226 67224
67221 67219
67214 67213
67207 67206
67204 67197
67194 67193
67188 67187
67186 67183
67182 67181
67180 67179
67174 67172
67168 67167
67165 67163
67162 67161
67160 67155
67154 67150
67145 67144
67143 67142
67141 67139
67133 ...

result:

ok Correct

Test #47:

score: 12
Accepted
time: 2941ms
memory: 127700kb

input:

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

output:

49999
67309 67308
67304 67302
67301 67299
67297 67296
67295 67294
67293 67292
67291 67290
67289 67288
67283 67282
67279 67278
67277 67276
67275 67274
67268 67263
67259 67258
67257 67255
67253 67251
67248 67242
67239 67238
67235 67232
67231 67229
67226 67223
67222 67221
67218 67216
67215 67214
67212 ...

result:

ok Correct

Test #48:

score: 12
Accepted
time: 3074ms
memory: 123228kb

input:

99998
2 1 4 6 3 5 8 12 7 17 9 18 20 22 25 26 28 10 34 35 11 13 40 14 43 46 15 16 19 47 48 21 51 52 53 23 55 24 57 27 29 30 31 59 32 63 65 66 68 33 69 36 70 71 37 72 74 38 39 75 41 77 42 79 81 83 85 86 89 44 90 91 45 49 92 95 96 98 50 100 104 54 56 58 107 109 110 60 61 111 113 62 115 64 118 123 125 6...

output:

49999
66791 66789
66788 66787
66785 66783
66781 66780
66779 66778
66777 66771
66770 66768
66766 66764
66763 66762
66760 66759
66758 66752
66751 66750
66749 66747
66746 66743
66742 66737
66736 66735
66732 66729
66727 66726
66725 66721
66719 66717
66716 66715
66714 66713
66709 66708
66707 66705
66704 ...

result:

ok Correct

Test #49:

score: 12
Accepted
time: 2981ms
memory: 127672kb

input:

99999
2 4 8 1 9 10 3 13 5 14 6 7 18 11 12 29 32 34 15 41 42 16 17 19 20 21 43 47 54 22 23 24 56 25 26 57 27 58 59 28 30 61 31 63 33 35 36 65 66 37 38 69 70 39 40 74 44 75 45 46 48 49 50 51 52 53 55 60 76 62 64 77 78 79 67 81 68 85 87 88 93 94 98 102 105 110 112 113 114 115 71 116 72 118 73 121 122 1...

output:

50000
67190 67189
67188 67187
67185 67184
67182 67180
67178 67177
67176 67175
67174 67171
67167 67166
67164 67162
67161 67160
67157 67156
67155 67152
67151 67150
67147 67145
67144 67143
67140 67134
67129 67124
67121 67118
67116 67115
67109 67108
67107 67105
67104 67103
67102 67101
67100 67099
67098 ...

result:

ok Correct

Test #50:

score: 12
Accepted
time: 2467ms
memory: 123776kb

input:

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

output:

50000
67130 67129
67128 67126
67123 67121
67120 67119
67118 67117
67110 67107
67106 67102
67101 67100
67099 67098
67097 67096
67095 67091
67090 67089
67088 67087
67084 67083
67082 67081
67075 67074
67070 67067
67064 67062
67059 67056
67055 67054
67053 67052
67050 67048
67047 67046
67045 67043
67042 ...

result:

ok Correct

Subtask #3:

score: 9
Accepted

Test #51:

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

input:

1
1

output:

1
1 1

result:

ok Correct

Test #52:

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

input:

2
1 2

output:

1
1 2

result:

ok Correct

Test #53:

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

input:

2
2 1

output:

2
2 2
1 1

result:

ok Correct

Test #54:

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

input:

3
1 3 2

output:

2
3 1
2 2

result:

ok Correct

Test #55:

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

input:

3
2 1 3

output:

2
2 3
1 1

result:

ok Correct

Test #56:

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

input:

3
2 3 1

output:

2
2 3
1 1

result:

ok Correct

Test #57:

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

input:

3
3 1 2

output:

2
3 3
1 2

result:

ok Correct

Test #58:

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

input:

4
2 1 4 3

output:

2
2 4
1 3

result:

ok Correct

Test #59:

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

input:

4
2 4 1 3

output:

2
4 2
1 3

result:

ok Correct

Test #60:

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

input:

4
3 1 4 2

output:

2
3 4
1 2

result:

ok Correct

Test #61:

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

input:

4
3 4 1 2

output:

2
4 3
1 2

result:

ok Correct

Test #62:

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

input:

3
3 2 1

output:

3
3 3
2 2
1 1

result:

ok Correct

Test #63:

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

input:

4
1 4 3 2

output:

3
4 1
3 3
2 2

result:

ok Correct

Test #64:

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

input:

4
2 4 3 1

output:

3
4 2
3 3
1 1

result:

ok Correct

Test #65:

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

input:

4
3 2 1 4

output:

3
3 4
2 2
1 1

result:

ok Correct

Test #66:

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

input:

4
3 2 4 1

output:

3
3 4
2 2
1 1

result:

ok Correct

Test #67:

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

input:

4
3 4 2 1

output:

3
4 3
2 2
1 1

result:

ok Correct

Test #68:

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

input:

4
4 1 3 2

output:

3
4 4
3 1
2 2

result:

ok Correct

Test #69:

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

input:

4
4 2 1 3

output:

3
4 4
2 3
1 1

result:

ok Correct

Test #70:

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

input:

4
4 2 3 1

output:

3
4 4
2 3
1 1

result:

ok Correct

Test #71:

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

input:

4
4 3 1 2

output:

3
4 4
3 3
1 2

result:

ok Correct

Test #72:

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

input:

4
4 3 2 1

output:

4
4 4
3 3
2 2
1 1

result:

ok Correct

Test #73:

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

input:

3
1 2 3

output:

2
1 2
3 3

result:

ok Correct

Test #74:

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

input:

4
1 2 3 4

output:

2
1 2
3 4

result:

ok Correct

Test #75:

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

input:

4
1 2 4 3

output:

2
4 1
2 3

result:

ok Correct

Test #76:

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

input:

4
1 3 2 4

output:

2
3 1
2 4

result:

ok Correct

Test #77:

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

input:

4
1 3 4 2

output:

2
3 4
1 2

result:

ok Correct

Test #78:

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

input:

4
1 4 2 3

output:

2
4 1
2 3

result:

ok Correct

Test #79:

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

input:

4
2 1 3 4

output:

2
2 3
1 4

result:

ok Correct

Test #80:

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

input:

4
2 3 1 4

output:

2
3 2
1 4

result:

ok Correct

Test #81:

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

input:

4
2 3 4 1

output:

3
2 3
4 4
1 1

result:

ok Correct

Test #82:

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

input:

4
3 1 2 4

output:

2
3 4
1 2

result:

ok Correct

Test #83:

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

input:

4
4 1 2 3

output:

3
4 4
1 2
3 3

result:

ok Correct

Subtask #4:

score: 0
Wrong Answer

Dependency #3:

100%
Accepted

Test #84:

score: 0
Wrong Answer
time: 3ms
memory: 24316kb

input:

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

output:

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

result:

wrong answer Incorrect

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%