답안 #406635

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
406635 2021-05-17T21:57:34 Z ScarletS 비밀 (JOI14_secret) C++17
0 / 100
561 ms 8184 KB
#include <bits/stdc++.h>
#include "secret.h"

int n, a[1000], pre[1000][1000];

void build(int l, int r)
{
    if (l+1>=r)
        return;
    int m=l+(r-l)/2;
    pre[m][m]=a[m];
    pre[m+1][m+1]=a[m];
    for (int i=m-1;i>=l;--i)
        pre[i][m]=Secret(a[i],pre[i+1][m]);
    for (int i=m+2;i<=r;++i)
        pre[m+1][i]=Secret(pre[m+1][i-1],a[i]);
    build(l,m);
    build(m+1,r);
}

void Init(int N, int A[])
{
    n=N;
    for (int i=0;i<n;++i)
        a[i]=A[i];
    build(1,n);
}

int Query(int l, int r)
{
    if (l==r)
        return a[l];
    if (l+1==r)
        return Secret(a[l],a[r]);
    int x=0, y=n-1, m;
    while (1)
    {
        m=x+(y-x)/2;
        if (l<=m&&m<r)
            return Secret(pre[l][m],pre[m+1][r]);
        if (m<l)
            x=m+1;
        else
            y=m;
    }
    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 157 ms 4292 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 139 ms 4352 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 137 ms 4288 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 514 ms 8080 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 539 ms 8092 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 512 ms 8128 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 137085666.
7 Incorrect 512 ms 8168 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 525 ms 8168 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 520 ms 8160 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 561 ms 8184 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.