UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202854#3497. 我是A题cqzxz100600ms16324kbC++111016b2024-02-17 11:28:002024-02-17 12:38:39

answer

#include<bits/stdc++.h>
#define il inline
#define int long long
namespace things{
	il int rd(){
		int f = 1, x = 0;
		char ch = getchar();
		while(ch < '0' || ch > '9'){
			if (ch == '-' ) f = -1;
			ch = getchar();
		}
		while(ch >= '0' && ch <= '9'){
			x = x * 10 + ch - '0';
			ch = getchar();
		}
		return x * f;
	}
	il void wt(int x){
		if (x < 0){
			putchar('-');
			wt(-x);
			return ;
		}
		if (x > 9) wt(x / 10);
		putchar(x % 10 + '0');
	}
	il int max(int x, int y){
		return std::max(x, y);
	}
	il int min(int a, int b){
		return std::min(a, b);
	}
}
using namespace things;
using namespace std;

const int N = 1e6 + 5;
int id, n, ans;
int a[N], s[N], w[N][2];

signed main(){
	id = rd(), n = rd();
	for (int i = 1; i <= n; i++){
		a[i] = rd();
		s[i] = s[i - 1] ^ a[i];
	}
	for (int i = 0; i <= n; i++) for (int j = 20; j >= 0; j--) w[j][(s[i] >> j) & 1]++;
	for (int i = 0; i <= 20; i++) ans += w[i][0] * w[i][1] * (1 << i);
	cout << ans;
	return 0;
}

详细

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

Subtask #1:

score: 20
Accepted

Test #1:

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

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: 1172kb

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: 1168kb

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: 1172kb

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: 1172kb

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: 1196kb

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: 1192kb

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: 1200kb

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: 1196kb

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: 1ms
memory: 1196kb

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: 46ms
memory: 16080kb

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: 42ms
memory: 13732kb

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: 46ms
memory: 14500kb

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: 29ms
memory: 12044kb

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: 52ms
memory: 16324kb

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: 64ms
memory: 11996kb

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: 78ms
memory: 14960kb

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: 70ms
memory: 15172kb

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: 74ms
memory: 14036kb

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: 97ms
memory: 16028kb

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