# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730976 | alexdd | Secret (JOI14_secret) | C++17 | 469 ms | 4320 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
long long bit[2][2];
long long a[1005];
long long n;
long long op(long long x, long long y)
{
long long rez=0,a,b;
for(long long i=0;i<30;i++)
{
a = ((x&(1LL<<i))!=0);
b = ((y&(1LL<<i))!=0);
rez += (1LL<<i) * bit[a][b];
}
return rez;
}
void Init(int N, int A[])
{
for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
bit[i][j] = Secret(i,j);
n=N;
for(int i=1;i<=n;i++)
a[i]=A[i];
}
int Query(int L, int R)
{
long long rez = a[L];
for(int i=L+1;i<=R;i++)
{
rez = op(rez, a[L]);
}
return rez;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |