#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
vector<int>v,dp[20];
void daq(int i,int l,int r)
{
if(l==r)
{
dp[i][l]=v[l];
return;
}
int m=(l+r)/2;
dp[i][m]=v[m];
for(int j=m-1;j>=l;j--)
{
dp[i][j]=Secret(dp[i][j+1],v[j]);
}
dp[i][m+1]=v[m+1];
for(int j=m+2;j<=r;j++)
{
dp[i][j]=Secret(dp[i][j-1],v[j]);
}
daq(i+1,l,m);
daq(i+1,m+1,r);
}
int najdi(int i,int l,int r)
{
if(l==r)
{
return v[l];
}
int m=(l+r)/2;
if(l<=m&&m<r)
{
return Secret(dp[i][l],dp[i][r]);
}
else if(r<=m)
{
return najdi(i+1,l,m);
}
else
{
return najdi(i+1,m+1,r);
}
}
void Init(int N,int A[])
{
for(int i=0;i<N;i++)
{
v.push_back(A[i]);
}
for(int i=0;i<20;i++)
{
dp[i].resize(N);
}
daq(0,0,N-1);
}
int Query(int l,int r)
{
return najdi(0,l,r);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
78 ms |
2384 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 319908220. |
2 |
Incorrect |
78 ms |
2388 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
78 ms |
2424 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
298 ms |
4540 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 545915524. |
5 |
Incorrect |
302 ms |
4356 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 307380480. |
6 |
Incorrect |
303 ms |
4436 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 950550627. |
7 |
Incorrect |
301 ms |
4348 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
308 ms |
4480 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
303 ms |
4340 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
307 ms |
4440 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |