QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#734103#9541. Expanding ArrayrdcamelotWA 0ms3572kbC++20892b2024-11-11 00:20:412024-11-11 00:20:41

Judging History

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

  • [2024-11-11 00:20:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3572kb
  • [2024-11-11 00:20:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using i64=long long;
using u64=unsigned long long;
#define ll long long
const int inf=1e9;
const ll inff=1e18;
using i128=__int128;

void solve(){
    int n;
    cin>>n;
    vector<i64> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    //  a b     |  ^  &    |^^  
    //  1 0     1  1  0     0
    //  1 1     1  0  1     1
    //  0 0     0  0  0     0
    set<i64> s=set(a.begin(),a.end());
    for(int i=0;i<n-1;i++){
        int x=a[i]|a[i+1];
        int y=a[i]^a[i+1];
        int z=a[i]&a[i+1];
        s.insert(x);
        s.insert(y);
        s.insert(z);
        s.insert(x^a[i]);
        s.insert(x^a[i+1]);
    }
    cout<<s.size()<<'\n';
}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    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: 0ms
memory: 3532kb

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

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

input:

2
3 5

output:

7

result:

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