QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#809462#9541. Expanding ArrayYipChip#WA 1ms3636kbC++23670b2024-12-11 15:15:212024-12-11 15:15:22

Judging History

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

  • [2024-12-11 15:15:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3636kb
  • [2024-12-11 15:15:21]
  • 提交

answer

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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    // cin >> T;
    while (T -- ) solve();    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

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

input:

2
3 5

output:

7

result:

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