QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#745577#9541. Expanding ArrayKDreamWA 1ms3856kbC++20680b2024-11-14 10:39:042024-11-14 10:39:04

Judging History

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

  • [2024-11-14 10:39:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3856kb
  • [2024-11-14 10:39:04]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

void _Z()
{
    int n;
    cin >> n;
    vector<int> a(n);
    map<int,int> s;
    for (int i = 0;i < n;i ++)
    {
        cin >> a[i];
        s[a[i]] = 1;
    }
    s[0] = 1;
    for (int i = 1;i < n;i ++)
    {
        int x = a[i] ^ a[i - 1];
        s[x] = 1;
        s[x | a[i]] = 1;
        s[x & a[i]] = 1;
        s[x | a[i - 1]] = 1;
        s[x & a[i - 1]] = 1;
    }
    cout << s.size() << "\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    //cin >> t;
    while (t--)
    {
        _Z();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3780kb

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3856kb

input:

2
3 5

output:

7

result:

wrong answer 1st lines differ - expected: '8', found: '7'