#include<iostream>
#include "secret.h"
using namespace std;
int n;
int t[100000];
long long wyn[1010][1010];
/*long long Secret(int x,int y)
{
return x+y;
}*/
void rob(int l,int r)
{
if(l>r)
return;
int sre=(l+r)/2;
wyn[sre][sre]=t[sre];
wyn[sre+1][sre+1]=t[sre+1];
for(int i=sre+2;i<=r;i++)
wyn[sre+1][i]=Secret(wyn[sre+1][i-1],t[i]);
for(int i=sre-1;i>=l;i--)
wyn[i][sre]=Secret(wyn[i+1][sre],t[i]);
if(sre>l)
rob(l,sre);
if(sre+1<r)
rob(sre+1,r);
}
long long zap(int x1,int y1,int l,int r)
{
int mid=(x1+y1)/2;
if(x1==y1)
return wyn[x1][y1];
if(l<=mid && mid<r)
return Secret(wyn[l][mid],wyn[mid+1][r]);
if(l>mid)
return zap(mid+1,r,l,r);
else return zap(l,mid,l,r);
}
void Init(int N,int A[])
{
n=N;
for(int i=0;i<n;i++)
t[i]=A[i];
rob(0,n-1);
}
int Query(int l,int r)
{
return zap(0,n-1,l,r);
}
/*int main()
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
int t[5]={1,4,2,3,6};
Init(5,t);
cout<<Query(0,4)<<"\n";
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
122 ms |
4812 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912. |
2 |
Incorrect |
120 ms |
4864 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
128 ms |
4812 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
450 ms |
9684 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912. |
5 |
Incorrect |
442 ms |
9720 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912. |
6 |
Incorrect |
449 ms |
9744 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 536870912. |
7 |
Incorrect |
454 ms |
9716 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
442 ms |
9636 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
480 ms |
9664 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
469 ms |
9668 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |