UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202821#3497. 我是A题181126062311001676ms16356kbC++11530b2024-02-17 10:24:302024-02-17 12:37:26

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
int id,n,a[1000001],sum[1000001],ans,c[2000001];
signed main(){
    scanf("%lld %lld",&id,&n);
    for(int i=1;i<=n;i++) 
    {
        scanf("%lld",&a[i]);
        sum[i]=sum[i-1]^a[i];
    }
    for(int i=0;i<=30;i++)
    {
        c[0]=1,c[1]=0;
        for(int j=1;j<=n;j++)
        {
            int x=((sum[j]&(1<<i))?1:0);
            ans+=((1<<i)*c[x^1]);
            c[x]++;
        }
    }
    printf("%lld",ans);
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 0ms
memory: 1204kb

input:

1
76
1000000 333394 885237 77312 99964 595749 397282 588263 441137 377617 742270 678789 7 4 4 874713...

output:

1541696042

result:

ok 1 number(s): "1541696042"

Test #2:

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

input:

1
98
1000000 1 351537 494899 512214 828316 664980 0 821829 239135 465108 767850 874096 22223 3 53857...

output:

2540376040

result:

ok 1 number(s): "2540376040"

Test #3:

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

input:

1
95
1000000 1 931725 475349 517673 259187 978052 29499 311680 6 3 141717 680732 2 9 7 3 774998 2719...

output:

2356516123

result:

ok 1 number(s): "2356516123"

Test #4:

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

input:

1
66
1000000 337767 360153 778672 102393 164932 58781 0 349587 93810 712842 988065 4 189885 462370 2...

output:

1123634110

result:

ok 1 number(s): "1123634110"

Test #5:

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

input:

1
76
1000000 506483 938777 8 189508 444377 978225 346448 176890 439565 938734 849624 402415 7 297742...

output:

1501221046

result:

ok 1 number(s): "1501221046"

Subtask #2:

score: 20
Accepted

Test #6:

score: 20
Accepted
time: 0ms
memory: 1228kb

input:

2
1400
1000000 180958 403277 954783 996169 878867 731384 7046 483425 957116 777663 463621 27 0 70879...

output:

513749392424

result:

ok 1 number(s): "513749392424"

Test #7:

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

input:

2
1463
1000000 198584 677071 12 574945 303925 646013 497194 430172 30 0 94528 299063 23 56150 651694...

output:

561705472201

result:

ok 1 number(s): "561705472201"

Test #8:

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

input:

2
1822
1000000 295778 764539 556465 632552 459212 845882 896453 328424 870536 762965 16919 858719 60...

output:

870764607916

result:

ok 1 number(s): "870764607916"

Test #9:

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

input:

2
1557
1000000 362442 857704 146017 97681 137364 616366 85055 647117 281717 16 35 420826 145846 9265...

output:

635229891993

result:

ok 1 number(s): "635229891993"

Test #10:

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

input:

2
1540
1000000 503332 140338 957273 10 580962 915674 178650 68857 80034 709375 70298 99136 770280 97...

output:

621705426880

result:

ok 1 number(s): "621705426880"

Subtask #3:

score: 20
Accepted

Test #11:

score: 20
Accepted
time: 161ms
memory: 16116kb

input:

3
954212
1 0 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 0 1 0 1 1 1...

output:

227630583612

result:

ok 1 number(s): "227630583612"

Test #12:

score: 0
Accepted
time: 134ms
memory: 13768kb

input:

3
804010
1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 0 0 0 1 1 1 1 1 1 1 0...

output:

161608241830

result:

ok 1 number(s): "161608241830"

Test #13:

score: 0
Accepted
time: 145ms
memory: 14532kb

input:

3
852856
1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 0 1 0 1...

output:

181841185240

result:

ok 1 number(s): "181841185240"

Test #14:

score: 0
Accepted
time: 117ms
memory: 12080kb

input:

3
695813
1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 0 0 1 1 0 1 0 1 1 1 0 0 1...

output:

121039263488

result:

ok 1 number(s): "121039263488"

Test #15:

score: 0
Accepted
time: 159ms
memory: 16356kb

input:

3
969678
1 0 0 1 0 1 1 1 1 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0...

output:

235069339278

result:

ok 1 number(s): "235069339278"

Subtask #4:

score: 40
Accepted

Test #16:

score: 40
Accepted
time: 134ms
memory: 12028kb

input:

4
692611
1000000 179331 190312 71866 631859 630 557340 626039 456080 612773 947984 137737 376 784 58...

output:

125752755371942279

result:

ok 1 number(s): "125752755371942279"

Test #17:

score: 0
Accepted
time: 158ms
memory: 14992kb

input:

4
882493
1000000 525500 870943 403674 343 602228 290857 665 646795 270860 307691 516857 118 513875 2...

output:

204155704639838779

result:

ok 1 number(s): "204155704639838779"

Test #18:

score: 0
Accepted
time: 165ms
memory: 15204kb

input:

4
896254
1000000 304716 556 588385 99997 823948 223721 151911 565162 278653 513535 658507 807220 741...

output:

210572752233909636

result:

ok 1 number(s): "210572752233909636"

Test #19:

score: 0
Accepted
time: 227ms
memory: 14072kb

input:

4
823532
1000000 711825 215105 10848 211 886 1 87 20599 266913 598661 324974 328984 688449 75954 546...

output:

177787304481519766

result:

ok 1 number(s): "177787304481519766"

Test #20:

score: 0
Accepted
time: 275ms
memory: 16064kb

input:

4
950665
1000000 143072 183836 752299 260 301219 846707 165993 46189 715749 732828 59449 91908 88884...

output:

236916501090421320

result:

ok 1 number(s): "236916501090421320"

Extra Test:

score: 0
Extra Test Passed