QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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();
}
Details
Tip: Click on the bar to expand more detailed information
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'