QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#65328 | #4579. XOR Pairs | T3alaadl3k2olyehymn3k# | AC ✓ | 39ms | 4472kb | C++20 | 612b | 2022-11-29 20:47:25 | 2022-11-29 20:47:27 |
Judging History
answer
#include "bits/stdc++.h"
#define int long long
using namespace std;
const int N = 1e6 + 6;
bool ban[N];
int maxXor, m;
signed main() {
cin >> maxXor >> m;
for (int i = 0; i < m; i++) {
int x;
cin >> x;
ban[x] = true;
}
int ans = 0;
for (int i = 1; i <= maxXor; i++) {
if (ban[i])continue;
for (int j = 20; j >= 0; j--) {
if (i & (1 << j)) {
ans += i ^ (1 << j);
// cout << (i ^ (1 << j)) << endl;
break;
}
}
}
cout << ans * 2 << endl;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3408kb
input:
10 4 4 6 7 10
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3240kb
input:
8 5 4 3 5 8 1
output:
10
result:
ok single line: '10'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3344kb
input:
20 7 3 7 18 15 12 18 19
output:
50
result:
ok single line: '50'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
5 6 1 2 3 4 5 6
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3356kb
input:
4096 100 1797 77 3433 1473 1843 2527 3172 2732 806 529 2622 434 2554 1385 2674 2760 3928 856 418 2714 3019 398 3697 2329 887 661 2793 2598 2676 652 407 3363 2781 1300 1584 3075 2202 2676 862 247 3890 1698 2858 3866 1791 2512 1940 4009 2747 1328 2490 2689 3189 3870 2384 3281 1699 4049 485 701 2132 32...
output:
5460808
result:
ok single line: '5460808'
Test #7:
score: 0
Accepted
time: 4ms
memory: 3848kb
input:
524288 1000 195416 392564 519708 77745 44571 239179 224541 196236 302110 334937 69642 172797 267750 346094 483511 184736 519287 148291 355030 238814 494246 151223 132998 514170 308110 520383 108788 193910 243012 419064 50626 408571 160877 365548 114520 65457 239173 374514 515985 433547 69983 339348 ...
output:
91448282658
result:
ok single line: '91448282658'
Test #8:
score: 0
Accepted
time: 24ms
memory: 3912kb
input:
524288 100000 15911 169307 426965 421774 308218 58111 152102 266722 20981 456767 51738 152708 396512 235646 135428 378157 426260 398291 144403 505744 416827 117633 55876 422411 167205 507473 261938 439391 470758 238288 262173 356005 389863 378695 118383 370435 74068 147736 233721 232299 260221 45114...
output:
75767571508
result:
ok single line: '75767571508'
Test #9:
score: 0
Accepted
time: 4ms
memory: 3292kb
input:
640525 20 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288
output:
105136601100
result:
ok single line: '105136601100'
Test #10:
score: 0
Accepted
time: 3ms
memory: 3364kb
input:
204193 19 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287
output:
11072983644
result:
ok single line: '11072983644'
Test #11:
score: 0
Accepted
time: 28ms
memory: 4324kb
input:
1 100000 605797 704846 673066 721038 944073 283711 850459 897559 182328 382212 334265 163379 754705 344319 182378 76926 168173 310778 389323 805848 753359 407168 792017 160536 466372 665522 401997 686369 973675 585334 841868 802944 816403 470999 981323 176374 902905 131309 266520 763928 395666 11463...
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 25ms
memory: 3428kb
input:
100000 100000 54014 35881 35218 60546 45453 45675 65299 37644 56699 44029 34904 53632 55211 55144 33808 58930 54296 52640 51284 43203 56819 34561 41228 58859 47684 40718 38000 51902 35016 50457 40153 53010 42920 60731 61291 43801 46117 37365 51034 41851 53732 36898 65488 60506 42435 35353 37172 6000...
output:
1597480294
result:
ok single line: '1597480294'
Test #13:
score: 0
Accepted
time: 25ms
memory: 3492kb
input:
99900 100000 67065 36639 54150 98664 16193 1327 90933 61930 65180 17916 98142 14709 83669 21884 83545 74746 53169 45427 48748 30946 79194 34814 71076 78000 65 49660 49230 66271 13176 82808 64670 16426 32066 4528 87842 68899 45466 39836 15465 45247 81624 24928 86173 46617 95552 15434 40932 57322 8105...
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 20ms
memory: 4084kb
input:
609174 64071 29941 549359 104890 493419 206435 24073 142158 7167 290781 447806 8068 17681 605013 368517 296957 298791 514175 127305 85042 103747 448215 290177 167358 396433 453980 495932 432608 84169 511841 559785 58814 57901 473608 324658 95786 219438 62757 598930 339347 521709 264195 147225 583030...
output:
88927010348
result:
ok single line: '88927010348'
Test #15:
score: 0
Accepted
time: 25ms
memory: 3680kb
input:
447868 94640 73118 282263 367525 56508 39420 435087 387142 26358 326903 48867 52944 389437 349608 243093 53270 380133 253789 113742 60696 254991 436802 198030 16530 155704 394401 342991 206748 210055 109128 355630 418258 114024 253439 360589 203422 428079 397099 296739 373244 89289 444384 338788 187...
output:
46519477246
result:
ok single line: '46519477246'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3464kb
input:
2 3 1 1 3
output:
0
result:
ok single line: '0'
Test #17:
score: 0
Accepted
time: 22ms
memory: 4312kb
input:
663352 62892 305149 156134 358250 379256 472550 155021 950804 396619 2978 161821 667930 759304 347916 222988 510238 48509 250703 211249 500207 191876 659920 352352 520344 17665 415011 498356 69283 502050 957130 283780 497585 940293 959090 657978 308798 959931 623042 87917 274460 685613 989517 85773 ...
output:
104182159058
result:
ok single line: '104182159058'
Test #18:
score: 0
Accepted
time: 11ms
memory: 3996kb
input:
607961 64751 118186 384419 344287 36629 148087 514290 588758 437609 122225 201783 309910 300033 246567 171898 583372 70366 368662 418892 385566 568777 527034 111789 108041 507968 528542 119522 37689 415002 142981 592572 368829 255920 208062 27172 284025 198131 364449 209842 481197 490470 360639 8579...
output:
88727672992
result:
ok single line: '88727672992'
Test #19:
score: 0
Accepted
time: 21ms
memory: 3812kb
input:
573650 67152 82243 248406 187527 80689 445138 308845 331705 254452 148031 278673 284785 233847 149200 172179 388014 562069 266891 70088 242083 386917 261235 237955 389115 111438 21533 380460 470098 439971 296388 319093 32487 340407 518365 298907 194230 120394 464987 342324 407524 359301 353678 55836...
output:
83658717514
result:
ok single line: '83658717514'
Test #20:
score: 0
Accepted
time: 15ms
memory: 4472kb
input:
727366 87071 3647 861098 533708 201159 581766 536174 187223 99010 47600 255988 682521 756478 861005 737453 423886 123038 137589 243258 639783 506335 677566 169409 201956 891809 296263 339660 179852 879135 419395 649132 436656 211992 162036 266255 562414 40242 695662 357549 153776 113985 782779 81023...
output:
121758501998
result:
ok single line: '121758501998'
Test #21:
score: 0
Accepted
time: 24ms
memory: 4236kb
input:
870026 75478 293762 280133 187212 713775 729951 675048 584332 600019 601884 801357 649802 240850 393257 702153 414203 326591 99360 320375 323375 852144 738373 68390 230740 384989 94867 151816 678736 487854 598996 536728 276640 328335 776264 738056 123102 145959 111348 606066 37367 269813 400670 7617...
output:
193678514898
result:
ok single line: '193678514898'
Test #22:
score: 0
Accepted
time: 23ms
memory: 4232kb
input:
999265 92460 727109 963279 597794 981269 788167 202726 581052 11921 515098 695239 778686 621522 245741 187617 481135 763173 529126 797077 369810 16880 691691 444369 150746 890382 627142 386867 206596 716426 423497 194062 293698 408551 424900 625793 698328 666281 85722 515925 754640 573001 225170 991...
output:
289214347948
result:
ok single line: '289214347948'
Test #23:
score: 0
Accepted
time: 18ms
memory: 4320kb
input:
900049 79915 529262 351286 460710 979954 391494 319857 838872 198323 747084 750476 620318 68598 149473 753891 819670 11921 13762 699103 937841 477071 104001 471568 663273 459408 112046 152882 356521 101441 649351 890018 767826 386564 922107 41395 310607 527788 479909 621946 402514 622943 519684 2206...
output:
214942881828
result:
ok single line: '214942881828'
Test #24:
score: 0
Accepted
time: 18ms
memory: 3976kb
input:
408107 100000 969967 526170 648730 990714 606054 734390 911696 695177 960000 560485 903590 926770 559211 612479 964758 794920 848707 489244 650167 774998 965981 993595 424588 705821 436345 700192 673873 766527 736865 459581 420938 685825 636831 641744 548229 836783 529344 644457 538718 895625 474163...
output:
44211573434
result:
ok single line: '44211573434'
Test #25:
score: 0
Accepted
time: 7ms
memory: 3496kb
input:
999990 61386 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
317918313200
result:
ok single line: '317918313200'
Test #26:
score: 0
Accepted
time: 5ms
memory: 3264kb
input:
1000000 2 1 1000000
output:
317926875926
result:
ok single line: '317926875926'
Test #27:
score: 0
Accepted
time: 2ms
memory: 3332kb
input:
3 1 2
output:
2
result:
ok single line: '2'
Test #28:
score: 0
Accepted
time: 1ms
memory: 3324kb
input:
1000000 1 1024
output:
317927827350
result:
ok single line: '317927827350'
Test #29:
score: 0
Accepted
time: 39ms
memory: 4236kb
input:
1000000 100000 866527 610985 553494 58792 793257 156309 30709 924101 123227 551914 146389 626831 939273 578769 178338 732423 963661 81029 264671 328474 487504 360948 516902 224430 398464 181535 318834 263206 690660 95495 862399 196298 145369 343002 655703 406856 473754 83188 645657 228707 807842 712...
output:
287872564024
result:
ok single line: '287872564024'
Test #30:
score: 0
Accepted
time: 33ms
memory: 4216kb
input:
1000000 100000 155029 223192 304165 969577 297368 829045 742050 196261 11340 989290 322192 916951 997516 701073 319276 34800 716500 64517 54788 800021 694859 482073 711803 595475 667901 146870 137227 677074 568158 171170 461233 93810 407882 329131 763923 120012 840848 242608 386080 760965 790982 892...
output:
287548644630
result:
ok single line: '287548644630'
Test #31:
score: 0
Accepted
time: 32ms
memory: 4316kb
input:
1000000 100000 863572 296576 470743 651564 450160 691666 183617 337705 331480 183206 59729 412304 772744 423356 188644 971603 801638 244512 13573 195119 704293 37549 306211 482787 950423 411615 396608 123468 499997 683247 336256 219896 391162 588163 41738 732947 132183 901329 973298 663692 31444 671...
output:
287587524778
result:
ok single line: '287587524778'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3400kb
input:
100 10 61 85 85 43 55 86 72 60 55 63
output:
2288
result:
ok single line: '2288'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
100 20 48 6 80 6 82 39 39 53 57 39 44 65 57 40 93 90 97 28 48 30
output:
2154
result:
ok single line: '2154'
Test #34:
score: 0
Accepted
time: 2ms
memory: 3248kb
input:
88 1 58
output:
1850
result:
ok single line: '1850'
Test #35:
score: 0
Accepted
time: 1ms
memory: 3256kb
input:
10202 5 3757 7939 1432 9765 8495
output:
26387868
result:
ok single line: '26387868'
Test #36:
score: 0
Accepted
time: 1ms
memory: 3264kb
input:
123456 11 1 2 3 123457 100000 25 100 25 123457 1024 10
output:
4786305526
result:
ok single line: '4786305526'
Test #37:
score: 0
Accepted
time: 5ms
memory: 3264kb
input:
870209 1 757244
output:
211286662944
result:
ok single line: '211286662944'