Submission #13321

# Submission time Handle Problem Language Result Execution time Memory
13321 2015-02-11T17:06:10 Z dohyun0324 XOR (IZhO12_xor) C++
10 / 100
2000 ms 100420 KB
#include<stdio.h>
#include<map>
#include<string.h>
using namespace std;
map<int,int>ch;
int ans,p,len,n,x,a[250010],b[250010],sum[250010],dap[250010],t;
int main()
{
    int i,j;
    scanf("%d %d",&n,&x);
    for(i=1;i<=n;i++) scanf("%d",&a[i]);
    for(i=30;i>=0;i--){
        if(x&(1<<i)){
            t+=(1<<i);
            for(j=1;j<=n;j++){
                if((1<<i)&a[j]) b[j]+=(1<<i);
                sum[j]=sum[j-1]^b[j];
            }
        }
        else{
            t+=(1<<i);
            for(j=1;j<=n;j++){
                if((1<<i)&a[j]) b[j]+=(1<<i);
                sum[j]=sum[j-1]^b[j];
                ch[sum[j]]=j;
            }
            for(j=1;j<=n;j++) dap[j]=max(dap[j],ch[sum[j-1]^t]);
            for(j=1;j<=n;j++) ch[sum[j]]=0;
            t-=(1<<i);
        }
    }
    for(j=1;j<=n;j++) dap[j]=max(dap[j],ch[sum[j-1]^t]);
    for(j=1;j<=n;j++) ch[sum[j]]=0;
    for(i=1;i<=n;i++){
        if(ans<dap[i]-i+1) ans=dap[i]-i+1, p=i;
    }
    printf("%d %d",p,ans);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5120 KB Output is correct
2 Incorrect 0 ms 5120 KB Output isn't correct
3 Correct 0 ms 5120 KB Output is correct
4 Incorrect 3 ms 5384 KB Output isn't correct
5 Incorrect 23 ms 6572 KB Output isn't correct
6 Incorrect 38 ms 7232 KB Output isn't correct
7 Incorrect 24 ms 6968 KB Output isn't correct
8 Incorrect 25 ms 6968 KB Output isn't correct
9 Incorrect 749 ms 39572 KB Output isn't correct
10 Incorrect 772 ms 40364 KB Output isn't correct
11 Incorrect 597 ms 35744 KB Output isn't correct
12 Incorrect 577 ms 33368 KB Output isn't correct
13 Incorrect 434 ms 29408 KB Output isn't correct
14 Incorrect 578 ms 33632 KB Output isn't correct
15 Incorrect 1142 ms 51056 KB Output isn't correct
16 Incorrect 547 ms 28088 KB Output isn't correct
17 Execution timed out 2000 ms 97916 KB Program timed out
18 Execution timed out 2000 ms 88148 KB Program timed out
19 Execution timed out 2000 ms 100420 KB Program timed out
20 Incorrect 1907 ms 76664 KB Output isn't correct