QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#771159#9541. Expanding ArrayyimgWA 0ms3860kbC++20782b2024-11-22 10:15:332024-11-22 10:15:34

Judging History

你现在查看的是最新测评结果

  • [2024-11-22 10:15:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3860kb
  • [2024-11-22 10:15:33]
  • 提交

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'