답안 #293353

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293353 2020-09-08T00:27:29 Z XmtosX 비밀 (JOI14_secret) C++17
0 / 100
509 ms 8440 KB
#include <bits/stdc++.h>;
#include "secret.h"
using namespace std;
#define LL pos*2+1
#define RR pos*2+2
const int NN=1e3+3;
int a[NN],n,ans[NN][NN],l,r;
void solve(int st,int en)
{
    if (st>en)
        return;
    int mid=(st+en)/2;
    ans[mid][mid]=a[mid];
    ans[mid+1][mid+1]=a[mid+1];
    ans[mid][mid+1]=Secret(a[mid],a[mid+1]);
    for (int i=mid+2;i<=en;i++)
        ans[mid+1][i]=Secret(ans[mid+1][i-1],a[i]);
    for (int i=mid-1;i>=st;i--)
        ans[i][mid]=Secret(ans[i+1][mid],a[i]);
    solve(st,mid-1);
    solve(mid+1,en);
}
int query(int st,int en)
{
    int mid=(st+en)/2;
    if (mid>r)
        return query(st,mid-1);
    if (mid<l)
        return query(mid+1,en);
    if (r==mid||l==mid)
        return ans[l][r];
    return Secret(ans[l][mid],ans[mid+1][r]);
}
void Init(int N, int A[])
{
    n=N;
    for (int i=0;i<n;i++)
        a[i]=A[i];
    solve(0,n-1);
}
int Query(int L, int R)
{
    l=L;
    r=R;
    return query(0,n-1);
}
/*
8
1 4 7 2 5 8 3 6
4
0 3
1 7
5 5
2 4
*/

Compilation message

secret.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>;
      |                         ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 134 ms 4472 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 133 ms 4600 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 137 ms 4472 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 501 ms 8440 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 495 ms 8344 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 504 ms 8440 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 850129153.
7 Incorrect 509 ms 8440 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 498 ms 8312 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 505 ms 8392 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 508 ms 8312 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.