# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
540767 |
2022-03-21T17:09:18 Z |
amin |
Secret (JOI14_secret) |
C++14 |
|
469 ms |
4788 KB |
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
long n;
long u;
long a[130000];
map<pair<long,long>,long>m;
void build(long v,long tl,long tr)
{
if(tl==tr)
{
return ;
}
long tm=(tl+tr)/2;
long ans=a[tm];
for(long i=tm-1;i>=tl;i--)
{
ans=Secret(a[i],ans);
m[{i,tm}]=ans;
}
ans=a[tm+1];
for(long i=tm+2;i<=tr;i++)
{
ans=Secret(ans,a[i]);
m[{tm+1,i}]=ans;
}
build(v*2,tl,tm);
build(v*2+1,tm+1,tr);
}
long get(long v,long tl,long tr,long l,long r)
{
long tm=(tl+tr)/2;
if(r<=tm)
{
return get(v*2,tl,tm,l,r);
}
if(l>tm)
{
return get(v*2+1,tm+1,tr,l,r);
}
long ans=Secret(m[{l,tm}],m[{tm+1,r}]);
return ans;
}
void Init(int N, int A[]) {
n=N;
for(long i=0;i<N;i++)
{
a[i]=A[i];
m[{a[i],a[i]}]=a[i];
}
build(1,0,n-1);
}
int Query(int L, int R) {
if(L==R)
{
return a[L-1];
}
return get(1,0,n-1,L-1,R-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
118 ms |
2508 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791. |
2 |
Incorrect |
122 ms |
2508 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408. |
3 |
Incorrect |
120 ms |
2508 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540. |
4 |
Incorrect |
467 ms |
4788 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308. |
5 |
Incorrect |
455 ms |
4700 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560. |
6 |
Incorrect |
445 ms |
4788 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611. |
7 |
Incorrect |
445 ms |
4780 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096. |
8 |
Incorrect |
461 ms |
4676 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552. |
9 |
Incorrect |
469 ms |
4720 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041. |
10 |
Incorrect |
464 ms |
4748 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089. |