QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#760548 | #9541. Expanding Array | snpmrnhlol | WA | 1ms | 3636kb | C++14 | 688b | 2024-11-18 17:31:42 | 2024-11-18 17:31:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5;
int v[N];
set <int> f;
int main(){
int n;
cin>>n;
for(int i = 0;i < n;i++){
cin>>v[i];
if(i){
for(int j = 1;j < 8;j++){
int nr = 0;
for(int k = 0;k < 30;k++){
if(((v[i]>>k)&1) && ((v[i - 1]>>k)&1) && ((j>>0)&1))nr+=(1<<k);
if(((v[i]>>k)&1) && !((v[i - 1]>>k)&1) && ((j>>1)&1))nr+=(1<<k);
if(!((v[i]>>k)&1) && ((v[i - 1]>>k)&1) && ((j>>2)&1))nr+=(1<<k);
}
f.insert(nr);
}
}
}
cout<<f.size();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3636kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3636kb
input:
2 3 5
output:
7
result:
wrong answer 1st lines differ - expected: '8', found: '7'