QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#763988#9541. Expanding ArrayGazeRE 0ms3660kbC++14976b2024-11-19 23:12:312024-11-19 23:12:39

Judging History

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

  • [2024-11-19 23:12:39]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3660kb
  • [2024-11-19 23:12:31]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return x * f;
} 
int n, ans;
int f[10010];
map<int, int> mp;
void count(int x, int y) {
	int a = x & y, b = x | y, c = x ^ y, d = c & x, e = c & y;
	if(mp[a] == 0) {
		mp[a] = 1;
		ans += 1;
	}
	if(mp[b] == 0) {
		mp[b] = 1;
		ans += 1;
	}
	if(mp[c] == 0) {
		mp[c] = 1;
		ans += 1;
	} 
	if(mp[d] == 0) {
		mp[d] = 1;
		ans += 1;
	}
	if(mp[e] == 0) {
		mp[e] = 1;
		ans += 1;
	}
}
signed main() {
	n = read();
	ans = 1;
	mp[0] = 1;
	for(int i = 1; i <= n; ++i) {
		f[i] = read();
		if(mp[f[i]] == 0) {
			mp[f[i]] = 1;
			ans += 1;
		}
	}
	for(int i = 1; i < n; ++i) {
		count(f[i], f[i + 1]);
	}
	cout << ans << endl;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

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

input:

2
3 5

output:

8

result:

ok single line: '8'

Test #4:

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

input:

10
37760128 12721860 37519778 33518004 2760086 4473592 65451644 83416788 44877547 36766460

output:

56

result:

ok single line: '56'

Test #5:

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

input:

10
816913051 502168112 623785107 464692422 886370488 155984202 681252443 57479616 856353914 365166224

output:

56

result:

ok single line: '56'

Test #6:

score: -100
Runtime Error

input:

91141
991550420 630736630 613860632 683288307 801076961 655640638 825594849 292357587 386886324 280046446 969805344 558863217 285710238 677412106 663841817 331062932 665933557 860995134 10312018 472942826 92468113 114082647 184016662 952783745 869957199 427809351 730297077 324218702 340532370 865197...

output:


result: