QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#867384 | #9685. nim 游戏 | lgvc# | 36 | 17ms | 9240kb | C++23 | 1.5kb | 2025-01-23 15:08:18 | 2025-01-23 15:08:19 |
Judging History
你现在查看的是最新测评结果
- [2025-01-27 09:19:35]
- hack成功,自动添加数据
- (/hack/1490)
- [2025-01-27 08:19:11]
- hack成功,自动添加数据
- (/hack/1488)
- [2025-01-26 18:55:44]
- hack成功,自动添加数据
- (/hack/1475)
- [2025-01-23 15:08:18]
- 提交
answer
#include <bits/stdc++.h>
static char buf[1000000],*paa=buf,*pd=buf;
static char buf2[1000000],*pp=buf2;
#define getchar() paa==pd&&(pd=(paa=buf)+fread(buf,1,1000000,stdin),paa==pd)?EOF:*paa++
inline void pc(char ch){
if(pp-buf2==1000000) fwrite(buf2,1,1000000,stdout),pp=buf2;
*pp++=ch;
}
inline void pcc(){
fwrite(buf2,1,pp-buf2,stdout);
pp=buf2;
}
inline int read(void){
int w=1;
register int x(0);register char c(getchar());
while(c<'0'||c>'9'){if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w*x;
}
void write(int x){
static int sta[20];
int top=0;
do{
sta[top++]=x%10,x/=10;
}while(x);
while(top) pc(sta[--top]+48);
}
void we(int x){
write(x);
pc('\n');
}
int C,T,N,M,a[1000009];
signed main(void) {
C=read();T=read();
while(T--) {
N=read();M=read();
int ss=0;
for(int i=1;i<=N;i++) {
a[i]=read();
ss^=a[i];
}
long long aq=0;
for(int i=30;i>=0;i--) {
bool ff=0;
ss=0;
for(int j=1;j<=N;j++) {
if((a[j]>>i)&1) ff^=1;
ss^=a[j];
}
if(ff) {
int ans=(1<<31)-1;
for(int j=1;j<=N;j++) {
if((a[j]>>i)%2==0) {
int x=(a[j]&((1<<i)-1));
ans=std::min(ans,(1<<i)-x);
}
}
for(int j=1;j<=N;j++) {
if((a[j]>>i)%2==0) {
int x=(a[j]&((1<<i)-1));
if(ans==(1<<i)-x) {
a[j]+=(1<<i)-x;
aq+=(1<<i)-x;
break;
}
}
}
}
}
printf("%lld\n0\n",aq);
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 2
Acceptable Answer
Test #1:
score: 2
Acceptable Answer
time: 3ms
memory: 6200kb
input:
1 10000 2 1 324097321 555675086 2 1 304655177 991244276 2 1 9980291 383616352 2 1 1071036550 795625380 2 1 682098056 68370721 2 1 969101726 685975156 2 1 973896269 354857775 2 1 196188000 606494155 2 1 754416123 467588829 2 1 495704303 558090120 2 1 618002000 491488050 2 1 741575237 9937018 2 1 1002...
output:
231577765 0 686589099 0 373636061 0 275411170 0 613727335 0 283126570 0 619038494 0 410306155 0 286827294 0 62385817 0 126513950 0 731638219 0 130065995 0 295114692 0 301034148 0 338094653 0 290055064 0 616102407 0 683296497 0 58868131 0 408003947 0 892535230 0 212031631 0 386722635 0 655774471 0 55...
result:
points 0.5 right answer but not right solutions at 10000th solution
Subtask #2:
score: 6
Acceptable Answer
Test #2:
score: 6
Acceptable Answer
time: 0ms
memory: 5964kb
input:
2 5 5 2000 0 13 3 4 10 5 2000 0 3 9 1 11 5 2000 0 13 7 3 5 5 2000 0 1 13 9 2 5 2000 0 8 14 7 13
output:
0 0 0 0 2 0 3 0 2 0
result:
points 0.5 right answer but not right solutions at 5th solution
Test #3:
score: 6
Acceptable Answer
time: 1ms
memory: 5964kb
input:
2 5 5 2000 0 4 14 5 7 5 2000 0 2 15 0 12 5 2000 0 1 14 0 5 5 2000 0 13 4 12 3 5 2000 0 10 10 1 11
output:
6 0 1 0 8 0 2 0 10 0
result:
points 0.5 right answer but not right solutions at 5th solution
Test #4:
score: 6
Acceptable Answer
time: 0ms
memory: 5964kb
input:
2 5 5 2000 0 6 15 10 1 5 2000 0 15 0 13 10 5 2000 0 5 7 5 1 5 2000 0 13 3 2 15 5 2000 0 2 4 7 0
output:
2 0 8 0 4 0 1 0 1 0
result:
points 0.5 right answer but not right solutions at 5th solution
Subtask #3:
score: 6
Acceptable Answer
Dependency #2:
50%
Acceptable Answer
Test #5:
score: 6
Acceptable Answer
time: 0ms
memory: 5832kb
input:
3 5 6 2000 0 45 517 811 107 132 6 2000 0 382 576 805 419 579 6 2000 0 379 809 441 331 67 6 2000 0 565 776 959 852 383 6 2000 0 613 383 829 47 441
output:
146 0 179 0 267 0 27 0 197 0
result:
points 0.5 right answer but not right solutions at 5th solution
Test #6:
score: 6
Acceptable Answer
time: 0ms
memory: 5832kb
input:
3 5 6 2000 0 75 173 555 637 905 6 2000 0 934 118 906 367 728 6 2000 0 244 321 598 625 469 6 2000 0 573 489 24 480 459 6 2000 0 424 356 750 623 871
output:
557 0 195 0 69 0 33 0 204 0
result:
points 0.5 right answer but not right solutions at 5th solution
Test #7:
score: 6
Acceptable Answer
time: 1ms
memory: 5956kb
input:
3 5 6 2000 0 886 972 226 813 407 6 2000 0 219 190 742 101 572 6 2000 0 590 423 516 1017 46 6 2000 0 388 807 207 205 647 6 2000 0 408 180 238 300 694
output:
176 0 36 0 466 0 24 0 156 0
result:
points 0.5 right answer but not right solutions at 5th solution
Subtask #4:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 4ms
memory: 6976kb
input:
4 257 100000 100 32768 65536 262144 32768 8388608 1048576 4 67108864 16384 32768 262144 8192 512 134217728 65536 4194304 262144 67108864 1024 262144 64 32 65536 2097152 268435456 1 2048 4194304 16777216 8 16384 2 2048 16777216 268435456 262144 1048576 8388608 16 268435456 2 128 4194304 262144 32768 ...
output:
303389274 0 1 0 188156 0 5 0 7388192 0 1044482 0 483 0 37979676 0 2897896 0 12592895 0 0 0 124 0 10447 0 4 0 6321 0 35 0 0 0 112 0 1163266 0 0 0 4730 0 276 0 80 0 66558 0 1957856 0 9310311 0 2893824 0 14 0 332222 0 3334016 0 3731840 0 1002 0 40994 0 58 0 0 0 1187069 0 124 0 2 0 260192 0 120102876 0 ...
result:
wrong answer jury has worse answer? check your output.
Subtask #5:
score: 6
Acceptable Answer
Test #18:
score: 6
Acceptable Answer
time: 6ms
memory: 6088kb
input:
5 10000 10 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 10 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 10 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741...
output:
1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1073741823 0 1...
result:
points 0.5 right answer but not right solutions at 10000th solution
Test #19:
score: 6
Acceptable Answer
time: 15ms
memory: 7112kb
input:
5 2323 100000 1 0 3170633 888529329 347839787 101667249 273239696 1028446182 411994109 710973319 298677951 299452068 519308796 361451040 488605068 74238166 997794448 478367019 532094220 747266199 217905213 682359917 774814810 234838947 456387659 38459020 434013070 633290806 173828476 94076883 568288...
output:
11962 0 1607036 0 106 0 3 0 126 0 727 0 64001 0 147 0 18 0 2820 0 6234491 0 163 0 316 0 1 0 6831 0 2 0 58512441 0 1095 0 190 0 14 0 14 0 25337127 0 3135892 0 9443 0 7 0 174 0 1 0 175 0 23492762 0 24504133 0 8 0 1 0 503446969 0 1 0 4 0 16777215 0 1673 0 15021249 0 394 0 866019 0 21182202 0 2701101 0 ...
result:
points 0.5 right answer but not right solutions at 2323th solution
Test #20:
score: 6
Acceptable Answer
time: 17ms
memory: 7064kb
input:
5 2205 100000 1 0 684191025 220215685 982495864 602362406 687396179 439432236 81065680 398068897 269754402 306183653 309939439 664994998 1011962742 338161922 629593565 926305057 1026259775 711874360 69406110 426672919 208267066 551253027 9384823 26156203 778817402 654214308 527029151 1065024353 2870...
output:
22539 0 5296170 0 2997548 0 10 0 73171 0 63846191 0 160 0 54472 0 80 0 30 0 8647672 0 48079473 0 534 0 388781939 0 33000512 0 27487079 0 2 0 535 0 18402845 0 500239140 0 20596370 0 538 0 70 0 1315 0 1308627 0 1172423 0 1296 0 10 0 4 0 83 0 0 0 597875 0 31 0 138 0 0 0 16 0 217 0 174066623 0 131999576...
result:
points 0.5 right answer but not right solutions at 2205th solution
Test #21:
score: 6
Acceptable Answer
time: 16ms
memory: 7120kb
input:
5 2166 100000 1 0 58930516 543560994 783997157 728082180 789115629 549794748 81818067 214839912 203394814 711969322 908524000 570262778 992867922 359455295 88035653 412186516 937931728 331800409 545354553 535440658 894562512 657466952 555070606 469471475 1055263866 874958292 76960239 478302168 68009...
output:
8241 0 2846999 0 1605 0 21150 0 13 0 0 0 1667525 0 89607968 0 146855 0 30 0 232032 0 3116 0 2 0 43907922 0 6789 0 262673 0 1 0 6250528 0 593516 0 196 0 4 0 272629760 0 9338564 0 15019723 0 131806 0 3019 0 110370613 0 7 0 368886820 0 12 0 5 0 117 0 1 0 110 0 5187 0 16737 0 44904 0 1124 0 25 0 18 0 17...
result:
points 0.5 right answer but not right solutions at 2166th solution
Subtask #6:
score: 8
Acceptable Answer
Test #22:
score: 8
Acceptable Answer
time: 0ms
memory: 5972kb
input:
6 23 1000 10 0 357293452 452461848 986047039 546588280 762710079 767831017 39741545 416114273 515599366 1018969624 603342125 928112286 1053016142 240953466 533088067 1028134429 504727014 371307863 834428873 968387878 478550336 1047217797 1046651542 777749850 866989319 92995163 251915198 363285573 10...
output:
264227 0 5 0 7 0 4 0 91693223 0 2097370 0 31 0 49 0 15 0 307991771 0 140516 0 6 0 4103 0 179 0 1 0 13 0 468910091 0 468961 0 5 0 510 0 50097157 0 4346 0 32699 0
result:
points 0.5 right answer but not right solutions at 23th solution
Test #23:
score: 8
Acceptable Answer
time: 0ms
memory: 5852kb
input:
6 23 1000 10 0 978686021 287986921 276311856 889616598 739968417 1060147652 463275477 172393699 591333230 983197307 235514434 330494755 449056272 882229818 781111474 275587745 980041928 334198691 305313012 415758352 947298893 950211162 909723054 961622596 917454340 161928901 404346316 369133631 1038...
output:
709905 0 1148 0 199214 0 920 0 3412 0 51 0 0 0 12155683 0 524287 0 27 0 7669 0 2 0 1163 0 1399949 0 26291797 0 669663 0 18 0 121 0 492112602 0 3990400 0 2 0 65535 0 7178 0
result:
points 0.5 right answer but not right solutions at 23th solution
Test #24:
score: 8
Acceptable Answer
time: 0ms
memory: 5956kb
input:
6 15 1000 10 0 631723071 149784582 965844254 515554472 887253148 467825521 981769969 1054193550 627909969 590277818 159342752 658063143 667914173 169490051 25536270 337269419 1056885019 980490575 750858271 553446484 347553447 376197986 1053224035 473470890 123586 97769047 761755924 510998818 2560945...
output:
737485 0 264867077 0 65535 0 2097160 0 34 0 11648 0 144 0 1 0 13 0 666046 0 4 0 8 0 108104785 0 24 0 82 0
result:
points 0.5 right answer but not right solutions at 15th solution
Test #25:
score: 8
Acceptable Answer
time: 0ms
memory: 5964kb
input:
6 25 1000 10 0 751950140 901599329 987895071 306253500 278530668 539473653 911723672 948474628 722632384 369217860 428703545 999113214 567923990 53499297 1013528916 263060554 669297221 349021033 832596533 893306880 892438572 345611286 331257977 488113061 578929864 881846255 320356815 76057168 704694...
output:
1119212 0 65316 0 1073741823 0 3 0 3610519 0 525 0 3 0 995 0 6 0 507 0 1 0 94 0 14709283 0 1307943 0 209426 0 197310664 0 3433909 0 221226 0 33541088 0 1 0 5 0 91 0 8 0 270150 0 24270 0
result:
points 0.5 right answer but not right solutions at 25th solution
Test #26:
score: 8
Acceptable Answer
time: 1ms
memory: 5832kb
input:
6 2 1000 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1...
output:
1073741823 0 1073741823 0
result:
points 0.5 right answer but not right solutions at 2th solution
Subtask #7:
score: 8
Acceptable Answer
Dependency #3:
50%
Acceptable Answer
Dependency #5:
50%
Acceptable Answer
Dependency #6:
50%
Acceptable Answer
Test #27:
score: 8
Acceptable Answer
time: 12ms
memory: 6344kb
input:
7 195 100000 1000 0 828483622 617711013 242092397 1034026464 456205583 731635466 382894773 533786631 582730039 74863848 661821965 368857719 541353387 662605236 580923280 798012506 54823622 333416217 39292129 995195996 477140985 1014499425 362164396 970752859 879997855 96768859 1005365898 576674982 4...
output:
23456 0 190129 0 4762892 0 127 0 3 0 652019 0 225944 0 45 0 13555 0 399951772 0 140030 0 2 0 12251168 0 3 0 209969103 0 247 0 879 0 2969 0 16776833 0 2 0 544 0 159680962 0 3 0 1 0 946 0 62914 0 2085 0 126211826 0 2654 0 3 0 59826 0 13597109 0 0 0 144039661 0 151 0 1630644 0 296374 0 742 0 1341901 0 ...
result:
points 0.5 right answer but not right solutions at 195th solution
Test #28:
score: 8
Acceptable Answer
time: 13ms
memory: 9240kb
input:
7 228 100000 1000 0 230727359 951312015 741711018 367230626 775024687 130794976 435788836 781961691 736694220 427610697 1016199868 798240399 340962994 1006804448 708169239 976753368 364431996 495851435 246658001 190094424 1054346726 639713727 218794912 229693460 313349630 85091951 418997497 27345904...
output:
5906 0 18135 0 1201 0 407255 0 5 0 14972 0 22 0 8325023 0 3303 0 31696 0 29 0 19489 0 401018475 0 7656 0 6276610 0 205182348 0 2 0 29379594 0 11 0 7265 0 6 0 38407 0 2 0 18602088 0 22 0 8397652 0 9 0 148660303 0 203 0 13220358 0 38532 0 212 0 2650 0 5 0 3845945 0 573397 0 7808 0 1007600 0 1728459 0 ...
result:
points 0.5 right answer but not right solutions at 228th solution
Test #29:
score: 8
Acceptable Answer
time: 10ms
memory: 6476kb
input:
7 221 100000 1000 0 716795222 632538294 1008333912 248043863 1023411987 11954597 917179098 100756831 19780613 336926235 768679016 371044675 360783184 402042708 1056697208 567354265 284551620 146863144 1008241012 536649321 680142584 506474136 80860918 973856876 30288601 668537691 877380398 131785980 ...
output:
13893 0 71742222 0 19 0 32784 0 1000 0 1857268 0 109048 0 254598075 0 916362 0 3147950 0 104859934 0 10 0 1017 0 4963 0 3 0 142293 0 1525 0 1 0 26577 0 29 0 392 0 10450940 0 20761 0 61 0 1520 0 370584 0 285402 0 17 0 0 0 2565707 0 6086 0 33167 0 0 0 2158916 0 0 0 14946438 0 5179 0 93 0 825 0 1013972...
result:
points 0.5 right answer but not right solutions at 221th solution
Test #30:
score: 8
Acceptable Answer
time: 0ms
memory: 5864kb
input:
7 1000 3 10 0 729041606 776089922 3 10 0 73695624 783752411 3 10 0 820372959 215264354 3 10 0 919645823 161862972 3 10 0 416211733 881194269 3 10 0 275811209 281074929 3 10 0 582815620 342763006 3 10 0 922520113 399127881 3 10 0 299636294 328307001 3 10 0 666654277 503934330 3 10 0 2735358 732598564...
output:
47048316 0 710056787 0 605108605 0 757782851 0 464982536 0 5263720 0 240052614 0 523392232 0 28670707 0 162719947 0 729863206 0 161456322 0 266844262 0 105434725 0 117877845 0 699823714 0 463438967 0 367062370 0 156451638 0 212429665 0 224464772 0 773211767 0 177263893 0 516939297 0 97265282 0 13399...
result:
points 0.5 right answer but not right solutions at 1000th solution
Test #31:
score: 8
Acceptable Answer
time: 2ms
memory: 5832kb
input:
7 2000 3 5 0 3978360 573616453 3 5 0 547375641 97549509 3 5 0 710402134 567209414 3 5 0 712013879 1031360933 3 5 0 118351677 538884285 3 5 0 96665729 441728559 3 5 0 1021357084 735021028 3 5 0 882151625 958055123 3 5 0 521548745 517316479 3 5 0 162247430 426447555 3 5 0 423460219 408674001 3 5 0 247...
output:
569638093 0 449826132 0 143192720 0 319347054 0 420532608 0 345062830 0 286336056 0 75903498 0 4232266 0 264200125 0 14786218 0 150436517 0 422359382 0 300348736 0 970827516 0 25244842 0 89468343 0 421807264 0 740554825 0 76221311 0 664258679 0 173145669 0 332940199 0 52538227 0 870569928 0 44513777...
result:
points 0.5 right answer but not right solutions at 2000th solution
Test #32:
score: 8
Acceptable Answer
time: 0ms
memory: 5836kb
input:
7 1000 4 10 0 827032080 596299879 377757837 4 10 0 139678996 620475310 982977750 4 10 0 327504523 973136882 1056046317 4 10 0 703538140 645917988 869157682 4 10 0 453817111 255127787 753233051 4 10 0 503195344 905031432 746786602 4 10 0 615183881 988518844 555461556 4 10 0 932813811 356392410 858830...
output:
28167702 0 222823444 0 292275824 0 683834902 0 121819449 0 76114078 0 891615231 0 291045006 0 133704958 0 305029321 0 393329211 0 283217357 0 157058457 0 281089672 0 93700319 0 144357720 0 206768416 0 613361549 0 315940698 0 253849337 0 464578724 0 738419605 0 116870921 0 24687301 0 446477364 0 1758...
result:
points 0.5 right answer but not right solutions at 1000th solution
Test #33:
score: 8
Acceptable Answer
time: 8ms
memory: 7108kb
input:
7 2 100000 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823...
output:
1073741823 0 1073741823 0
result:
points 0.5 right answer but not right solutions at 2th solution
Test #34:
score: 8
Acceptable Answer
time: 10ms
memory: 7200kb
input:
7 204 100000 1000 0 867143449 289720871 62880653 256495758 373546157 114942061 524281177 164218453 261500635 241690011 911469619 794136322 460604293 201667773 1001245336 873383805 136426866 731765422 1036091702 428463064 474020221 916532901 913755707 704796468 745115429 387268771 611877390 101588067...
output:
1241 0 784 0 109 0 1 0 158667 0 169557 0 5 0 64202 0 2673701 0 0 0 10 0 1 0 36592 0 0 0 63 0 1 0 19354090 0 290 0 307499 0 18162817 0 113920 0 34 0 3058 0 14375 0 5980385 0 15 0 15 0 5 0 892269 0 27493 0 76137 0 94441144 0 8 0 5685 0 671056 0 26133518 0 32021 0 23719651 0 1485822 0 145911760 0 2 0 1...
result:
points 0.5 right answer but not right solutions at 204th solution
Subtask #8:
score: 0
Skipped
Dependency #7:
50%
Acceptable Answer
Dependency #4:
0%
Subtask #9:
score: 0
Skipped
Dependency #8:
0%