QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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;
}
详细
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'