# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
54641 |
2018-07-04T10:48:44 Z |
gs18115 |
Secret (JOI14_secret) |
C++14 |
|
747 ms |
8572 KB |
#include"secret.h"
#include<map>
using namespace std;
map<pair<int,int>,bool>CHK;
map<pair<int,int>,int>SEC;
int ST[4567];
int N2;
int Secret2(int X,int Y)
{
pair<int,int>P;
P=make_pair(X,Y);
if(CHK[P])
return SEC[P];
CHK[P]=true;
return SEC[P]=Secret(X,Y);
}
void P(int I,int N)
{
if(!I)return;
ST[I]=N;
if(I&1)
P(I>>1,Secret2(ST[I^1],N));
else
P(I>>1,Secret2(N,ST[I^1]));
}
int Q(int S,int F)
{
if(S>F)return 0;
int A;
A=Q(S+1>>1,F-1>>1);
if(S&1)
A=Secret2(ST[S],A);
if(!(F&1))
A=Secret2(A,ST[F]);
return A;
}
void Init(int N,int A[])
{
for(N2=1;N2<N;N2<<=1);
for(int i=0;i<N;i++)
P(i+N2,A[i]);
}
int Query(int L,int R)
{
return Q(L+N2,R+N2);
}
Compilation message
secret.cpp: In function 'int Q(int, int)':
secret.cpp:30:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
A=Q(S+1>>1,F-1>>1);
~^~
secret.cpp:30:17: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
A=Q(S+1>>1,F-1>>1);
~^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
159 ms |
3064 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537. |
2 |
Incorrect |
162 ms |
3240 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529. |
3 |
Incorrect |
157 ms |
3264 KB |
Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628. |
4 |
Incorrect |
603 ms |
5844 KB |
Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619. |
5 |
Incorrect |
644 ms |
6008 KB |
Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752. |
6 |
Incorrect |
581 ms |
6224 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 278446241. |
7 |
Incorrect |
662 ms |
7504 KB |
Output isn't correct - number of calls to Secret by Init = 9203, maximum number of calls to Secret by Query = 11 |
8 |
Incorrect |
636 ms |
8368 KB |
Output isn't correct - number of calls to Secret by Init = 9196, maximum number of calls to Secret by Query = 11 |
9 |
Incorrect |
633 ms |
8572 KB |
Output isn't correct - number of calls to Secret by Init = 9191, maximum number of calls to Secret by Query = 12 |
10 |
Incorrect |
747 ms |
8572 KB |
Output isn't correct - number of calls to Secret by Init = 9211, maximum number of calls to Secret by Query = 11 |