QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#774994 | #9541. Expanding Array | KafuuChinocpp# | WA | 0ms | 3872kb | C++14 | 759b | 2024-11-23 14:26:15 | 2024-11-23 14:26:17 |
Judging History
answer
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
const int max1 = 1e5;
int n, a[max1 + 5];
vector <int> ans;
int main ()
{
scanf("%d", &n);
for ( int i = 1; i <= n; i ++ )
scanf("%d", &a[i]);
for ( int i = 1; i <= n - 1; i ++ )
{
ans.push_back(a[i]);
ans.push_back(a[i + 1]);
ans.push_back(a[i] | a[i + 1]);
ans.push_back(a[i] & a[i + 1]);
ans.push_back(a[i] ^ a[i + 1]);
ans.push_back(a[i] ^ (a[i] & a[i + 1]));
ans.push_back(a[i + 1] ^ (a[i] & a[i + 1]));
}
sort(ans.begin(), ans.end());
ans.erase(unique(ans.begin(), ans.end()), ans.end());
printf("%lu\n", ans.size());
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3792kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3872kb
input:
2 3 5
output:
7
result:
wrong answer 1st lines differ - expected: '8', found: '7'