QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#763959 | #9541. Expanding Array | Gaze | WA | 0ms | 3728kb | C++14 | 854b | 2024-11-19 23:00:22 | 2024-11-19 23:00:23 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') {
if(ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
int n, ans;
int f[10010];
map<int, int> mp;
void count(int x, int y) {
int a = x & y, b = x | y, c = x ^ y;
if(mp[a] == 0) {
mp[a] = 1;
ans += 1;
}
if(mp[b] == 0) {
mp[b] = 1;
ans += 1;
}
if(mp[c] == 0) {
mp[c] = 1;
ans += 1;
}
}
signed main() {
n = read();
ans = 1;
mp[0] = 1;
for(int i = 1; i <= n; ++i) {
f[i] = read();
if(mp[f[i]] == 0) {
mp[f[i]] = 1;
ans += 1;
}
}
for(int i = 1; i < n; ++i) {
count(f[i], f[i + 1]);
}
cout << ans << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3728kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
2 3 5
output:
6
result:
wrong answer 1st lines differ - expected: '8', found: '6'