QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#375399#4088. 총 쏘기Unknown15080 53ms71320kbC++201.3kb2024-04-03 10:08:532024-04-03 10:08:53

Judging History

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

  • [2024-04-03 10:08:53]
  • 评测
  • 测评结果:0
  • 用时:53ms
  • 内存:71320kb
  • [2024-04-03 10:08:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ii = pair<int, int>;

int find_bad(const vector<int> &A, int limit = 1e9){
	int res = -1, mx = -1;
	for (int i = 0; i < min(limit, (int)A.size() - 1); i++){
		if (A[i] <= mx) continue;
		if (A[i] > A[i+1]){
			res = i;
		}
		mx = max(mx, A[i]);
	}
	
	return res;
}

void remove(vector<int> &A, int idx){
	vector<int> newA;
	for (int i = 0; i < (int)A.size(); i++){
		if (i != idx) newA.push_back(A[i]);
	}
	swap(A, newA);
}

vector<ii> min_shooting_buildings(vector<int> A){
	if ((int)A.size() == 0) return {};
	if ((int)A.size() == 1) return {{A[0], A[0]}};

	int f1 = find_bad(A);
	if (f1 < 0){
		vector<ii> res = {{A[0], A[1]}};
		remove(A, 0); remove(A, 0);
		vector<ii> recur = min_shooting_buildings(A);
		res.insert(res.end(), recur.begin(), recur.end());
		return res;
	}

	int value = A[f1];
	remove(A, f1);
	int f2 = find_bad(A, f1);

	if (f1 > 0 && f2 < 0) f2 = 0;

	if (f2 < 0){
		vector<ii> res = {{value, value}};
		vector<ii> recur = min_shooting_buildings(A);
		res.insert(res.end(), recur.begin(), recur.end());
		return res;
	}

	vector<ii> res = {{value, A[f2]}};
	remove(A, f2);

	vector<ii> recur = min_shooting_buildings(A);
	res.insert(res.end(), recur.begin(), recur.end());
	return res;
}


详细

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

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

input:

8
4 3 8 2 1 7 6 5

output:

4
8 4
7 3
6 2
1 5

result:

ok Correct

Test #2:

score: 0
Accepted
time: 0ms
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
14 10
13 9
8 8
7 4
6 2
5 5
3 3
1 1

result:

ok Correct

Test #3:

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

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

result:

ok Correct

Test #4:

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

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

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
7 4
5 3
1 2

result:

ok Correct

Test #6:

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

input:

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

output:

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

result:

ok Correct

Test #7:

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

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

result:

ok Correct

Test #8:

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

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

result:

ok Correct

Test #9:

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

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
476 460
475 458
474 457
471 456
470 455
467 454
466 453
465 452
462 449
461 448
459 447
451 446
450 437
445 436
444 433
443 432
442 430
441 428
440 426
439 425
438 424
...

result:

ok Correct

Test #10:

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

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

result:

ok Correct

Test #11:

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

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
492 489
491 491
490 488
487 485
486 482
484 484
483 481
480 479
478 478
477 475
476 474
473 473
472 471
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: 1ms
memory: 4192kb

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
499 498
497 496
495 492
494 494
493 493
491 491
490 489
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: 1ms
memory: 4176kb

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

result:

ok Correct

Test #14:

score: 0
Accepted
time: 50ms
memory: 70596kb

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

result:

ok Correct

Test #15:

score: 0
Accepted
time: 44ms
memory: 71160kb

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: 53ms
memory: 71320kb

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

result:

ok Correct

Test #17:

score: 0
Accepted
time: 45ms
memory: 70736kb

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

result:

ok Correct

Test #18:

score: 0
Accepted
time: 42ms
memory: 70804kb

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: 38ms
memory: 70868kb

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: -17
Time Limit Exceeded

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:

Unauthorized output

result:


Subtask #2:

score: 0
Wrong Answer

Test #26:

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

input:

8
5 6 7 1 2 8 3 4

output:

4
8 7
6 5
1 2
3 4

result:

ok Correct

Test #27:

score: -12
Wrong Answer
time: 0ms
memory: 3864kb

input:

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

output:

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

result:

wrong answer Incorrect

Subtask #3:

score: 0
Wrong Answer

Test #51:

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

input:

1
1

output:

1
1 1

result:

ok Correct

Test #52:

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

input:

2
1 2

output:

1
1 2

result:

ok Correct

Test #53:

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

input:

2
2 1

output:

2
2 2
1 1

result:

ok Correct

Test #54:

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

input:

3
1 3 2

output:

2
3 1
2 2

result:

ok Correct

Test #55:

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

input:

3
2 1 3

output:

2
2 2
1 3

result:

ok Correct

Test #56:

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

input:

3
2 3 1

output:

2
3 2
1 1

result:

ok Correct

Test #57:

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

input:

3
3 1 2

output:

2
3 3
1 2

result:

ok Correct

Test #58:

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

input:

4
2 1 4 3

output:

2
4 2
1 3

result:

ok Correct

Test #59:

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

input:

4
2 4 1 3

output:

2
4 2
1 3

result:

ok Correct

Test #60:

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

input:

4
3 1 4 2

output:

2
4 3
1 2

result:

ok Correct

Test #61:

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

input:

4
3 4 1 2

output:

2
4 3
1 2

result:

ok Correct

Test #62:

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

input:

3
3 2 1

output:

3
3 3
2 2
1 1

result:

ok Correct

Test #63:

score: 0
Accepted
time: 0ms
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: 0ms
memory: 3796kb

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

input:

4
3 2 1 4

output:

3
3 3
2 2
1 4

result:

ok Correct

Test #66:

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

input:

4
3 2 4 1

output:

3
4 3
2 2
1 1

result:

ok Correct

Test #67:

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

input:

4
3 4 2 1

output:

3
4 3
2 2
1 1

result:

ok Correct

Test #68:

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

input:

4
4 1 3 2

output:

3
4 4
3 1
2 2

result:

ok Correct

Test #69:

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

input:

4
4 2 1 3

output:

3
4 4
2 2
1 3

result:

ok Correct

Test #70:

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

input:

4
4 2 3 1

output:

3
4 4
3 2
1 1

result:

ok Correct

Test #71:

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

input:

4
4 3 1 2

output:

3
4 4
3 3
1 2

result:

ok Correct

Test #72:

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

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

input:

3
1 2 3

output:

2
1 2
3 3

result:

ok Correct

Test #74:

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

input:

4
1 2 3 4

output:

2
1 2
3 4

result:

ok Correct

Test #75:

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

input:

4
1 2 4 3

output:

2
4 1
2 3

result:

ok Correct

Test #76:

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

input:

4
1 3 2 4

output:

2
3 1
2 4

result:

ok Correct

Test #77:

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

input:

4
1 3 4 2

output:

2
4 3
1 2

result:

ok Correct

Test #78:

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

input:

4
1 4 2 3

output:

2
4 1
2 3

result:

ok Correct

Test #79:

score: -9
Wrong Answer
time: 0ms
memory: 3800kb

input:

4
2 1 3 4

output:

3
2 2
1 3
4 4

result:

wrong answer Incorrect

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%