QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#794069#9249. Elimination Series Once Morexly_tyty#WA 890ms33508kbC++23906b2024-11-30 10:37:382024-11-30 10:37:39

Judging History

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

  • [2024-11-30 10:37:39]
  • 评测
  • 测评结果:WA
  • 用时:890ms
  • 内存:33508kb
  • [2024-11-30 10:37:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const long long N=1e6+10,mod=998244353,INF=1e15;
ll n,m,k,a[N],ans[N];
bool st[N];
void work(int l,int r,int id)
{
	if(l>r)return;
	vector<pii>f;
	//cout<<l<<' '<<r<<' '<<id<<endl;
	for(int i=l;i<=r;i++)f.push_back({a[i],i});
	sort(f.begin(),f.end());
	int cnt=r-l+1;
	for(int i=0;i<cnt;i++)
	{
		int da=cnt-i-1;
		int xi=f[i].first-1-i;
		if(da<=k&&xi>=da&&ans[f[i].second]==-1)ans[f[i].second]=id;
	}
	int mid=(l+r)/2;
	if(l==r)return;
	work(l,mid,id-1),work(mid+1,r,id-1);
}
void solve()
{
	cin>>n>>k;
	m=1<<n;
	for(int i=1;i<=m;i++)ans[i]=-1;
	for(int i=1;i<=m;i++)cin>>a[i];
	work(1,m,n);
	for(int i=1;i<=m;i++)cout<<ans[i]<<' ';cout<<endl;
}
int main()
{
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int T;T=1;
    while(T--)solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 7876kb

input:

2 1
1 2 3 4

output:

0 1 1 2 

result:

ok 4 number(s): "0 1 1 2"

Test #2:

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

input:

3 5
2 4 7 5 3 8 6 1

output:

1 2 2 2 1 3 2 0 

result:

ok 8 numbers

Test #3:

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

input:

3 0
1 2 7 4 5 8 3 6

output:

0 1 2 0 0 3 0 1 

result:

ok 8 numbers

Test #4:

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

input:

3 5
3 7 1 2 4 8 5 6

output:

1 2 0 1 2 3 2 2 

result:

ok 8 numbers

Test #5:

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

input:

3 3
3 4 8 2 7 6 1 5

output:

1 2 3 1 2 2 0 2 

result:

ok 8 numbers

Test #6:

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

input:

3 3
4 2 6 8 3 5 1 7

output:

2 1 2 3 1 2 0 2 

result:

ok 8 numbers

Test #7:

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

input:

3 4
5 8 1 3 2 4 6 7

output:

2 3 0 1 1 2 2 2 

result:

ok 8 numbers

Test #8:

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

input:

3 1
7 3 8 6 5 2 4 1

output:

2 1 3 1 2 1 2 0 

result:

ok 8 numbers

Test #9:

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

input:

3 4
1 2 5 3 6 7 4 8

output:

0 1 2 1 2 2 2 3 

result:

ok 8 numbers

Test #10:

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

input:

3 2
2 4 8 6 3 7 5 1

output:

1 2 3 2 1 2 2 0 

result:

ok 8 numbers

Test #11:

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

input:

10 780
495 929 348 345 426 543 187 419 839 812 320 1018 251 284 944 258 721 640 730 528 316 247 313 195 809 948 261 615 805 213 388 894 1005 77 599 636 881 444 144 923 240 520 592 465 96 455 563 943 237 860 531 269 106 989 740 506 23 224 84 475 108 718 3 16 731 436 591 627 672 300 573 613 253 637 46...

output:

8 9 8 8 8 9 7 8 9 9 8 9 7 8 9 8 9 9 9 9 8 7 8 7 9 9 8 9 9 7 8 9 9 6 9 9 9 8 7 9 7 9 9 8 6 8 9 9 7 9 9 8 6 9 9 8 4 7 6 8 6 9 1 4 9 8 9 9 9 8 9 9 7 9 8 9 9 9 6 7 6 7 9 9 9 9 9 7 6 8 8 8 9 9 6 6 9 9 9 8 9 9 6 9 9 8 6 7 8 8 3 8 8 9 6 9 7 8 8 9 9 9 9 8 7 9 8 8 7 7 9 9 9 9 9 8 8 9 6 9 9 9 9 9 9 6 9 8 8 9 ...

result:

ok 1024 numbers

Test #12:

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

input:

10 175
10 301 861 580 539 53 822 97 923 133 952 870 438 265 55 825 557 784 976 584 993 897 981 259 875 18 106 399 1019 692 336 485 491 9 565 114 738 128 678 23 562 538 869 787 768 385 494 640 655 666 332 930 798 418 801 266 1009 846 54 37 967 139 394 802 168 503 233 848 340 329 240 898 251 1023 779 ...

output:

3 7 9 8 8 5 9 6 9 7 9 9 8 7 5 9 8 9 9 8 9 9 9 7 9 4 6 8 9 9 8 8 8 3 8 6 9 7 9 4 8 8 9 9 9 8 8 8 8 8 8 9 9 8 9 7 9 9 5 5 9 7 8 9 7 8 7 9 8 8 7 9 7 9 9 9 8 8 9 9 8 7 9 7 8 6 8 5 5 9 9 7 8 9 6 5 8 9 8 5 7 8 9 7 6 9 8 9 8 2 6 9 8 9 9 8 8 5 9 8 9 7 9 9 9 6 9 9 7 10 9 8 9 9 9 7 8 7 8 8 8 6 7 6 7 4 8 9 9 8...

result:

ok 1024 numbers

Test #13:

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

input:

10 15
829 331 590 799 39 456 888 779 60 411 796 148 678 930 101 653 81 429 4 457 455 703 780 260 251 21 291 122 366 177 665 326 114 96 445 123 154 340 522 113 895 170 144 857 447 865 874 891 679 541 867 731 436 219 871 596 285 1008 435 263 881 798 16 275 14 97 845 269 974 782 343 404 561 540 443 482...

output:

6 4 5 6 4 5 7 5 4 4 6 4 5 7 4 5 4 5 2 5 5 5 6 4 4 4 4 4 4 4 5 4 4 4 4 4 4 4 5 4 7 4 4 6 5 6 7 7 5 5 6 5 4 4 6 5 4 9 4 4 7 6 4 4 3 4 6 4 8 6 4 4 5 5 4 5 7 7 4 4 4 4 4 5 9 4 4 7 5 8 4 4 6 4 6 9 6 4 8 5 5 4 4 4 5 4 5 5 4 4 4 4 5 4 5 5 4 5 4 4 5 4 4 6 4 9 5 6 8 6 5 6 6 7 4 4 4 4 4 4 4 3 4 4 4 4 6 7 7 5 ...

result:

ok 1024 numbers

Test #14:

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

input:

10 215
910 367 1011 675 689 697 604 665 730 306 743 225 210 1008 546 439 411 475 529 640 54 505 420 481 213 406 1012 933 392 121 751 554 265 550 621 537 212 908 49 918 768 125 16 927 507 863 1000 44 900 7 645 543 784 461 569 669 984 249 189 727 497 994 719 282 666 691 58 795 119 515 682 150 53 494 6...

output:

9 8 9 9 9 9 9 9 9 8 9 7 7 9 8 8 8 8 8 9 5 8 8 8 7 8 9 9 8 6 9 8 8 8 9 8 7 9 5 9 9 6 4 9 8 9 9 5 9 2 9 8 9 8 8 9 9 7 7 9 8 9 9 8 9 9 5 9 6 8 9 7 5 8 9 8 9 9 7 9 8 9 9 9 8 9 7 5 8 7 9 8 8 6 9 9 8 6 5 9 8 8 9 8 7 9 9 8 6 4 9 6 9 8 8 9 7 8 9 8 5 8 8 9 8 9 8 9 9 8 8 7 5 9 9 9 9 9 8 8 9 9 6 8 6 8 6 9 9 9 ...

result:

ok 1024 numbers

Test #15:

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

input:

10 358
714 252 544 999 507 766 720 169 379 856 698 40 910 610 564 125 278 426 285 205 746 43 23 284 81 525 848 540 827 604 630 741 27 313 452 724 9 745 762 263 44 901 864 445 418 596 310 719 988 536 799 625 202 895 412 153 847 145 353 297 133 260 717 893 158 314 90 356 108 315 1016 510 1015 1007 747...

output:

9 7 9 9 8 9 9 7 8 9 9 5 9 9 9 6 8 8 8 7 9 5 4 8 6 9 9 9 9 9 9 9 4 8 8 9 3 9 9 8 5 9 9 8 8 9 8 9 9 9 9 9 7 9 8 7 9 7 8 8 7 8 9 9 7 8 6 8 6 8 9 8 9 9 9 7 9 9 7 9 6 9 9 7 8 7 9 7 8 7 9 9 7 9 9 4 8 9 8 9 9 9 7 9 6 9 8 9 9 9 8 9 9 9 8 3 8 9 4 7 8 8 8 8 8 8 9 6 8 6 9 7 9 9 8 7 9 9 9 9 7 8 9 8 9 8 9 7 8 9 ...

result:

ok 1024 numbers

Test #16:

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

input:

10 409
720 603 348 938 361 756 506 176 661 192 318 599 115 548 681 692 915 148 721 93 424 707 404 392 695 342 247 799 743 814 82 120 365 428 461 355 184 372 224 810 225 569 630 800 480 226 802 867 136 592 723 412 248 619 817 67 891 72 74 315 624 250 1001 73 536 397 859 553 647 143 575 733 468 298 71...

output:

9 9 8 9 8 9 8 7 9 7 8 9 6 9 9 9 9 7 9 6 8 9 8 8 9 8 7 9 9 9 6 6 8 8 8 8 7 8 7 9 7 9 9 9 8 7 9 9 7 9 9 8 7 9 9 6 9 6 6 8 9 7 9 6 9 8 9 9 9 7 9 9 8 8 9 6 9 9 8 9 9 9 7 8 8 9 5 9 7 7 7 9 9 9 8 7 8 9 8 8 8 8 4 8 8 9 9 8 6 9 9 9 2 9 7 9 8 9 8 7 8 7 9 6 6 9 9 9 7 9 9 8 9 9 9 9 8 9 8 8 8 9 9 9 8 9 6 9 8 9 ...

result:

ok 1024 numbers

Test #17:

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

input:

10 700
469 249 763 385 977 949 423 11 825 442 744 993 553 908 410 860 465 291 751 234 50 897 64 346 481 1010 444 88 605 268 531 167 853 367 389 191 784 723 783 277 916 649 418 932 516 972 714 905 358 364 334 293 391 337 785 837 721 568 555 102 456 554 165 141 253 852 43 109 699 963 915 611 16 156 83...

output:

8 7 9 8 9 9 8 3 9 8 9 9 9 9 8 9 8 8 9 7 5 9 6 8 8 9 8 6 9 8 9 7 9 8 8 7 9 9 9 8 9 9 8 9 9 9 9 9 8 8 8 8 8 8 9 9 9 9 9 6 8 9 7 7 7 9 5 6 9 9 9 9 4 7 6 8 9 9 9 7 6 5 8 8 9 8 8 8 9 7 8 9 8 8 7 9 7 9 6 6 8 9 5 9 9 8 9 8 9 9 9 8 9 8 8 9 7 9 8 6 8 6 9 9 6 9 9 5 8 7 8 9 8 8 9 6 7 7 9 8 9 9 9 9 9 6 9 9 7 6 ...

result:

ok 1024 numbers

Test #18:

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

input:

10 655
971 111 296 479 453 490 163 686 195 492 1014 762 1021 15 351 618 137 181 853 758 876 598 703 486 125 35 41 266 603 682 733 294 391 967 373 508 860 501 1018 1003 642 365 531 883 89 674 869 311 442 734 886 165 701 139 447 271 540 190 983 474 816 769 1015 101 896 904 692 627 643 750 615 20 406 5...

output:

9 6 8 8 8 8 7 9 7 8 9 9 9 3 8 9 7 7 9 9 9 9 9 8 6 5 5 8 9 9 9 8 8 9 8 8 9 8 9 9 9 8 9 9 6 9 9 8 8 9 9 7 9 7 8 8 9 7 9 8 9 9 9 6 9 9 9 9 9 9 9 4 8 8 7 8 7 9 9 8 2 9 9 9 9 9 9 5 8 7 9 9 7 8 8 6 7 7 7 8 9 9 9 9 9 7 9 9 9 5 9 9 7 7 9 9 8 9 7 6 7 8 9 8 4 9 8 9 9 9 8 9 8 8 9 5 8 7 4 9 9 9 6 8 8 9 8 9 9 8 ...

result:

ok 1024 numbers

Test #19:

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

input:

10 827
692 816 52 570 178 260 248 531 852 777 232 378 955 632 325 256 328 599 802 165 966 493 166 125 488 942 965 716 947 276 156 894 194 742 933 185 384 152 277 333 991 424 487 435 423 504 113 106 307 205 745 155 654 226 16 518 884 757 1009 133 401 392 451 510 682 717 922 608 148 206 854 355 728 51...

output:

9 9 5 9 7 8 7 9 9 9 7 8 9 9 8 8 8 9 9 7 9 8 7 6 8 9 9 9 9 8 7 9 7 9 9 7 8 7 8 8 9 8 8 8 8 8 6 6 8 7 9 7 9 7 4 9 9 9 9 7 8 8 8 8 9 9 9 9 7 7 9 8 9 8 7 7 5 7 8 9 8 8 8 9 9 7 9 6 9 8 6 6 4 9 8 5 9 6 9 9 7 9 9 6 9 9 8 8 9 9 9 9 9 9 8 2 6 9 9 9 7 8 9 9 2 8 7 8 8 8 7 9 9 8 9 8 4 9 9 8 9 8 8 9 4 8 9 9 9 6 ...

result:

ok 1024 numbers

Test #20:

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

input:

10 328
454 408 810 540 254 321 33 682 91 53 398 761 1023 243 581 545 825 892 100 356 17 326 487 878 787 756 996 707 770 924 945 272 428 686 339 908 390 645 238 337 517 364 717 404 533 394 849 435 894 947 482 806 657 39 781 946 75 656 129 476 676 984 456 412 463 160 562 592 345 141 145 501 921 991 21...

output:

8 8 9 9 7 8 5 9 6 5 8 9 9 7 9 9 9 9 6 8 4 8 8 9 9 9 9 9 9 9 9 8 8 9 8 9 8 9 7 8 9 8 9 8 9 8 9 8 9 9 8 9 9 5 9 9 6 9 7 8 9 9 8 8 8 7 9 9 8 7 7 8 9 9 7 8 6 5 9 9 3 9 9 6 9 9 6 9 1 9 9 8 8 8 8 8 8 9 8 9 8 5 8 9 7 9 8 7 8 9 9 8 8 2 9 7 8 9 7 9 8 9 9 9 8 8 9 9 9 8 9 6 7 9 9 8 8 9 7 9 9 9 9 9 9 9 9 4 6 9 ...

result:

ok 1024 numbers

Test #21:

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

input:

10 825
601 142 625 471 287 405 117 857 340 984 863 530 575 994 436 394 529 25 141 332 735 966 1 831 673 896 89 272 649 81 384 242 864 817 174 382 145 469 577 715 893 275 914 455 667 169 179 521 305 925 976 213 40 380 659 499 918 725 561 616 948 924 1022 721 235 485 85 781 540 52 892 982 254 461 381 ...

output:

9 7 9 8 8 8 6 9 8 9 9 9 9 9 8 8 9 4 7 8 9 9 0 9 9 9 6 8 9 6 8 7 9 9 7 8 7 8 9 9 9 8 9 8 9 7 7 9 8 9 9 7 5 8 9 8 9 9 9 9 9 9 9 9 7 8 6 9 9 5 9 9 7 8 8 9 9 6 9 9 9 9 8 4 5 7 9 9 8 5 9 9 9 7 9 6 8 9 2 6 9 8 9 7 7 9 9 9 9 9 9 7 8 8 9 9 9 6 9 8 7 9 9 6 9 9 9 4 9 8 9 9 9 8 7 8 7 8 7 8 9 8 4 9 9 9 6 7 7 9 ...

result:

ok 1024 numbers

Test #22:

score: -100
Wrong Answer
time: 890ms
memory: 33508kb

input:

20 0
179487 921757 700836 1026745 871114 487101 416568 943369 555729 702080 475044 257810 489454 716476 879881 237658 884615 645342 654881 754504 537330 488794 60810 581898 627225 134547 267586 35544 535278 202909 1006004 182486 863804 12271 705426 1000913 315415 495258 494119 323180 59354 347058 62...

output:

17 20 19 20 20 19 19 20 19 19 19 18 19 19 20 18 20 19 19 19 19 19 16 19 19 17 18 15 19 18 20 17 20 13 19 20 18 19 19 18 16 18 19 19 20 19 20 19 20 19 19 19 17 18 18 20 20 20 17 18 18 20 19 20 20 16 17 19 19 18 15 18 15 19 18 19 18 18 19 18 19 16 19 19 20 19 17 20 20 20 20 19 19 19 17 14 16 16 20 17 ...

result:

wrong answer 1st numbers differ - expected: '0', found: '17'