QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297901#4088. 총 쏘기C1942huangjiaxu38 538ms10448kbC++142.1kb2024-01-05 13:14:092024-01-05 13:14:10

Judging History

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

  • [2024-01-05 13:14:10]
  • 评测
  • 测评结果:38
  • 用时:538ms
  • 内存:10448kb
  • [2024-01-05 13:14:09]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5,T=200;
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){
	if(T%5==0)return p[x]<p[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&&T%3==0){
			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]);
				continue;
			}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();if(n>10000)return ans;
	for(int i=1;i<=T;++i){
		vector<pair<int,int> >tmp=calc();
		if(tmp.size()<ans.size())ans=tmp;
	}
	return ans;
}

詳細信息

Subtask #1:

score: 17
Accepted

Test #1:

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

input:

8
4 3 8 2 1 7 6 5

output:

4
4 8
3 7
2 6
1 5

result:

ok Correct

Test #2:

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

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
13 9
8 8
4 7
6 2
5 5
3 3
1 1

result:

ok Correct

Test #3:

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

input:

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

output:

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

result:

ok Correct

Test #4:

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

input:

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

output:

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

result:

ok Correct

Test #5:

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

input:

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

output:

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

result:

ok Correct

Test #6:

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

input:

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

output:

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

result:

ok Correct

Test #7:

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

input:

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

output:

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

result:

ok Correct

Test #8:

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

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
484 475
472 483
482 471
479 468
476 466
465 474
463 473
461 470
469 460
467 459
464 457
462 455
454 458
456 453
452 452
451 450
449 449
448 448
447 447
443 446
442 445
444 437
436 441
440 435
434 439
438 433
432 429
431 427
426 430
...

result:

ok Correct

Test #9:

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

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

result:

ok Correct

Test #10:

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

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

result:

ok Correct

Test #11:

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

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

result:

ok Correct

Test #12:

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

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
486 488
484 487
485 481
478 483
482 474
465 480
464 479
463 477
461 476
460 475
459 473
456 472
471 455
470 470
469 453
468 452
451 467
448 466
447 462
446 458
445 457
454 439
450 434
433 449
444 432
443 443
430 442
441 441
440 428
438 438
...

result:

ok Correct

Test #13:

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

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

result:

ok Correct

Test #14:

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

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
7492 7486
7491 7481
7480 7489
7487 7478
7485 7477
7475 7484
7463 7483
7460 7482
7459 7479
7458 7476
7457 7474
7455 7473
7472 7454
7453 7471
7470 7452
7469 7450
7468 7448
7467 7444
7466 7442
7465 7440
7464 7435
7462 7431
7426 7461
7456 7423
7422 7451
7421 7449
7447 ...

result:

ok Correct

Test #15:

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

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
7484 7488
7476 7487
7473 7486
7471 7485
7483 7470
7482 7468
7481 7467
7465 7480
7462 7479
7478 7456
7455 7477
7453 7475
7451 7474
7446 7472
7469 7445
7444 7466
7464 7439
7463 7435
7433 7461
7432 7460
7459 7430
7458 7429
7457 7428
7427 7454
7423 ...

result:

ok Correct

Test #16:

score: 0
Accepted
time: 303ms
memory: 6156kb

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

result:

ok Correct

Test #17:

score: 0
Accepted
time: 317ms
memory: 6100kb

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

result:

ok Correct

Test #18:

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

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

result:

ok Correct

Test #19:

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

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

result:

ok Correct

Test #20:

score: 0
Accepted
time: 36ms
memory: 7372kb

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

result:

ok Correct

Test #21:

score: 0
Accepted
time: 36ms
memory: 7316kb

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
99991 99990
99989 99988
99981 99987
99978 99986
99975 99985
99974 99984
99983 99973
99982 99970
99980 99980
99979 99968
99977 99967
99964 99976
99972 99963
99960 99971
99969 99959
99956 99966
99955 99965
99954 99962
99950 99961
99958 99948
99943 ...

result:

ok Correct

Test #22:

score: 0
Accepted
time: 40ms
memory: 7244kb

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

result:

ok Correct

Test #23:

score: 0
Accepted
time: 40ms
memory: 7304kb

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
99984 99982
99980 99983
99979 99981
99978 99978
99977 99977
99976 99973
99975 99972
99971 99974
99970 99969
99968 99968
99966 99967
99965 99965
99959 99964
99958 99963
99957 99962
99956 99961
99960 ...

result:

ok Correct

Test #24:

score: 0
Accepted
time: 35ms
memory: 7892kb

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
99978 99992
99977 99991
99990 99976
99975 99989
99988 99971
99969 99985
99965 99983
99982 99962
99981 99960
99957 99980
99953 99979
99974 99950
99949 99973
99972 99946
99943 99970
99968 99968
99942 99967
99966 99966
99964 99964
99963 ...

result:

ok Correct

Test #25:

score: 0
Accepted
time: 35ms
memory: 7224kb

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
99981 99994
99974 99993
99992 99972
99991 99971
99967 99990
99965 99989
99988 99957
99987 99956
99955 99985
99983 99954
99982 99953
99980 99952
99947 99979
99940 99978
99977 99939
99938 99976
99937 99975
99973 99927
99926 99970
99920 99969
99918...

result:

ok Correct

Subtask #2:

score: 0
Wrong Answer

Test #26:

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

input:

8
5 6 7 1 2 8 3 4

output:

4
7 8
5 6
3 1
2 4

result:

ok Correct

Test #27:

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

input:

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

output:

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

result:

ok Correct

Test #28:

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

input:

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

output:

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

result:

ok Correct

Test #29:

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

input:

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

output:

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

result:

ok Correct

Test #30:

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

input:

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

output:

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

result:

ok Correct

Test #31:

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

input:

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

output:

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

result:

ok Correct

Test #32:

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

input:

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

output:

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

result:

ok Correct

Test #33:

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

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
489 318
227 180
456 276
43 243
212 24
329 26
309 391
150 435
230 263
383 56
254 405
57 40
198 9
223 111
397 48
492 454
326 137
114 452
240 47
110 398
422 409
92 65
486 259
346 493
15 301
133 285
39 127
245 408
389 430
442 433
470 237
99 97
392 328
204 211
154 29
34 305
242 106
278 320
253 256
40...

result:

ok Correct

Test #34:

score: 0
Accepted
time: 26ms
memory: 3856kb

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
121 408
113 213
127 211
245 186
116 47
41 404
194 339
270 379
414 489
179 334
355 386
206 140
58 455
258 16
148 480
219 224
494 370
421 424
59 239
478 13
403 477
459 189
175 254
484 308
209 44
223 449
285 448
92 100
337 389
31 76
39 187
485 390
227 81
180 51
492 463
392 273
174 128
335 457
90 24...

result:

ok Correct

Test #35:

score: 0
Accepted
time: 25ms
memory: 5816kb

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
149 394
324 229
489 242
226 187
465 113
286 180
45 216
77 19
30 400
170 449
199 392
58 85
262 217
10 253
342 223
410 53
463 328
163 269
147 129
483 458
481 249
50 133
424 440
63 258
431 414
102 336
367 495
329 306
156 363
41 251
413 43
443 304
117 111
401 120
334 204
181 370
37 305
151 309
196 3...

result:

ok Correct

Test #36:

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

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
94 137
288 70
213 381
177 285
366 112
323 403
294 107
214 88
125 399
8 258
113 269
396 404
347 362
432 180
268 335
161 469
59 293
185 31
130 405
11 304
103 17
359 477
384 390
290 200
10 282
309 440
259 429
133 312
491 470
144 313
98 40
220 490
169 307
240 4
264 65
275 100
328 326
355 102
241 233...

result:

ok Correct

Test #37:

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

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
386 229
18 195
387 453
470 297
116 189
432 81
214 27
348 289
168 68
440 499
414 50
286 12
271 350
242 421
46 494
355 337
121 476
468 259
45 128
426 67
422 429
425 492
24 330
163 371
199 319
155 274
269 326
475 114
250 231
240 178
33 194
89 381
35 159
332 268
122 307
282 287
237 379
380 160
442 1...

result:

ok Correct

Test #38:

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

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
225 42
299 358
483 421
293 81
317 56
199 405
267 302
69 346
403 441
369 410
336 48
245 385
193 453
492 318
394 75
213 449
366 97
362 306
211 196
4 127
430 243
205 314
480 436
115 374
60 230
197 254
494 283
342 20
414 273
194 219
338 294
35 120
452 91
108 451
308 390
53 309
18 58
404 162
381 231
...

result:

ok Correct

Test #39:

