QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687182#4810. Add Onelichenyu_acWA 0ms3952kbC++14890b2024-10-29 17:32:252024-10-29 17:32:27

Judging History

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

  • [2024-10-29 17:32:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3952kb
  • [2024-10-29 17:32:25]
  • 提交

answer

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N=1e6+10;

int n;
ll now,ans;

struct LinearBasis{
    ll c[70];
    void init(){
        memset(c,0,sizeof(c));
    }

    void insert(ll x){
        for(int i=60;~i;i--){
            if(x>>i&1){
                if(!c[i])return c[i]=x,void();
                else x^=c[i];
            }
        }
    }

    bool ask(ll x){
        for(int i=60;~i;i--){
            if(x>>i&1){
                if(c[i])x^=c[i];
                else return 0;
            }
        }
        return 1;
    }
}L;

int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        ll x;scanf("%lld",&x);
        L.insert(x);
        now^=x;
    }
    for(int i=60;~i;i--){
        if(L.ask((1ll<<i)-1))ans=max(ans,now^((1ll<<(i+1))-1));
    }
    printf("%lld\n",ans);
    return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3952kb

input:

4
1 2 1 2

output:

7

result:

ok 1 number(s): "7"

Test #2:

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

input:

5
1 2 3 4 5

output:

14

result:

ok 1 number(s): "14"

Test #3:

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

input:

6
1 2 4 7 15 31

output:

47

result:

ok 1 number(s): "47"

Test #4:

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

input:

5
41 40 50 11 36

output:

99

result:

ok 1 number(s): "99"

Test #5:

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

input:

6
10 40 60 2 44 47

output:

96

result:

ok 1 number(s): "96"

Test #6:

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

input:

6
46 25 39 47 23 60

output:

107

result:

ok 1 number(s): "107"

Test #7:

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

input:

6
56 90 61 63 56 23

output:

78

result:

wrong answer 1st numbers differ - expected: '112', found: '78'