QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#751022 | #9541. Expanding Array | kindow# | WA | 0ms | 3808kb | C++20 | 779b | 2024-11-15 16:47:03 | 2024-11-15 16:47:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n;
cin >> n;
set<int> s;
vector<int> a(n + 1);
for(int i = 1; i <= n; ++i){
cin >> a[i];
}
for(int i = 1; i < n; ++i){
int r = a[i] ^ a[i + 1];
int a1 = a[i] ^ r;
int b1 = a[i + 1] ^ r;
for(int j = 0; j <= 1; ++j){
for(int k = 0; k <= 1; ++k){
for(int l = 0; l <= 1; ++l){
int cur = 0;
if(j) cur ^= r;
if(k) cur ^= a1;
if(l) cur ^= b1;
s.insert(cur);
}
}
}
}
cout << s.size() << '\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
// cin >> t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3616kb
input:
2 3 5
output:
4
result:
wrong answer 1st lines differ - expected: '8', found: '4'