QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#733031#9541. Expanding ArraytamirWA 0ms3588kbC++14595b2024-11-10 16:54:492024-11-10 16:54:49

Judging History

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

  • [2024-11-10 16:54:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-11-10 16:54:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int a[100005],n,mx,k;
unordered_set<int> s;
void rec(int a,int b,int x){
	k++;
	int c=a^b;
	int d=a|b;
	int e=a&b;
	s.insert(c);
	s.insert(d);
	s.insert(e);
	if(x==1) return;
	rec(a,c,x-1);
	rec(a,d,x-1);
	rec(a,e,x-1);
	rec(b,c,x-1);
	rec(b,d,x-1);
	rec(b,e,x-1);
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n;
//	n=100000;
	for(int i=0;i<n;i++){
		cin >> a[i];
//		a[i]=i+1;
		s.insert(a[i]);
	}
	for(int i=0;i<n-1;i++){
		rec(a[i],a[i+1],2);
//		mp.clear();
	}
	cout << s.size();
}

詳細信息

Test #1:

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

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

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

input:

2
3 5

output:

7

result:

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