답안 #558645

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
558645 2022-05-07T19:45:40 Z groshi 비밀 (JOI14_secret) C++17
0 / 100
497 ms 9576 KB
#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,y1,l,r);
    else return zap(x1,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 127 ms 4708 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 129 ms 4684 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 118 ms 4688 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 497 ms 9500 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 442 ms 9496 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 494 ms 9544 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 935077363.
7 Incorrect 488 ms 9572 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 446 ms 9508 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 485 ms 9496 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 497 ms 9576 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.