QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#297894#4088. 총 쏘기C1942huangjiaxu50 3546ms11228kbC++142.0kb2024-01-05 13:04:462024-01-05 13:04:46

Judging History

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

  • [2024-01-05 13:04:46]
  • 评测
  • 测评结果:50
  • 用时:3546ms
  • 内存:11228kb
  • [2024-01-05 13:04:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5,T=50;
mt19937 rnd(time(0));
int n,f[N],a[N],p[N],tr[N],w[N<<2],ct,V;
set<int>S;
bool cmp(int x,int y){
	return f[x]==f[y]?p[x]<p[y]:f[x]<f[y];
}
priority_queue<int,vector<int>,decltype(&cmp)>q(cmp);
#define L k<<1
#define R k<<1|1
void pushup(int k){
	w[k]=max(w[L],w[R]);
}
void build(int k,int l,int r){
	if(l==r)return w[k]=a[l],void();
	int mid=l+r>>1;
	build(L,l,mid),build(R,mid+1,r);
	pushup(k);
}
void query(int k,int l,int r,int x,int y,int &Mx){
	if(w[k]<=Mx)return;
	if(l==r){
		Mx=w[k],w[k]=0;
		q.push(l);
		S.insert(l);
		return;
	}
	int mid=l+r>>1;
	if(x<=mid)query(L,l,mid,x,y,Mx);
	if(y>mid)query(R,mid+1,r,x,y,Mx);
	pushup(k);
}
void Pop(int u){
	++ct;
	int l,r;
	S.erase(u);
	auto it=S.lower_bound(u);
	r=*it;
	--it;
	l=*it;
	query(1,1,n,l+1,r-1,V=a[l]);
}
vector<pair<int,int> >calc(){
	shuffle(p+1,p+n+1,rnd);
	vector<pair<int,int> >res;
	ct=V=0;
	build(1,1,n);
	query(1,1,n,1,n,V=0);
	while(ct<n){
		if(q.size()==3){
			vector<int>tmp(3);
			tmp[0]=q.top(),q.pop();
			tmp[1]=q.top(),q.pop();
			tmp[2]=q.top(),q.pop();
			sort(tmp.begin(),tmp.end());
			if(f[tmp[0]]==f[tmp[2]]){
				q.push(tmp[0]);
				res.push_back(make_pair(a[tmp[1]],a[tmp[2]]));
				Pop(tmp[1]),Pop(tmp[2]);
			}else{
				for(auto v:tmp)q.push(v);
			}
		}
		if(q.size()==1){
			int u=q.top();
			q.pop();
			Pop(u);
			res.push_back(make_pair(a[u],a[u]));
		}else{
			int u=q.top();
			q.pop();
			int v=q.top();
			q.pop();
			Pop(u),Pop(v);
			res.push_back(make_pair(a[u],a[v]));
		}
	}
	return res;
}
vector<pair<int, int> > min_shooting_buildings(vector<int> H){
	n=H.size();
	S.insert(0),S.insert(n+1);
	for(int i=n;i;--i){
		a[i]=H[i-1],p[i]=i;
		for(int j=a[i];j;j-=j&-j)f[i]=max(f[i],tr[j]);
		++f[i];
		for(int j=a[i];j<=n;j+=j&-j)tr[j]=max(tr[j],f[i]);
	}
	vector<pair<int,int> >ans=calc();
	for(int i=1;i<=T;++i){
		vector<pair<int,int> >tmp=calc();
		if(tmp.size()<ans.size())ans=tmp;
	}
	return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 17
Accepted

Test #1:

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

input:

8
4 3 8 2 1 7 6 5

output:

4
4 8
7 3
2 6
1 5

result:

ok Correct

Test #2:

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

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
Accepted
time: 1ms
memory: 4068kb

input:

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

output:

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

result:

ok Correct

Test #4:

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

input:

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

output:

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

result:

ok Correct

Test #5:

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

input:

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

output:

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

result:

ok Correct

Test #6:

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

input:

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

output:

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

result:

ok Correct

Test #7:

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

input:

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

output:

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

result:

ok Correct

Test #8:

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

input:

495
492 491 487 481 495 494 493 480 490 478 489 488 477 486 485 475 472 484 483 471 468 482 479 466 465 463 476 461 460 459 474 457 473 455 454 470 469 453 452 467 450 449 464 462 448 447 458 456 443 451 446 442 445 437 436 435 434 433 429 444 427 426 441 440 439 424 423 438 421 419 416 432 413 431 ...

output:

250
495 492
494 491
493 487
490 481
489 480
488 478
486 477
485 485
475 484
483 472
482 471
479 468
466 476
465 474
463 473
461 470
460 469
459 467
457 464
455 462
454 458
453 456
452 452
450 451
449 449
448 448
447 447
443 446
445 442
444 437
436 441
435 440
434 439
433 438
429 432
427 431
430 426
...

result:

ok Correct

Test #9:

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

input:

496
493 491 486 496 481 495 494 492 490 489 473 488 487 472 469 468 485 484 483 464 482 480 463 479 478 477 460 458 476 475 457 456 474 471 455 454 470 453 452 467 449 448 447 446 466 437 465 436 433 432 430 428 462 426 461 425 424 421 420 419 459 417 416 451 410 450 409 408 407 445 405 444 443 442 ...

output:

262
496 493
495 491
494 486
492 481
490 490
489 489
488 473
487 487
485 472
484 469
483 468
482 464
480 480
479 463
478 478
477 477
460 476
458 475
474 457
471 456
455 470
454 467
453 466
452 465
449 462
448 461
447 459
446 451
437 450
436 445
433 444
432 443
430 442
428 441
426 440
425 439
424 438
...

result:

ok Correct

Test #10:

score: 0
Accepted
time: 5ms
memory: 6160kb

input:

497
496 492 490 489 497 495 494 493 488 486 485 484 480 478 491 487 475 483 474 482 471 468 465 464 460 459 481 458 457 456 479 477 455 453 476 473 450 444 443 440 472 439 470 469 435 433 467 432 430 466 429 463 462 428 461 425 420 419 454 418 452 451 416 449 415 413 412 448 409 402 401 400 447 399 ...

output:

259
497 496
495 492
490 494
493 489
488 491
486 487
485 485
484 484
480 483
478 482
475 481
474 479
471 477
468 476
465 473
464 472
460 470
459 469
458 467
457 466
456 463
455 462
453 461
450 454
444 452
443 451
440 449
439 448
435 447
433 446
432 445
430 442
429 441
428 438
425 437
420 436
419 434
...

result:

ok Correct

Test #11:

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

input:

498
496 495 494 493 498 497 489 492 491 488 485 490 487 482 486 484 481 479 478 475 483 474 480 477 476 473 471 464 472 462 470 469 459 458 456 468 467 454 466 453 465 450 448 446 463 461 460 445 440 457 455 437 452 434 451 449 433 432 431 428 427 425 447 444 443 442 422 441 419 439 438 436 418 435 ...

output:

272
496 498
495 497
494 494
493 493
492 489
491 491
490 488
487 485
486 482
484 484
481 483
479 480
478 478
477 475
474 476
473 473
471 472
470 464
469 462
468 459
467 458
466 456
465 454
463 453
461 450
460 448
457 446
455 445
452 440
451 437
449 434
447 433
444 432
443 431
442 428
441 427
439 425
...

result:

ok Correct

Test #12:

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

input:

499
498 496 492 499 497 495 494 493 491 489 486 484 481 490 488 487 478 485 483 474 465 482 464 480 463 461 460 479 477 459 476 456 475 455 473 472 471 470 453 469 452 451 448 447 468 467 446 445 466 439 434 433 462 458 457 454 450 449 432 444 443 430 442 441 428 440 438 437 427 422 436 421 420 418 ...

output:

266
498 499
497 496
495 492
494 494
493 493
491 491
489 490
488 486
487 484
485 481
483 478
482 474
480 465
479 464
477 463
476 461
475 460
473 459
472 456
471 455
470 470
469 453
468 452
467 451
466 448
462 447
458 446
457 445
454 439
450 434
449 433
444 432
443 443
442 430
441 441
440 428
438 438
...

result:

ok Correct

Test #13:

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

input:

500
499 500 495 490 498 489 497 496 488 486 484 482 478 477 476 475 494 493 470 492 491 469 468 467 487 463 458 485 483 481 450 444 442 480 479 441 474 473 472 440 439 438 437 471 436 435 466 434 430 465 429 428 425 424 423 464 422 421 462 461 460 459 419 417 415 457 413 456 455 454 453 452 411 410 ...

output:

254
500 499
498 495
497 490
496 489
488 494
486 493
484 492
482 491
478 487
477 485
476 483
475 481
470 480
469 479
468 474
467 473
463 472
458 471
450 466
444 465
442 464
441 462
440 461
439 460
438 459
437 457
436 456
435 455
434 454
430 453
429 452
428 451
425 449
424 448
423 447
422 446
421 445
...

result:

ok Correct

Test #14:

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

input:

7495
7495 7490 7488 7486 7494 7481 7480 7478 7477 7475 7463 7460 7459 7493 7492 7458 7491 7489 7487 7485 7457 7455 7484 7483 7454 7453 7452 7450 7448 7482 7444 7442 7440 7435 7479 7431 7476 7474 7426 7473 7423 7422 7421 7418 7472 7471 7470 7469 7468 7467 7414 7413 7411 7409 7408 7405 7466 7465 7403 ...

output:

3773
7495 7495
7490 7494
7488 7493
7486 7492
7481 7491
7480 7489
7478 7487
7477 7485
7475 7484
7463 7483
7460 7482
7459 7479
7458 7476
7457 7474
7455 7473
7454 7472
7453 7471
7452 7470
7450 7469
7448 7468
7444 7467
7442 7466
7440 7465
7435 7464
7431 7462
7426 7461
7423 7456
7422 7451
7421 7449
7418 ...

result:

ok Correct

Test #15:

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

input:

7496
7493 7496 7495 7490 7494 7489 7492 7491 7484 7476 7488 7487 7473 7471 7470 7468 7467 7465 7462 7456 7486 7455 7453 7451 7485 7446 7483 7482 7481 7480 7479 7478 7477 7445 7444 7475 7439 7435 7474 7472 7433 7432 7469 7430 7429 7428 7466 7464 7463 7427 7461 7460 7423 7422 7420 7459 7458 7418 7415 ...

output:

3779
7496 7493
7495 7495
7494 7490
7492 7489
7491 7491
7488 7484
7487 7476
7486 7473
7485 7471
7483 7470
7482 7468
7481 7467
7480 7465
7479 7462
7478 7456
7477 7455
7475 7453
7474 7451
7472 7446
7469 7445
7466 7444
7464 7439
7463 7435
7461 7433
7460 7432
7459 7430
7458 7429
7457 7428
7454 7427
7452 ...

result:

ok Correct

Test #16:

score: 0
Accepted
time: 74ms
memory: 6168kb

input:

7497
7493 7490 7489 7488 7487 7486 7497 7485 7496 7482 7495 7481 7480 7479 7478 7494 7492 7477 7470 7491 7469 7484 7483 7476 7468 7475 7466 7462 7474 7461 7473 7458 7457 7455 7472 7454 7453 7450 7447 7471 7445 7467 7465 7444 7464 7443 7442 7440 7463 7439 7460 7459 7438 7437 7435 7430 7456 7452 7427 ...

output:

3790
7493 7497
7490 7496
7489 7495
7488 7494
7487 7492
7486 7491
7485 7485
7482 7484
7481 7483
7480 7480
7479 7479
7478 7478
7477 7477
7470 7476
7469 7475
7468 7474
7466 7473
7462 7472
7461 7471
7458 7467
7457 7465
7455 7464
7454 7463
7453 7460
7450 7459
7447 7456
7445 7452
7444 7451
7443 7449
7442 ...

result:

ok Correct

Test #17:

score: 0
Accepted
time: 74ms
memory: 4180kb

input:

7498
7495 7494 7492 7488 7498 7497 7487 7486 7485 7496 7484 7483 7493 7491 7482 7490 7480 7489 7478 7477 7473 7472 7469 7481 7465 7464 7479 7476 7475 7463 7462 7459 7458 7474 7457 7456 7471 7470 7454 7452 7450 7447 7446 7468 7467 7444 7443 7439 7466 7438 7461 7437 7460 7455 7435 7434 7453 7433 7431 ...

output:

3768
7495 7498
7494 7497
7492 7496
7488 7493
7487 7491
7486 7490
7485 7489
7484 7484
7483 7483
7482 7482
7480 7481
7478 7479
7477 7477
7473 7476
7472 7475
7469 7474
7465 7471
7464 7470
7463 7468
7462 7467
7459 7466
7458 7461
7457 7460
7456 7456
7454 7455
7452 7453
7450 7451
7447 7449
7446 7448
7444 ...

result:

ok Correct

Test #18:

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

input:

7499
7498 7499 7491 7497 7496 7487 7495 7494 7485 7481 7479 7493 7492 7490 7489 7477 7488 7476 7471 7486 7470 7484 7464 7483 7463 7482 7460 7480 7459 7478 7475 7454 7452 7474 7473 7472 7451 7450 7449 7448 7446 7469 7468 7467 7466 7465 7443 7462 7438 7461 7458 7457 7456 7428 7455 7426 7425 7424 7423 ...

output:

3766
7499 7498
7497 7491
7496 7496
7495 7487
7494 7494
7493 7485
7492 7481
7490 7479
7489 7489
7488 7477
7486 7476
7484 7471
7483 7470
7482 7464
7480 7463
7478 7460
7475 7459
7474 7454
7473 7452
7472 7472
7469 7451
7468 7450
7467 7449
7466 7448
7465 7446
7462 7443
7461 7438
7458 7458
7457 7457
7456 ...

result:

ok Correct

Test #19:

score: 0
Accepted
time: 73ms
memory: 4184kb

input:

7500
7500 7498 7499 7497 7492 7490 7488 7485 7481 7479 7476 7471 7496 7470 7469 7495 7494 7466 7493 7491 7460 7489 7459 7458 7456 7455 7487 7453 7486 7450 7447 7484 7446 7443 7440 7436 7435 7483 7482 7430 7424 7423 7422 7480 7421 7478 7418 7416 7477 7413 7475 7411 7474 7473 7472 7468 7410 7467 7408 ...

output:

3788
7500 7500
7499 7498
7497 7497
7496 7492
7495 7490
7494 7488
7493 7485
7491 7481
7489 7479
7487 7476
7486 7471
7484 7470
7483 7469
7482 7466
7480 7460
7478 7459
7477 7458
7475 7456
7474 7455
7473 7453
7472 7450
7468 7447
7467 7446
7465 7443
7464 7440
7463 7436
7462 7435
7461 7430
7457 7424
7454 ...

result:

ok Correct

Test #20:

score: 0
Accepted
time: 1266ms
memory: 8292kb

input:

99995
99992 99990 99995 99994 99989 99993 99985 99991 99979 99974 99970 99988 99987 99986 99969 99984 99965 99983 99982 99964 99981 99962 99961 99960 99958 99955 99980 99953 99978 99951 99977 99976 99950 99975 99948 99946 99939 99973 99936 99935 99930 99928 99972 99924 99971 99968 99923 99922 99920 ...

output:

50171
99995 99992
99994 99990
99993 99989
99991 99985
99988 99979
99987 99974
99986 99970
99984 99969
99983 99965
99982 99982
99981 99964
99980 99962
99978 99961
99977 99960
99976 99958
99975 99955
99973 99953
99972 99951
99971 99950
99968 99948
99967 99946
99966 99939
99963 99936
99959 99935
99957 ...

result:

ok Correct

Test #21:

score: 0
Accepted
time: 1261ms
memory: 7908kb

input:

99996
99996 99994 99993 99992 99990 99995 99988 99991 99981 99989 99978 99975 99987 99974 99986 99973 99970 99985 99984 99983 99982 99980 99968 99979 99967 99964 99963 99960 99959 99956 99977 99976 99972 99971 99955 99954 99969 99966 99950 99948 99943 99941 99965 99940 99938 99962 99936 99933 99961 ...

output:

50088
99996 99996
99994 99995
99993 99993
99992 99992
99990 99991
99988 99989
99987 99981
99986 99978
99985 99975
99984 99974
99983 99973
99982 99970
99980 99980
99979 99968
99967 99977
99964 99976
99963 99972
99960 99971
99959 99969
99956 99966
99955 99965
99954 99962
99950 99961
99948 99958
99943 ...

result:

ok Correct

Test #22:

score: 0
Accepted
time: 1290ms
memory: 7900kb

input:

99997
99993 99989 99988 99997 99996 99987 99995 99983 99982 99994 99992 99991 99981 99979 99990 99978 99977 99976 99974 99986 99985 99972 99970 99984 99980 99975 99968 99973 99971 99967 99963 99962 99956 99969 99966 99965 99964 99961 99960 99955 99954 99952 99959 99951 99948 99958 99946 99957 99953 ...

output:

50114
99993 99997
99996 99989
99995 99988
99994 99987
99983 99992
99991 99982
99981 99990
99979 99986
99978 99985
99977 99984
99976 99980
99974 99975
99972 99973
99970 99971
99968 99969
99967 99967
99966 99963
99965 99962
99964 99956
99961 99961
99960 99960
99955 99959
99954 99958
99952 99957
99951 ...

result:

ok Correct

Test #23:

score: 0
Accepted
time: 1275ms
memory: 7708kb

input:

99998
99996 99994 99998 99997 99991 99995 99989 99993 99992 99988 99986 99985 99982 99980 99990 99979 99987 99984 99983 99978 99977 99973 99972 99971 99969 99981 99976 99975 99968 99966 99974 99965 99959 99970 99958 99967 99957 99956 99954 99951 99950 99949 99948 99964 99963 99962 99947 99946 99945 ...

output:

50122
99998 99996
99997 99994
99995 99991
99993 99989
99992 99992
99988 99990
99986 99987
99985 99985
99982 99984
99980 99983
99979 99981
99978 99978
99977 99977
99973 99976
99972 99975
99971 99974
99969 99970
99968 99968
99966 99967
99965 99965
99959 99964
99958 99963
99957 99962
99956 99961
99954 ...

result:

ok Correct

Test #24:

score: 0
Accepted
time: 1273ms
memory: 8296kb

input:

99999
99997 99999 99995 99987 99986 99984 99998 99978 99977 99976 99996 99975 99994 99993 99971 99969 99992 99965 99991 99990 99962 99989 99960 99988 99985 99983 99982 99957 99953 99981 99950 99980 99949 99979 99946 99974 99973 99972 99943 99970 99968 99942 99967 99966 99964 99963 99961 99959 99941 ...

output:

50253
99999 99997
99998 99995
99996 99987
99994 99986
99993 99984
99992 99978
99991 99977
99990 99976
99989 99975
99988 99971
99985 99969
99983 99965
99982 99962
99981 99960
99980 99957
99979 99953
99974 99950
99973 99949
99972 99946
99970 99943
99968 99968
99967 99942
99966 99966
99964 99964
99963 ...

result:

ok Correct

Test #25:

score: 0
Accepted
time: 1294ms
memory: 8316kb

input:

100000
99999 100000 99995 99998 99986 99984 99981 99974 99972 99997 99971 99967 99996 99965 99957 99956 99994 99955 99993 99992 99991 99990 99954 99989 99953 99952 99988 99987 99947 99940 99939 99938 99937 99985 99983 99982 99980 99927 99926 99979 99920 99978 99977 99976 99918 99975 99973 99970 9996...

output:

50194
100000 99999
99998 99995
99997 99986
99996 99984
99994 99981
99993 99974
99992 99972
99991 99971
99990 99967
99989 99965
99988 99957
99987 99956
99985 99955
99983 99954
99982 99953
99980 99952
99979 99947
99978 99940
99977 99939
99976 99938
99975 99937
99973 99927
99970 99926
99969 99920
99968...

result:

ok Correct

Subtask #2:

score: 12
Accepted

Test #26:

score: 12
Accepted
time: 1ms
memory: 3828kb

input:

8
5 6 7 1 2 8 3 4

output:

4
6 7
8 5
3 1
4 2

result:

ok Correct

Test #27:

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

input:

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

output:

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

result:

ok Correct

Test #28:

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

input:

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

output:

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

result:

ok Correct

Test #29:

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

input:

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

output:

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

result:

ok Correct

Test #30:

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

input:

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

output:

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

result:

ok Correct

Test #31:

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

input:

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

output:

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

result:

ok Correct

Test #32:

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

input:

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

output:

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

result:

ok Correct

Test #33:

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

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
456 492
494 219
167 225
435 343
373 268
315 379
29 301
235 119
282 256
354 62
304 457
259 71
376 136
367 254
486 162
72 312
318 490
355 208
293 230
368 87
269 444
460 26
433 106
328 31
309 305
455 114
473 137
489 174
34 319
409 481
420 237
33 57
353 30
17 426
163 80
447 350
468 144
132 195
127 4...

result:

ok Correct

Test #34:

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

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
408 465
492 48
448 277
134 192
357 51
359 429
390 222
308 373
324 128
121 371
316 139
33 199
184 81
136 375
482 270
417 88
70 320
297 366
456 245
26 445
77 233
227 410
337 32
318 234
284 219
127 370
143 464
59 389
208 55
461 300
463 211
453 480
317 76
487 372
54 476
358 435
133 56
130 60
273 386...

result:

ok Correct

Test #35:

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

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
316 465
222 182
290 199
449 356
353 272
317 306
240 264
371 61
269 148
242 211
483 72
85 158
472 383
391 262
152 324
494 21
214 301
384 456
481 286
30 443
251 304
334 309
464 343
147 125
469 375
163 78
228 186
37 414
429 230
32 325
171 357
434 295
439 82
331 35
168 154
189 258
420 69
58 490
305 ...

result:

ok Correct

Test #36:

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

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
185 63
399 419
491 159
360 169
177 130
417 418
354 338
117 352
237 294
121 42
191 61
89 133
340 47
265 445
410 176
306 456
163 141
285 230
287 266
478 275
88 304
316 40
300 75
233 276
210 351
469 15
359 72
375 200
173 307
326 145
214 488
99 35
144 107
17 56
467 440
448 137
323 179
297 193
85 484...

result:

ok Correct

Test #37:

score: 0
Accepted
time: 8ms
memory: 5892kb

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
274 431
453 494
497 386
241 216
244 302
337 229
440 362
357 291
33 330
373 137
315 287
454 331
145 236
459 476
78 404
164 470
286 492
160 190
493 237
324 323
166 100
468 124
449 271
122 269
326 49
332 114
351 384
456 397
86 218
35 425
485 427
250 176
499 339
143 364
321 438
91 380
34 222
238 155...

result:

ok Correct

Test #38:

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

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
194 65
495 162
370 48
168 322
183 438
127 193
355 56
351 422
279 238
367 360
496 263
265 35
205 63
482 38
314 93
464 139
363 381
181 100
90 316
307 451
256 306
424 289
303 33
79 251
231 368
220 317
218 237
493 105
499 342
31 456
153 27
461 305
393 472
301 147
338 489
208 206
321 82
92 315
59 357...

result:

ok Correct

Test #39:

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

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
4927 6203
907 6441
5210 5769
6526 1955
2934 3785
4356 6394
1470 2005
3415 857
2348 6430
6007 2903
3129 3801
4973 1835
5540 2460
3686 7193
5308 1777
534 5925
376 1728
4773 5805
187 2085
4668 1363
4269 1605
6237 2346
1961 5948
721 5813
3191 2965
2084 7127
787 5569
6256 1634
2064 977
1450 4450
121...

result:

ok Correct

Test #40:

score: 0
Accepted
time: 158ms
memory: 4372kb

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
5960 1868
51 5833
778 1528
5225 4094
3932 5510
7150 5438
2243 2948
3176 344
6470 1595
938 5263
4257 1420
2235 5188
4386 4290
429 3882
1972 5406
1357 475
2920 6705
3587 4310
2026 267
6136 7455
1086 1889
3409 5162
7034 3202
6744 471
6588 5663
629 5912
6305 6607
2276 5479
2931 5261
4091 2629
6267 ...

result:

ok Correct

Test #41:

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

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
3063 584
6600 5507
5132 5139
7169 2112
1113 4307
3533 2038
2196 3388
2427 6461
963 536
1456 1823
6083 5775
4888 4460
3880 3272
1946 3942
1378 1471
482 6271
1855 7132
6550 2005
994 3609
3956 4329
1822 6708
155 85
1962 3485
3754 7482
6084 5390
1331 517
861 2767
368 2872
2886 5665
5129 3366
1548 1...

result:

ok Correct

Test #42:

score: 0
Accepted
time: 156ms
memory: 4644kb

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
2912 4448
6015 2852
1837 5884
739 1555
5244 5533
5164 6232
7157 7098
2142 6228
2228 6470
1622 934
5271 4260
1749 2226
3939 4310
4882 799
5445 430
1970 3962
2501 6709
2935 6690
7121 2031
268 4654
1081 5442
1861 5176
4345 6340
6385 6727
206 7254
6598 1985
5689 1722
5413 513
952 838
1247 5137
6615...

result:

ok Correct

Test #43:

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

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
4206 4505
2389 5827
3165 6572
1972 5190
3905 5485
5122 2170
2053 2254
3292 3103
2482 6417
533 3593
3624 1455
5110 3876
4490 6052
5756 4423
3894 1876
7120 2027
1521 3526
3337 3922
1026 6248
1635 554
5777 155
83 1575
1295 149
7488 5906
6054 5369
501 5123
2755 2282
320 4756
2875 5218
2883 5671
340...

result:

ok Correct

Test #44:

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

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
4196 6785
4453 4146
401 3072
4511 2757
42 5657
4267 795
1606 5184
6906 6146
7173 7101
2177 5430
3513 6142
5233 1509
2251 5153
4367 5413
1285 5402
3930 1428
6679 494
6653 4282
269 6126
4654 7470
5406 4313
5535 6705
6993 6269
4232 6285
6692 7283
6193 5654
3457 684
4732 5894
1748 6295
935 5115
735...

result:

ok Correct

Test #45:

score: 0
Accepted
time: 3546ms
memory: 10676kb

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
98291 40281
60976 39985
44704 43160
85513 97779
83652 61136
91592 24578
30564 35945
71405 89025
69115 35494
72998 85873
1021 8621
96259 4835
36217 82802
603 55420
27006 82372
96884 17907
40233 3294
54427 38787
61679 22077
95011 11141
19922 14608
91461 67810
72922 42573
29036 95657
12894 54174
...

result:

ok Correct

Test #46:

score: 0
Accepted
time: 3432ms
memory: 11092kb

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
77609 7636
72856 42581
87006 83284
37828 64385
11505 21947
3838 20181
48235 65885
40175 85280
40036 64306
24228 23382
54837 72803
33108 26869
74224 69478
64555 77606
70049 1076
9295 71516
59107 22513
22714 53890
23424 57974
30803 38177
43417 20055
98989 26100
62434 4047
60557 30178
65562 41612...

result:

ok Correct

Test #47:

score: 0
Accepted
time: 3432ms
memory: 11056kb

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
79139 55819
52252 76627
91934 74532
5958 8439
10373 93500
22290 23244
16377 28546
57193 66896
59 48430
47330 11286
78014 57560
74944 36137
40826 89269
14271 2184
8860 90893
12685 69677
15956 83830
38721 93554
9751 60243
59663 99433
69274 46698
16394 5112
27734 39628
14211 69413
45436 88636
635...

result:

ok Correct

Test #48:

score: 0
Accepted
time: 3470ms
memory: 11228kb

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
80537 1942
92835 46275
88409 58429
50231 51898
4075 78642
35482 36152
3396 39671
21119 98898
50563 85211
44478 58618
81112 62660
90795 48459
30659 37942
61170 13067
9078 16873
21732 54128
53808 54560
15070 48300
9348 32125
54010 7405
32250 4256
41807 92386
52715 77655
30176 67279
98598 59038
8...

result:

ok Correct

Test #49:

score: 0
Accepted
time: 3517ms
memory: 10608kb

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
62983 78476
25349 79484
88266 88353
80167 27483
86343 31197
19991 22929
79265 68527
89609 46176
44062 6973
54841 5793
21579 28165
81909 81002
86834 93262
27513 80667
88376 2758
38736 39224
9158 65304
64432 423
41990 68744
17842 23821
36588 67420
33338 27001
87861 59621
45914 48035
66690 38341
...

result:

ok Correct

Test #50:

score: 0
Accepted
time: 3385ms
memory: 11028kb

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
12188 4619
66593 25461
11449 58012
2166 58310
86629 7206
7541 76612
13699 20361
88560 20967
98835 37405
51475 92899
5790 37839
58992 94664
13495 84617
951 1095
3026 39121
39887 48709
78064 87305
90108 76278
36059 26761
80872 2551
79393 56948
88013 79672
20292 83356
11830 70036
22878 86116
3945...

result:

ok Correct

Subtask #3:

score: 9
Accepted

Test #51:

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

input:

1
1

output:

1
1 1

result:

ok Correct

Test #52:

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

input:

2
1 2

output:

1
2 1

result:

ok Correct

Test #53:

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

input:

2
2 1

output:

2
2 2
1 1

result:

ok Correct

Test #54:

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

input:

3
1 3 2

output:

2
3 1
2 2

result:

ok Correct

Test #55:

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

input:

3
2 1 3

output:

2
2 3
1 1

result:

ok Correct

Test #56:

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

input:

3
2 3 1

output:

2
3 2
1 1

result:

ok Correct

Test #57:

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

input:

3
3 1 2

output:

2
3 3
2 1

result:

ok Correct

Test #58:

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

input:

4
2 1 4 3

output:

2
2 4
3 1

result:

ok Correct

Test #59:

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

input:

4
2 4 1 3

output:

2
2 4
3 1

result:

ok Correct

Test #60:

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

input:

4
3 1 4 2

output:

2
3 4
2 1

result:

ok Correct

Test #61:

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

input:

4
3 4 1 2

output:

2
3 4
2 1

result:

ok Correct

Test #62:

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

input:

3
3 2 1

output:

3
3 3
2 2
1 1

result:

ok Correct

Test #63:

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

input:

4
1 4 3 2

output:

3
4 1
3 3
2 2

result:

ok Correct

Test #64:

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

input:

4
2 4 3 1

output:

3
4 2
3 3
1 1

result:

ok Correct

Test #65:

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

input:

4
3 2 1 4

output:

3
3 4
2 2
1 1

result:

ok Correct

Test #66:

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

input:

4
3 2 4 1

output:

3
3 4
2 2
1 1

result:

ok Correct

Test #67:

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

input:

4
3 4 2 1

output:

3
3 4
2 2
1 1

result:

ok Correct

Test #68:

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

input:

4
4 1 3 2

output:

3
4 4
3 1
2 2

result:

ok Correct

Test #69:

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

input:

4
4 2 1 3

output:

3
4 4
2 3
1 1

result:

ok Correct

Test #70:

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

input:

4
4 2 3 1

output:

3
4 4
2 3
1 1

result:

ok Correct

Test #71:

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

input:

4
4 3 1 2

output:

3
4 4
3 3
2 1

result:

ok Correct

Test #72:

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

input:

4
4 3 2 1

output:

4
4 4
3 3
2 2
1 1

result:

ok Correct

Test #73:

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

input:

3
1 2 3

output:

2
2 3
1 1

result:

ok Correct

Test #74:

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

input:

4
1 2 3 4

output:

2
4 1
2 3

result:

ok Correct

Test #75:

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

input:

4
1 2 4 3

output:

2
4 1
3 2

result:

ok Correct

Test #76:

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

input:

4
1 3 2 4

output:

2
3 4
1 2

result:

ok Correct

Test #77:

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

input:

4
1 3 4 2

output:

2
3 4
2 1

result:

ok Correct

Test #78:

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

input:

4
1 4 2 3

output:

2
4 1
3 2

result:

ok Correct

Test #79:

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

input:

4
2 1 3 4

output:

2
2 4
1 3

result:

ok Correct

Test #80:

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

input:

4
2 3 1 4

output:

2
2 3
4 1

result:

ok Correct

Test #81:

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

input:

4
2 3 4 1

output:

3
3 4
2 2
1 1

result:

ok Correct

Test #82:

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

input:

4
3 1 2 4

output:

2
3 4
1 2

result:

ok Correct

Test #83:

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

input:

4
4 1 2 3

output:

3
4 4
2 3
1 1

result:

ok Correct

Subtask #4:

score: 12
Accepted

Dependency #3:

100%
Accepted

Test #84:

score: 12
Accepted
time: 1ms
memory: 5892kb

input:

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

output:

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

result:

ok Correct

Test #85:

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

input:

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

output:

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

result:

ok Correct

Test #86:

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

input:

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

output:

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

result:

ok Correct

Test #87:

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

input:

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

output:

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

result:

ok Correct

Test #88:

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

input:

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

output:

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

result:

ok Correct

Test #89:

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

input:

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

output:

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

result:

ok Correct

Test #90:

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

input:

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

output:

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

result:

ok Correct

Test #91:

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

input:

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

output:

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

result:

ok Correct

Test #92:

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

input:

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

output:

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

result:

ok Correct

Test #93:

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

input:

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

output:

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

result:

ok Correct

Test #94:

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

input:

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

output:

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

result:

ok Correct

Test #95:

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

input:

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

output:

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

result:

ok Correct

Test #96:

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

input:

8
4 3 7 8 2 1 5 6

output:

4
4 8
3 7
2 5
1 6

result:

ok Correct

Test #97:

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

input:

9
1 6 5 8 9 4 3 2 7

output:

5
6 9
5 8
4 7
3 1
2 2

result:

ok Correct

Test #98:

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

input:

8
3 5 1 6 7 8 4 2

output:

4
5 6
8 7
3 4
2 1

result:

ok Correct

Subtask #5:

score: 0
Wrong Answer

Dependency #4:

100%
Accepted

Test #99:

score: 31
Accepted
time: 8ms
memory: 6148kb

input:

495
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 430 326 ...

output:

248
492 454
488 489
442 490
450 478
494 491
431 449
475 476
473 486
418 485
471 393
430 468
416 402
345 409
465 357
412 457
300 470
427 395
386 384
415 452
448 397
373 343
456 375
295 328
392 423
336 355
316 370
288 421
363 462
441 390
326 315
320 296
379 429
388 391
333 455
285 293
477 278
483 318
...

result:

ok Correct

Test #100:

score: 0
Accepted
time: 8ms
memory: 3844kb

input:

496
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

248
492 454
496 488
489 442
490 494
450 478
491 431
449 476
475 486
485 473
418 471
468 402
357 465
416 393
345 409
412 427
470 384
395 457
386 300
448 373
397 295
343 456
415 375
452 328
441 363
392 355
316 370
288 421
423 336
462 326
315 333
379 388
391 285
429 296
455 320
293 390
425 318
278 306
...

result:

ok Correct

Test #101:

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

input:

497
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

249
492 454
488 489
442 490
450 478
496 431
449 494
491 418
475 476
473 393
486 485
416 402
345 409
465 357
412 471
300 427
395 386
468 384
415 457
397 470
373 343
375 295
452 448
328 392
423 336
355 316
370 288
421 456
363 390
326 315
320 296
379 388
391 333
285 293
462 441
278 318
429 321
365 455
...

result:

ok Correct

Test #102:

score: 0
Accepted
time: 8ms
memory: 4092kb

input:

498
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

249
492 454
488 489
442 490
496 450
478 431
449 494
491 418
476 475
486 485
473 402
357 465
416 393
345 409
412 471
468 427
384 395
386 300
373 470
397 295
343 457
415 375
448 328
363 392
355 456
316 370
288 421
423 336
452 326
315 441
333 379
388 391
285 296
320 293
462 390
318 278
306 321
365 429
...

result:

ok Correct

Test #103:

score: 0
Accepted
time: 5ms
memory: 5888kb

input:

499
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

250
492 454
488 489
442 490
450 478
496 431
449 494
491 418
475 476
473 393
486 485
416 402
345 409
465 357
412 471
300 427
395 386
468 384
415 457
397 470
373 343
375 295
452 448
328 392
423 336
355 316
370 288
421 456
363 390
326 315
320 296
379 388
391 333
285 293
462 441
278 318
429 321
365 455
...

result:

ok Correct

Test #104:

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

input:

500
237 201 155 129 345 454 113 11 492 357 300 295 198 442 14 79 288 431 343 64 285 101 316 15 34 293 3 393 384 47 296 402 488 328 128 409 110 72 249 115 386 450 167 214 489 227 172 220 336 59 206 315 278 63 395 478 490 165 164 303 449 145 31 418 119 179 373 320 93 255 183 38 58 491 375 416 496 326 ...

output:

250
492 454
488 489
442 490
496 450
478 431
449 494
491 418
476 475
486 485
473 402
357 465
416 393
345 409
412 471
468 427
384 395
386 300
373 470
397 295
343 457
415 375
448 328
363 392
355 500
316 370
288 421
423 336
452 326
315 441
333 379
388 391
285 296
320 293
462 390
318 278
306 321
365 429
...

result:

ok Correct

Test #105:

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

input:

500
498 497 500 499 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 ...

output:

498
500 498
499 497
496 496
495 495
494 494
493 493
492 492
491 491
490 490
489 489
488 488
487 487
486 486
485 485
484 484
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
...

result:

ok Correct

Test #106:

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

input:

500
497 500 494 498 499 493 495 496 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 ...

output:

496
500 497
498 499
494 495
496 493
492 492
491 491
490 490
489 489
488 488
487 487
486 486
485 485
484 484
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
461 461
460 460
...

result:

ok Correct

Test #107:

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

input:

500
500 498 499 497 495 493 494 496 490 491 488 492 489 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 ...

output:

495
500 500
499 498
497 497
495 496
494 493
491 492
490 490
488 489
487 487
486 486
485 485
484 484
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
461 461
460 460
459 459
...

result:

ok Correct

Test #108:

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

input:

500
499 500 498 496 495 497 494 493 492 489 490 491 487 488 485 486 484 483 481 482 480 477 479 476 478 474 475 471 473 472 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 ...

output:

490
500 499
498 498
496 497
495 495
494 494
493 493
492 492
490 491
489 489
488 487
485 486
484 484
483 483
482 481
480 480
479 477
478 476
475 474
473 471
472 472
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
462 462
461 461
460 460
459 459
458 458
457 457
456 456
455 455
454 454
...

result:

ok Correct

Test #109:

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

input:

500
500 499 498 497 496 495 494 493 492 491 490 489 488 487 485 484 486 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 ...

output:

486
500 500
499 499
498 498
497 497
496 496
495 495
494 494
493 493
492 492
491 491
490 490
489 489
488 488
487 487
485 486
484 484
483 483
482 482
481 481
480 480
479 479
478 478
477 477
476 476
475 475
474 474
473 473
472 472
471 471
470 470
469 469
468 468
467 467
466 466
465 465
464 464
463 463
...

result:

ok Correct

Test #110:

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

input:

500
498 499 500 496 495 497 494 493 492 491 489 490 488 487 484 485 486 483 482 481 480 478 479 475 476 477 474 472 473 471 470 468 469 467 466 464 463 465 462 461 459 460 457 458 456 455 454 452 453 449 451 450 448 445 447 443 446 444 442 441 440 439 437 436 438 434 433 435 432 429 431 428 430 426 ...

output:

364
499 500
498 498
496 497
495 495
494 494
493 493
492 492
491 491
490 489
488 488
487 487
485 486
484 484
483 483
482 482
481 481
480 480
479 478
476 477
475 475
474 474
473 472
471 471
470 470
468 469
467 467
466 466
464 465
463 463
462 462
461 461
460 459
457 458
456 456
455 455
454 454
452 453
...

result:

ok Correct

Test #111:

score: 0
Accepted
time: 8ms
memory: 6172kb

input:

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

output:

250
411 418
48 184
270 83
25 249
28 57
326 47
116 61
486 206
333 353
163 440
223 40
225 316
14 231
305 311
211 97
403 254
138 268
173 301
424 295
221 7
87 18
442 141
392 244
65 176
39 377
355 3
182 453
272 24
310 266
60 346
161 84
443 212
134 250
15 129
58 337
88 78
401 8
89 145
214 273
324 368
451 ...

result:

ok Correct

Test #112:

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

input:

500
497 499 498 500 494 496 493 495 492 490 491 489 485 487 488 486 483 484 482 481 480 477 479 478 473 474 475 476 472 469 470 471 466 465 468 467 463 464 461 462 457 460 458 459 454 455 453 456 450 451 452 449 447 445 446 448 442 444 443 441 439 437 440 438 435 434 433 436 431 430 432 429 428 426 ...

output:

263
499 500
498 497
496 494
493 495
492 492
490 491
489 489
487 488
486 485
484 483
482 482
481 481
480 480
479 477
478 478
473 475
476 474
472 472
470 471
469 469
466 468
465 467
463 464
462 461
460 457
458 459
455 454
453 456
451 452
450 450
449 449
447 448
445 446
444 442
443 443
441 441
439 440
...

result:

ok Correct

Test #113:

score: 0
Accepted
time: 5ms
memory: 3888kb

input:

500
497 496 500 498 499 491 494 493 495 492 486 487 490 488 489 483 481 482 484 485 476 480 477 478 479 472 473 475 474 471 467 469 468 466 470 462 463 465 461 464 458 460 459 457 456 451 453 454 452 455 446 448 447 449 450 441 442 443 444 445 437 440 436 438 439 431 434 435 433 432 428 430 429 426 ...

output:

294
500 497
498 499
496 496
494 495
493 491
492 492
490 487
488 489
486 486
483 485
482 484
481 481
480 476
478 479
477 477
475 473
474 472
471 471
469 467
468 470
466 466
463 465
462 464
461 461
460 458
459 459
457 457
456 456
453 454
452 455
451 451
448 449
447 450
446 446
443 444
442 445
441 441
...

result:

ok Correct

Test #114:

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

input:

500
500 498 497 499 496 493 492 494 491 495 490 486 489 488 487 484 482 483 481 485 479 477 480 476 478 473 474 471 472 475 469 467 466 468 470 465 463 464 461 462 459 460 457 458 456 453 455 454 451 452 448 450 449 447 446 444 445 442 441 443 438 439 437 440 436 433 435 432 431 434 428 429 430 426 ...

output:

310
500 500
498 499
497 497
496 496
493 494
492 495
491 491
490 490
489 486
488 488
487 487
484 485
483 482
481 481
479 480
477 478
476 476
474 473
472 475
471 471
469 470
467 468
466 466
465 465
463 464
462 461
460 459
457 458
456 456
455 453
454 454
452 451
450 448
449 449
447 447
446 446
445 444
...

result:

ok Correct

Test #115:

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

input:

500
495 496 497 498 499 500 489 490 493 492 491 494 483 487 484 485 486 488 477 478 480 479 482 481 471 473 475 476 474 472 465 467 470 468 469 466 459 460 461 464 462 463 453 454 457 456 458 455 447 448 451 452 449 450 441 443 442 444 446 445 435 437 439 440 436 438 429 432 430 434 433 431 423 424 ...

output:

254
497 500
498 496
495 499
493 489
492 494
490 491
487 488
484 485
486 483
482 480
478 481
477 479
475 476
474 473
471 472
470 467
468 469
465 466
464 461
459 460
463 462
457 458
456 453
455 454
452 451
450 449
448 447
446 443
444 442
441 445
437 439
440 435
436 438
434 432
433 429
430 431
428 426
...

result:

ok Correct

Test #116:

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

input:

500
496 495 500 498 499 497 490 489 492 493 491 494 484 483 487 486 485 488 477 482 478 481 479 480 471 476 474 472 473 475 465 470 469 467 468 466 459 463 464 460 461 462 453 458 457 456 454 455 448 449 447 450 452 451 442 443 441 445 444 446 436 437 438 440 439 435 430 429 431 433 432 434 424 425 ...

output:

271
500 496
498 499
497 495
490 492
493 494
489 491
487 484
486 488
483 485
482 477
481 478
480 479
476 471
474 475
473 472
470 465
469 469
467 468
466 466
464 463
460 459
462 461
458 453
457 457
456 456
454 455
452 449
448 451
450 447
445 442
443 444
441 446
440 436
438 439
437 437
435 435
430 433
...

result:

ok Correct

Test #117:

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

input:

500
496 498 495 497 500 499 490 494 491 493 492 489 484 487 485 488 483 486 478 481 482 477 479 480 472 476 475 471 473 474 466 470 465 467 468 469 460 462 459 461 463 464 454 458 453 455 457 456 448 450 447 452 451 449 442 444 446 441 443 445 436 437 440 435 439 438 430 434 432 429 431 433 424 427 ...

output:

279
498 500
496 499
495 497
494 490
493 491
492 492
489 489
487 488
485 484
486 483
481 482
478 480
479 477
476 472
475 475
473 474
471 471
470 466
467 465
468 469
460 462
461 459
464 463
458 454
457 455
456 453
452 450
451 448
449 447
444 446
442 443
441 445
440 436
439 437
438 435
434 430
432 433
...

result:

ok Correct

Test #118:

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

input:

500
497 496 498 500 495 499 491 492 489 493 494 490 485 486 488 484 487 483 479 480 478 482 481 477 473 472 475 476 471 474 467 465 470 469 468 466 461 462 464 463 460 459 455 454 456 457 458 453 449 447 451 450 448 452 443 441 442 445 446 444 437 435 438 436 439 440 431 433 429 432 434 430 425 424 ...

output:

265
497 498
500 496
499 495
491 492
493 494
490 489
486 488
485 487
484 484
483 483
480 482
479 481
478 478
477 477
473 475
476 472
474 471
470 467
469 465
468 468
466 466
464 461
463 462
460 460
459 459
455 458
456 457
454 454
453 453
451 449
450 452
448 447
445 446
443 444
442 441
437 438
439 435
...

result:

ok Correct

Test #119:

score: -31
Wrong Answer
time: 4ms
memory: 5888kb

input:

500
498 496 495 499 497 500 491 494 489 493 490 492 486 484 483 488 487 485 479 482 481 478 480 477 474 471 472 475 476 473 467 469 470 468 465 466 462 459 464 461 460 463 455 457 454 458 456 453 449 452 451 447 450 448 443 446 441 442 445 444 437 423 426 422 436 434 431 430 433 424 435 429 440 438 ...

output:

279
498 499
496 500
495 497
494 491
493 489
492 490
488 486
484 487
485 483
482 479
481 481
480 478
477 477
475 476
474 474
472 473
471 471
469 470
468 467
465 466
464 462
461 463
459 460
457 458
455 456
454 454
453 453
452 449
451 451
450 447
448 448
446 443
445 442
441 444
437 440
436 423
434 435
...

result:

wrong answer Incorrect

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

0%