QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#538067 | #8857. Low Power | GenshinImpactsFault | WA | 71ms | 6568kb | C++14 | 600b | 2024-08-30 22:32:38 | 2024-08-30 22:32:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
int n, m;
int a[N];
bool check(int x) {
int cnt = 0;
for(int i = 1; i <= 2 * n * m; i++) {
if(2 * n * m - i + 1 < m * 2 * (n - cnt)) return 0;
if(a[i + 1] - a[i] <= x) ++cnt, ++i;
}
return 1;
}
int main() {
ios::sync_with_stdio(0); cin.tie(nullptr);
cin >> n >> m;
for(int i = 1; i <= 2 * n * m; i++) cin >> a[i];
sort(a + 1, a + 2 * n * m + 1);
int l = 0, r = 1e9;
for(; l < r;) {
int mid = (l + r) >> 1;
if(check(mid)) r = mid;
else l = mid + 1;
}
cout << r << "\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
2 3 1 2 3 4 5 6 7 8 9 10 11 12
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 2 3 1 3 3 3 3 3 3
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
2 3 1 2 3 4 5 6 7 8 9 10 11 12
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 2 3 1 3 3 3 3 3 3
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1 1 1 1
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
1 1 2 999999999
output:
999999997
result:
ok single line: '999999997'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
1 1 1000000000 1
output:
999999999
result:
ok single line: '999999999'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
1 1 1000000000 1000000000
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 2 4 8 2 1
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
1 2 4 9 6 1
output:
3
result:
ok single line: '3'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1 2 4 9 4 1
output:
3
result:
ok single line: '3'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1 2 9 8 1 4
output:
3
result:
ok single line: '3'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 1 4 8 2 1
output:
4
result:
ok single line: '4'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 1 4 9 6 1
output:
3
result:
ok single line: '3'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
2 1 4 9 4 1
output:
5
result:
ok single line: '5'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 1 9 8 1 4
output:
3
result:
ok single line: '3'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 2 9 8 8 8 7 6 5 5
output:
0
result:
ok single line: '0'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 2 9 9 9 8 7 6 5 5
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
4 1 9 7 7 7 6 5 4 4
output:
2
result:
ok single line: '2'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
4 1 9 9 9 8 7 6 5 5
output:
1
result:
ok single line: '1'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
4 2 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
output:
0
result:
ok single line: '0'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
4 2 8 8 8 8 8 8 8 8 8 8 1 8 8 8 8 8
output:
7
result:
ok single line: '7'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
4 2 1 2 4 6 8 9 11 13 15 16 18 20 22 23 23 23
output:
1
result:
ok single line: '1'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
4 2 1 2 4 6 8 9 11 13 15 16 18 20 22 24 25 25
output:
2
result:
ok single line: '2'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
4 1 999999999 1 999999998 4 999999997 8 999999996 13
output:
5
result:
ok single line: '5'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
4 5 130 132 133 137 193 195 213 218 228 337 351 368 373 383 405 455 495 514 565 609 619 732 733 761 805 806 808 811 841 852 886 921 925 925 972 977 1013 1078 1081 1115
output:
4
result:
ok single line: '4'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 1 9 5
output:
4
result:
ok single line: '4'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
3 7 262 862 914 204 996 325 780 813 220 535 28 48 560 357 620 823 52 245 577 807 612 516 227 539 256 264 895 403 496 20 687 98 790 980 793 158 842 535 94 400 661 831
output:
8
result:
ok single line: '8'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
8 9 606572 678033 38629 697360 156173 76283 592922 643557 40336 326606 229481 597158 37984 362302 288977 532121 441984 961701 769379 645420 492784 116377 733219 173221 608436 131481 827399 202098 731237 646734 362102 182978 709313 615859 913515 189880 574542 578831 788460 712417 458643 927807 217729...
output:
6067
result:
ok single line: '6067'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
3 1 854785954 268128164 869890063 651183983 820638480 789424527
output:
383055819
result:
ok single line: '383055819'
Test #31:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
717 6 2 2 5 6 8 9 3 8 8 1 2 6 6 7 5 5 8 7 4 7 7 8 6 8 1 1 3 1 9 3 6 6 4 2 7 8 5 3 8 6 8 3 7 3 3 7 6 9 7 9 8 9 1 5 3 5 6 4 9 4 7 6 6 1 3 3 4 1 4 9 3 1 3 7 4 3 8 1 4 3 8 8 7 3 1 2 5 5 5 9 7 2 6 6 3 5 2 5 2 7 9 2 7 9 2 3 9 3 7 7 2 2 4 5 9 3 1 1 5 7 5 3 9 4 4 1 4 6 4 3 5 6 2 1 4 2 3 1 6 7 8 1 6 9 6 7 6 ...
output:
0
result:
ok single line: '0'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
660 7 110 190 857 587 224 681 423 776 603 903 30 707 676 423 55 443 493 995 10 279 840 590 974 302 602 427 544 540 808 607 426 275 700 227 633 134 672 283 683 102 326 75 856 417 402 108 441 731 744 129 425 348 415 679 273 17 946 316 248 541 273 826 891 899 136 593 563 883 953 820 355 31 620 136 929 ...
output:
0
result:
ok single line: '0'
Test #33:
score: 0
Accepted
time: 2ms
memory: 3608kb
input:
855 6 325224 840968 763942 92841 889873 440887 29165 894592 885173 528536 586775 420576 570367 45205 764593 494934 530702 130480 17040 870001 609760 3165 543704 596464 300633 565554 238571 49770 66762 171152 549514 368570 440010 64596 627448 953050 68936 874455 826024 578677 887287 897783 325941 458...
output:
103
result:
ok single line: '103'
Test #34:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
359 6 996668359 465674598 190737937 969365298 688757535 537774760 540233644 727291488 287507273 540567350 185071789 913066953 730623130 821832675 350829413 215706491 225309418 193848370 282599030 623537925 928199219 684742068 9776580 369532078 892914795 107366543 334912655 794070089 145222660 700066...
output:
42689
result:
ok single line: '42689'
Test #35:
score: 0
Accepted
time: 52ms
memory: 6568kb
input:
75109 5 4 4 3 1 9 6 7 4 8 6 5 1 1 4 4 4 1 5 6 9 6 5 9 6 8 2 1 6 6 4 5 2 1 2 4 8 3 8 1 8 3 9 3 8 8 2 5 4 6 9 1 6 2 7 7 2 8 9 2 3 6 8 9 5 2 9 2 7 7 2 8 9 1 8 3 3 7 1 6 5 5 6 3 7 5 7 4 1 9 5 1 8 5 3 3 4 3 7 9 3 4 8 6 1 8 2 6 3 7 1 2 4 8 9 4 2 6 7 3 2 4 5 5 9 4 4 1 4 3 7 2 9 1 8 2 2 5 6 7 7 8 8 5 8 7 1 ...
output:
0
result:
ok single line: '0'
Test #36:
score: 0
Accepted
time: 48ms
memory: 5488kb
input:
246215 1 844 137 389 167 258 38 296 668 909 61 541 805 823 781 672 383 557 795 495 14 474 505 263 690 190 692 832 880 143 394 206 828 416 637 140 516 647 724 805 260 383 262 527 977 844 745 131 21 339 130 939 871 638 86 603 962 36 892 954 591 633 905 953 93 953 556 312 990 66 70 602 721 367 160 117 ...
output:
1
result:
ok single line: '1'
Test #37:
score: 0
Accepted
time: 50ms
memory: 5884kb
input:
193938 1 280592 428150 32951 850571 727958 347048 685305 697482 80888 372433 959784 509501 417890 652738 340481 110213 781543 71841 967433 642999 30324 410109 112057 458931 226108 377586 70628 2843 677388 155266 410153 427628 972518 268278 44209 951221 202520 595932 198650 42366 274833 48253 186779 ...
output:
31
result:
ok single line: '31'
Test #38:
score: 0
Accepted
time: 71ms
memory: 6344kb
input:
275064 1 808960512 815707652 427306637 509492314 316533364 256976333 249887107 211385132 947775176 604037424 707299014 143318230 402424620 133067523 177730786 198806699 826784866 146448287 883180416 966345655 251031524 223747442 439149274 740862186 564921034 118964000 47016655 241342574 914077320 41...
output:
25464
result:
ok single line: '25464'
Test #39:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
5 711 6 5 1 9 3 5 9 2 3 8 9 3 6 7 7 1 1 1 7 6 8 2 1 5 9 1 5 1 5 9 3 9 3 3 8 7 9 2 7 8 3 1 9 8 6 9 2 2 8 4 2 3 9 7 5 4 7 9 6 3 6 3 7 3 3 8 8 4 5 3 3 6 7 2 5 1 3 8 4 2 5 1 6 7 4 4 5 5 4 6 9 4 9 4 9 3 9 6 9 5 8 4 6 6 5 4 4 4 6 9 5 8 6 3 3 9 4 2 9 8 3 5 7 1 3 1 2 7 7 2 1 3 4 3 4 1 1 4 1 7 4 9 3 8 3 2 5 ...
output:
0
result:
ok single line: '0'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
5 237 103 350 860 26 466 88 919 58 281 223 584 692 955 930 363 568 236 877 20 314 296 22 303 327 358 366 659 735 101 481 355 355 448 88 187 37 996 92 429 452 936 525 736 83 14 857 347 709 86 922 438 894 773 561 195 364 890 915 223 486 287 967 487 328 713 726 781 133 438 797 512 305 845 470 319 193 5...
output:
0
result:
ok single line: '0'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
9 949 311888 350216 560670 365341 297619 538229 447771 910623 338536 500929 610750 498394 599734 988319 940258 246409 201774 62504 541547 30635 907873 700845 451754 44153 430901 919553 760586 206344 842378 369396 379006 730950 298471 142533 917641 335852 301049 378917 381946 712297 493474 931653 999...
output:
8
result:
ok single line: '8'
Test #42:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
3 846 705048379 283042607 456015803 151131671 180670002 656097790 373881495 711341624 415084230 519486167 415104705 528376826 7293245 133041623 64470364 264973033 348706824 351195455 759160128 353128740 849888803 829220657 936090751 231783301 346835494 717847180 765750293 672117717 883076478 9956400...
output:
19781
result:
ok single line: '19781'
Test #43:
score: 0
Accepted
time: 4ms
memory: 4072kb
input:
56 976 7 3 3 2 8 9 7 4 5 1 9 7 6 2 8 8 8 6 5 5 4 8 6 7 8 2 1 8 8 3 7 5 4 1 7 1 7 2 1 8 2 4 5 5 5 1 7 5 8 3 1 8 3 4 7 6 4 3 7 3 7 1 2 9 9 3 4 6 5 7 6 1 8 4 6 7 1 5 1 9 2 3 9 1 2 7 7 2 1 7 6 7 1 7 7 5 5 4 1 6 5 8 8 4 5 7 1 3 8 2 6 5 8 9 4 3 1 1 8 1 5 9 4 3 3 5 6 2 3 2 6 5 7 4 7 3 3 2 8 6 1 1 5 3 8 6 4...
output:
0
result:
ok single line: '0'
Test #44:
score: 0
Accepted
time: 28ms
memory: 4796kb
input:
372 389 902 863 776 712 51 168 128 99 296 856 796 739 196 432 90 93 697 38 313 990 797 841 241 573 804 375 761 158 876 775 72 770 360 44 543 498 966 984 283 395 622 200 922 513 45 587 656 433 547 61 313 270 811 356 139 800 235 233 700 705 262 183 920 439 894 905 54 130 214 670 215 349 867 40 749 775...
output:
0
result:
ok single line: '0'
Test #45:
score: 0
Accepted
time: 47ms
memory: 5796kb
input:
633 290 532125 821200 381253 673757 472978 885021 515084 64339 382897 53501 256133 155661 532214 561696 672247 582376 682683 647193 47612 608908 200479 630182 392059 891950 77693 638782 957934 809682 210267 430500 592170 350026 610203 580085 39441 700220 273332 971420 622151 229758 490952 842832 380...
output:
3
result:
ok single line: '3'
Test #46:
score: 0
Accepted
time: 37ms
memory: 5964kb
input:
559 225 348136550 857562919 374229360 418887551 126922654 973227967 816776853 221415408 220638342 861028903 419221946 573679530 873278858 363075424 487799542 1334394 447756876 900050891 546298572 267384134 780696052 586727973 481828945 972619042 394105276 418620628 99928431 481494550 525862166 49405...
output:
905
result:
ok single line: '905'
Test #47:
score: -100
Wrong Answer
time: 24ms
memory: 5680kb
input:
2 135576 5 9 3 9 7 5 5 4 2 3 3 9 8 3 1 4 2 4 7 6 3 8 1 8 7 1 8 7 7 4 3 2 5 8 3 4 4 4 1 6 7 9 2 9 2 8 7 8 6 7 7 1 2 6 5 7 9 4 9 7 1 3 7 8 6 5 7 9 9 3 5 1 8 7 6 7 4 4 9 6 7 2 8 9 7 1 6 2 5 4 1 9 4 4 6 2 3 4 7 4 6 8 3 7 9 2 3 2 5 6 5 8 6 7 4 7 8 4 4 2 2 3 9 6 6 5 8 2 7 3 1 7 9 5 4 5 1 5 6 2 7 8 4 9 2 2...
output:
1000000000
result:
wrong answer 1st lines differ - expected: '0', found: '1000000000'