QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#763959#9541. Expanding ArrayGazeWA 0ms3728kbC++14854b2024-11-19 23:00:222024-11-19 23:00:23

Judging History

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

  • [2024-11-19 23:00:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3728kb
  • [2024-11-19 23:00:22]
  • 提交

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;
	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;
	} 
}
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;
} 

详细

Test #1:

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

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3644kb

input:

2
3 5

output:

6

result:

wrong answer 1st lines differ - expected: '8', found: '6'