score: 0
Accepted
time: 530ms
memory: 6248kb

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
7125 7262
5840 6619
6521 7479
7431 2426
2302 6137
5125 5144
343 962
7484 4611
2008 4920
819 5299
1056 2067
5433 2796
4339 2775
5302 1319
1361 382
1012 377
1298 1082
1590 2983
1305 3975
7391 4402
4615 4205
3281 4381
6091 5308
3864 5948
787 4084
330 468
2942 2036
3516 133
1513 4094
4505 2031
6574...

result:

ok Correct

Test #40:

score: 0
Accepted
time: 530ms
memory: 4288kb

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
2117 2138
3686 4185
7429 4204
4525 6599
5011 6856
6152 6826
1431 7282
7167 756
3729 286
4468 4841
1357 7418
2485 1552
3946 2103
7206 6487
2816 4653
1727 1468
6102 85
1681 2982
267 1864
3690 215
6760 696
6357 480
1037 2917
230 2065
3851 759
6871 4616
2554 4318
4122 6737
6024 5990
5514 6565
2281 ...

result:

ok Correct

Test #41:

score: 0
Accepted
time: 538ms
memory: 4364kb

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
1880 5004
2171 463
159 2340
7258 617
6713 3699
4201 569
5241 3194
2546 1130
6614 2710
3595 5549
4983 6153
707 4490
3694 4837
4149 2424
1699 7039
2558 7200
3473 4615
4864 6148
39 4283
362 4922
2981 1808
3261 2900
5799 2893
2884 3832
68 638
6350 269
1049 7415
3510 1309
6848 3239
1908 4136
7461 66...

result:

ok Correct

Test #42:

score: 0
Accepted
time: 532ms
memory: 6244kb

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
6338 2965
4415 5686
7384 4077
2452 5788
5148 3720
7350 4010
643 1466
566 3228
4740 6871
5339 4562
2224 2795
523 7154
3138 3590
5747 2729
2578 206
6761 2947
4080 4212
2348 1468
5284 2221
3607 446
155 2045
743 2200
7488 7451
6427 7344
4630 532
5234 906
1730 1658
4 453
4514 4477
7242 2178
7349 245...

result:

ok Correct

Test #43:

score: 0
Accepted
time: 535ms
memory: 6188kb

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
3111 2445
3452 2524
7413 3957
2146 2800
1426 539
3875 202
5874 6944
4806 5348
6429 6335
4309 5700
924 6753
7060 122
3482 2479
2453 7143
445 601
7208 1635
4691 1291
4312 4783
501 1582
6574 4688
7277 6903
4285 1283
929 6948
103 1705
6578 6910
2849 4310
231 93
4235 978
1925 2899
5157 947
4792 321
...

result:

ok Correct

Test #44:

score: 0
Accepted
time: 532ms
memory: 4364kb

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
4240 3579
5483 7141
4005 3169
5559 2435
7247 826
7438 7402
903 4417
6993 6781
571 7496
2175 4430
5038 3056
6356 4313
6261 1494
3731 882
6420 2473
5098 5510
7255 4212
7027 4452
4238 6190
6527 4587
236 1303
2322 6189
7373 989
97 4242
6604 6922
4199 91
1414 7293
5150 2482
1009 4194
3972 3689
4466 ...

result:

ok Correct

Test #45:

score: 0
Accepted
time: 56ms
memory: 9992kb

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
89324 22488
87721 67071
49396 99064
9600 48094
69049 44755
51000 9155
83133 51109
83537 12010
64398 96816
6232 49234
45365 99414
81350 39709
52653 45734
96591 73478
47946 45460
77393 36880
38541 87742
64659 92833
41532 2856
71214 73165
70136 97797
49304 9775
22220 44063
77236 77540
11862 73948...

result:

ok Correct

Test #46:

score: -12
Wrong Answer
time: 61ms
memory: 10448kb

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:

49999
91862 89298
23193 65494
87663 38912
69309 67004
96938 49586
99105 9656
48233 68994
44900 51168
82804 51277
12083 52066
88851 64804
53256 99533
64262 96824
48850 6249
49425 5566
45680 81104
39906 26639
52742 39362
96632 73455
38270 45616
59341 77381
64494 92641
52444 20703
2919 9976
84780 88608...

result:

wrong answer Incorrect

Subtask #3:

score: 9
Accepted

Test #51:

score: 9
Accepted
time: 1ms
memory: 3868kb

input:

1
1

output:

1
1 1

result:

ok Correct

Test #52:

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

input:

2
1 2

output:

1
1 2

result:

ok Correct

Test #53:

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

input:

2
2 1

output:

2
2 2
1 1

result:

ok Correct

Test #54:

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

input:

3
1 3 2

output:

2
3 1
2 2

result:

ok Correct

Test #55:

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

input:

3
2 1 3

output:

2
2 3
1 1

result:

ok Correct

Test #56:

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

input:

3
2 3 1

output:

2
3 2
1 1

result:

ok Correct

Test #57:

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

input:

3
3 1 2

output:

2
3 3
1 2

result:

ok Correct

Test #58:

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

input:

4
2 1 4 3

output:

2
2 4
1 3

result:

ok Correct

Test #59:

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

input:

4
2 4 1 3

output:

2
4 2
1 3

result:

ok Correct

Test #60:

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

input:

4
3 1 4 2

output:

2
3 4
1 2

result:

ok Correct

Test #61:

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

input:

4
3 4 1 2

output:

2
4 3
1 2

result:

ok Correct

Test #62:

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

input:

3
3 2 1

output:

3
3 3
2 2
1 1

result:

ok Correct

Test #63:

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

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: 5888kb

input:

4
2 4 3 1

output:

3
4 2
3 3
1 1

result:

ok Correct

Test #65:

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

input:

4
3 2 1 4

output:

3
3 4
2 2
1 1

result:

ok Correct

Test #66:

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

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: 5860kb

input:

4
3 4 2 1

output:

3
4 3
2 2
1 1

result:

ok Correct

Test #68:

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

input:

4
4 1 3 2

output:

3
4 4
1 3
2 2

result:

ok Correct

Test #69:

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

input:

4
4 2 1 3

output:

3
4 4
2 3
1 1

result:

ok Correct

Test #70:

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

input:

4
4 2 3 1

output:

3
4 4
2 3
1 1

result:

ok Correct

Test #71:

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

input:

4
4 3 1 2

output:

3
4 4
3 3
1 2

result:

ok Correct

Test #72:

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

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: 0ms
memory: 3828kb

input:

3
1 2 3

output:

2
2 1
3 3

result:

ok Correct

Test #74:

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

input:

4
1 2 3 4

output:

2
2 1
3 4

result:

ok Correct

Test #75:

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

input:

4
1 2 4 3

output:

2
4 1
3 2

result:

ok Correct

Test #76:

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

input:

4
1 3 2 4

output:

2
3 1
2 4

result:

ok Correct

Test #77:

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

input:

4
1 3 4 2

output:

2
4 3
2 1

result:

ok Correct

Test #78:

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

input:

4
1 4 2 3

output:

2
4 1
2 3

result:

ok Correct

Test #79:

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

input:

4
2 1 3 4

output:

2
2 3
1 4

result:

ok Correct

Test #80:

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

input:

4
2 3 1 4

output:

2
3 2
1 4

result:

ok Correct

Test #81:

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

input:

4
2 3 4 1

output:

3
3 2
4 4
1 1

result:

ok Correct

Test #82:

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

input:

4
3 1 2 4

output:

2
3 4
1 2

result:

ok Correct

Test #83:

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

input:

4
4 1 2 3

output:

3
4 4
1 2
3 3

result:

ok Correct

Subtask #4:

score: 12
Accepted

Dependency #3:

100%
Accepted

Test #84:

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

input:

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

output:

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

result:

ok Correct

Test #85:

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

input:

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

output:

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

result:

ok Correct

Test #86:

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

input:

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

output:

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

result:

ok Correct

Test #87:

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

input:

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

output:

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

result:

ok Correct

Test #88:

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

input:

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

output:

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

result:

ok Correct

Test #89:

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

input:

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

output:

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

result:

ok Correct

Test #90:

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

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: 1ms
memory: 3772kb

input:

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

output:

12
16 13
14 15
11 10
12 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: 1ms
memory: 3768kb

input:

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

output:

11
16 16
15 14
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: 1ms
memory: 3816kb

input:

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

output:

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

result:

ok Correct

Test #94:

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

input:

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

output:

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

result:

ok Correct

Test #95:

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

input:

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

output:

11
15 14
13 16
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: 3872kb

input:

8
4 3 7 8 2 1 5 6

output:

4
8 4
7 3
5 2
1 6

result:

ok Correct

Test #97:

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

input:

9
1 6 5 8 9 4 3 2 7

output:

5
6 8
5 9
7 4
3 1
2 2

result:

ok Correct

Test #98:

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

input:

8
3 5 1 6 7 8 4 2

