QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#733031 | #9541. Expanding Array | tamir | WA | 0ms | 3588kb | C++14 | 595b | 2024-11-10 16:54:49 | 2024-11-10 16:54:49 |
Judging History
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'