QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#768773 | #9541. Expanding Array | KOH-# | WA | 0ms | 3960kb | C++14 | 906b | 2024-11-21 14:23:11 | 2024-11-21 14:23:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x){
x=0;char ch=getchar();bool f=false;
while(!isdigit(ch)) f|=ch=='-',ch=getchar();
while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
x=f?-x:x;return;
}
template <typename T>
inline void print(T x){
if(x<0) putchar('-'),x=-x;
if(x>9) print(x/10);
putchar(x%10^48);return;
}
#define ll long long
const int N=600005;
int a[N];
int n,tot,ans;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
tot=n;
for(int i=2;i<=n;i++){
int x=a[i-1]|a[i];
a[++tot]=x;
a[++tot]=a[i-1]&a[i];
a[++tot]=x^a[i-1];
a[++tot]=x^a[i];
a[++tot]=a[i-1]^a[i];
}
sort(a+1,a+tot+1);
ans=1;
for(int i=2;i<=tot;i++){
if(a[i]!=a[i-1]) ans++;
}
printf("%d",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3816kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3960kb
input:
2 3 5
output:
7
result:
wrong answer 1st lines differ - expected: '8', found: '7'