QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#734100#9541. Expanding ArrayrdcamelotWA 0ms3744kbC++201.0kb2024-11-11 00:17:282024-11-11 00:17:28

Judging History

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

  • [2024-11-11 00:17:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3744kb
  • [2024-11-11 00:17:28]
  • 提交

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|y);
        s.insert(x|z);
        s.insert(x&y);
        s.insert(x&z);
        s.insert(x^y);
        s.insert(x^z);
        s.insert(y|z);
        s.insert(y&z);
        s.insert(y^z);
    }
    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: 3524kb

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

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

input:

2
3 5

output:

6

result:

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