QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789979#9541. Expanding ArrayntxylWA 0ms3792kbC++231.1kb2024-11-27 23:21:282024-11-27 23:21:28

Judging History

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

  • [2024-11-27 23:21:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3792kb
  • [2024-11-27 23:21:28]
  • 提交

answer

#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'
#define int long long
#define all(v) v.begin(), v.end()
//#define x first
//#define y second

using namespace std;
typedef pair<int, int> PII;

const int N = 1e5 + 10;
int qmi(int a,int b){
    int res=1;
    while(b){
        if(b&1) res=res*a;
        b>>=1;
        a=a*a;
    }
    return res;
}

void solve() {
    int n;
    cin>>n;
    vector<int>a(n+1);
    // cout<<(1&1)<<endl;
    for(int i=1;i<=n;i++) cin>>a[i];
    set<int>s;
    s.insert(0);
    for(int i=1;i<n;i++){
        int x=a[i],y=a[i+1],z=x^y;
        int cnt1=0,cnt2=0,cnt3=0,cnt4=0;
        for(int j=0;j<=31;j++){
            int xx=(x>>j)&1,yy=(y>>j)&1,zz=(z>>j)&1;
            if(xx&yy) cnt1+=qmi(2,j);
            if(xx|yy) cnt2+=qmi(2,j);
            if(xx&&zz) cnt3+=qmi(2,j);
            if(yy&&zz) cnt4+=qmi(2,j);
        }
        s.insert({cnt1,cnt2,cnt3,x,y,z});
    }
    cout<<s.size()<<endl;
}
signed main() {
    fastio;
    int T;
 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: 3792kb

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

input:

2
3 4

output:

4

result:

ok single line: '4'

Test #3:

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

input:

2
3 5

output:

7

result:

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