QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#734103 | #9541. Expanding Array | rdcamelot | WA | 0ms | 3572kb | C++20 | 892b | 2024-11-11 00:20:41 | 2024-11-11 00:20:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using i64=long long;
using u64=unsigned long long;
#define ll long long
const int inf=1e9;
const ll inff=1e18;
using i128=__int128;
void solve(){
int n;
cin>>n;
vector<i64> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
// a b | ^ & |^^
// 1 0 1 1 0 0
// 1 1 1 0 1 1
// 0 0 0 0 0 0
set<i64> s=set(a.begin(),a.end());
for(int i=0;i<n-1;i++){
int x=a[i]|a[i+1];
int y=a[i]^a[i+1];
int z=a[i]&a[i+1];
s.insert(x);
s.insert(y);
s.insert(z);
s.insert(x^a[i]);
s.insert(x^a[i+1]);
}
cout<<s.size()<<'\n';
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int t=1;
// cin>>t;
while(t--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3572kb
input:
2 3 5
output:
7
result:
wrong answer 1st lines differ - expected: '8', found: '7'