QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#779251 | #9541. Expanding Array | oumashu | WA | 0ms | 3616kb | C++17 | 723b | 2024-11-24 18:03:54 | 2024-11-24 18:03:56 |
Judging History
answer
#include<iostream>
#include<vector>
#include<map>
#include<set>
using namespace std;
int n;
map<int, bool>mp;
set<int>s;
int main()
{
ios::sync_with_stdio(false), cin.tie(0);
cin >> n;
vector<int>v(n, 0);
for (int i = 0; i < n; i++)
cin >> v[i];
for (int i = 0; i < n - 1; i++) {
int a = v[i] & v[i + 1], b = v[i] | v[i + 1];
if (a == 0) {
s.insert(v[i]), s.insert(v[i + 1]), s.insert(b), s.insert(0);
continue;
}
for (int i = 0; i < 32; i++) {
if ((b >> i) & 1)mp[i] = 1;
}
}
int ans = 1 << mp.size();
for (auto it : s) {
for (int i = 0; i < 32; i++) {
if ((it >> i) & 1 && !mp[i]) {
ans++;
break;
}
}
}
cout << ans << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
2 3 5
output:
8
result:
ok single line: '8'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3548kb
input:
10 37760128 12721860 37519778 33518004 2760086 4473592 65451644 83416788 44877547 36766460
output:
134217728
result:
wrong answer 1st lines differ - expected: '56', found: '134217728'