output:

4
7 6
8 5
4 3
2 1

result:

ok Correct

Subtask #5:

score: 0
Wrong Answer

Dependency #4:

100%
Accepted

Test #99:

score: 31
Accepted
time: 23ms
memory: 3780kb

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
345 492
488 490
237 489
201 478
155 491
129 475
495 494
485 487
476 465
473 493
468 486
483 457
484 454
482 442
431 480
409 393
384 113
11 481
479 357
343 300
295 316
198 288
296 402
328 285
101 14
293 386
249 450
214 449
227 336
172 418
416 315
278 430
412 427
397 167
423 395
303 421
415 373
39...

result:

ok Correct

Test #100:

score: 0
Accepted
time: 24ms
memory: 5756kb

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
237 492
488 490
201 345
491 496
494 489
485 478
476 486
477 483
484 475
465 480
482 473
471 468
470 457
469 456
463 467
466 454
452 357
442 450
431 449
343 409
316 393
384 402
328 448
441 386
336 427
423 315
421 300
295 296
288 293
285 198
278 249
214 227
220 172
206 167
418 495
493 416
415 412
...

result:

ok Correct

Test #101:

score: 0
Accepted
time: 23ms
memory: 3776kb

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
237 345
497 201
496 492
488 489
478 491
494 490
486 476
487 485
483 484
477 482
480 495
493 475
473 481
468 471
470 465
457 462
458 456
455 469
463 467
466 474
472 461
460 479
464 459
454 155
442 453
357 431
393 343
384 402
409 450
395 386
336 449
448 418
373 375
416 427
415 355
363 423
316 452
...

result:

ok Correct

Test #102:

score: 0
Accepted
time: 24ms
memory: 3776kb

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
237 498
497 492
488 490
201 345
491 496
494 489
485 478
476 486
477 483
484 475
465 480
482 473
471 468
470 457
469 456
463 467
466 454
452 357
442 450
431 449
343 409
316 393
384 402
328 448
441 386
336 427
423 315
421 300
295 296
288 293
285 198
278 249
214 227
220 172
206 167
418 495
493 416
...

result:

ok Correct

Test #103:

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

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 499
496 490
491 494
237 489
201 488
485 486
484 483
478 480
476 477
475 155
465 129
345 498
497 454
482 442
357 495
493 487
474 431
113 393
11 343
316 481
479 384
450 402
449 328
427 418
421 423
416 409
412 395
397 415
392 386
388 373
375 379
363 355
370 336
315 326
320 333
327 318
321 306
3...

result:

ok Correct

Test #104:

score: 0
Accepted
time: 23ms
memory: 3792kb

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
500 237
454 498
496 492
488 442
489 491
478 345
201 494
155 499
129 497
495 113
493 357
431 450
393 409
343 402
316 395
384 386
328 11
336 300
315 295
288 198
285 14
296 293
128 278
110 249
115 227
220 101
214 167
172 206
79 490
486 72
476 303
449 485
484 477
483 487
482 480
481 64
59 63
479 34
...

result:

ok Correct

Test #105:

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

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
497 499
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: 13ms
memory: 5884kb

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
499 498
496 494
493 495
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: 12ms
memory: 3784kb

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
496 495
493 494
491 492
490 490
489 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
459 459
...

result:

ok Correct

Test #108:

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

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
499 500
498 498
497 496
495 495
494 494
493 493
492 492
489 491
490 490
487 488
486 485
484 484
483 483
481 482
480 480
477 479
476 478
474 475
471 473
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: 10ms
memory: 5804kb

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

result:

ok Correct

Test #110:

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

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
500 498
499 499
497 496
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
478 479
477 475
476 476
474 474
472 473
471 471
470 470
469 468
467 467
466 466
464 465
463 463
462 462
461 461
460 459
458 457
456 456
455 455
454 454
453 452
...

result:

ok Correct

Test #111:

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

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
267 160
199 181
159 346
10 321
273 33
490 212
424 440
72 264
66 65
281 129
222 219
285 428
94 481
292 299
44 117
436 290
449 67
235 479
271 247
265 279
232 215
465 49
236 409
85 161
421 26
426 268
164 179
214 388
390 315
175 342
381 338
218 238
34 6
210 495
103 327
231 478
29 418
39 473
257 425
...

result:

ok Correct

Test #112:

score: -31
Wrong Answer
time: 22ms
memory: 5876kb

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:

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

result:

wrong answer Incorrect

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%