QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#771159 | #9541. Expanding Array | yimg | WA | 0ms | 3860kb | C++20 | 782b | 2024-11-22 10:15:33 | 2024-11-22 10:15:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void work()
{
int n;
cin >> n;
vector<int> p(n);
for(int i = 0; i < n; ++i) cin >> p[i];
map<int, int> vis;
int cnt = 0;
for(int i = 1; i < n; ++i){
int a = p[i], b = p[i - 1], c = a ^ b;
if(!vis[a]) cnt++; vis[a] = 1;
if(!vis[b]) cnt++; vis[b] = 1;
if(!vis[c]) cnt++; vis[c] = 1;
if(!vis[a|b]) cnt++; vis[a|b] = 1;
if(!vis[a&b]) cnt++; vis[a&b] = 1;
if(!vis[b|c]) cnt++; vis[b|c] = 1;
if(!vis[b&c]) cnt++; vis[b&c] = 1;
if(!vis[a|c]) cnt++; vis[a|c] = 1;
if(!vis[a&c]) cnt++; vis[a&c] = 1;
}
cout << cnt << "\n";
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
work();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3496kb
input:
2 3 5
output:
7
result:
wrong answer 1st lines differ - expected: '8', found: '7'