QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#760548#9541. Expanding ArraysnpmrnhlolWA 1ms3636kbC++14688b2024-11-18 17:31:422024-11-18 17:31:42

Judging History

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

  • [2024-11-18 17:31:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3636kb
  • [2024-11-18 17:31:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5;
int v[N];
set <int> f;
int main(){
    int n;
    cin>>n;
    for(int i = 0;i < n;i++){
        cin>>v[i];
        if(i){
            for(int j = 1;j < 8;j++){
                int nr = 0;
                for(int k = 0;k < 30;k++){
                    if(((v[i]>>k)&1) && ((v[i - 1]>>k)&1) && ((j>>0)&1))nr+=(1<<k);
                    if(((v[i]>>k)&1) && !((v[i - 1]>>k)&1) && ((j>>1)&1))nr+=(1<<k);
                    if(!((v[i]>>k)&1) && ((v[i - 1]>>k)&1) && ((j>>2)&1))nr+=(1<<k);
                }
                f.insert(nr);
            }
        }
    }
    cout<<f.size();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3

output:

4

result:

ok single line: '4'

Test #2:

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

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'