QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#809462 | #9541. Expanding Array | YipChip# | WA | 1ms | 3636kb | C++23 | 670b | 2024-12-11 15:15:21 | 2024-12-11 15:15:22 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int n;
cin >> n;
vector<int> a(n);
map<int, int> mp;
mp[0] = 1;
cin >> a[0];
for (int i = 1; i < n; i ++ )
{
cin >> a[i];
mp[a[i]] = 1;
mp[a[i] ^ a[i - 1]] = 1;
mp[a[i] & a[i - 1]] = 1;
mp[a[i] | a[i - 1]] = 1;
mp[a[i] - (a[i] & a[i - 1])] = 1;
mp[a[i - 1] - (a[i] & a[i - 1])] = 1;
}
int ans = mp.size();
cout << ans << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
// cin >> T;
while (T -- ) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3532kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3596kb
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'