답안 #406628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
406628 2021-05-17T20:44:54 Z ScarletS 비밀 (JOI14_secret) C++17
0 / 100
20000 ms 8268 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+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&&m<r)
            x=m+1;
        else
            y=m;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 163 ms 4380 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 942818464.
2 Incorrect 139 ms 4400 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 147199609.
3 Incorrect 137 ms 4416 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 884288761.
4 Incorrect 523 ms 8192 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 113654935.
5 Incorrect 507 ms 8260 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 851197205.
6 Execution timed out 20045 ms 8244 KB Time limit exceeded
7 Incorrect 523 ms 8196 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 897938834.
8 Incorrect 525 ms 8196 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 50311972.
9 Incorrect 524 ms 8148 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 261536590.
10 Incorrect 524 ms 8268 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 888678686.