답안 #1100941

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1100941 2024-10-15T04:38:46 Z doducanh 비밀 (JOI14_secret) C++14
0 / 100
321 ms 8304 KB
///breaker
#include "secret.h"
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define ii pair<int,int>
#define mp make_pair
#define in(x) freopen(x,"r",stdin)
#define out(x) freopen(x,"w",stdout)
#define bit(x,i) ((x>>i)&1)
#define lc (id<<1)
#define rc ((id<<1)^1)
const int maxn=1005;
int pre[maxn][maxn];
int a[maxn];
int n;
void dac(int l,int r)
{
    int m=(l+r)/2;
    pre[m][m]=a[m];
    pre[m+1][m+1]=a[m+1];
    for(int i=l;i<=m-1;i++){
        pre[i][m]=Secret(a[i],pre[m][m+1]);
    }
    for(int i=m+2;i<=r;i++){
        pre[m][i]=Secret(pre[m+1][i-1],a[i]);
    }
    if(l<m)dac(l,m);
    if(m+1<r)dac(m+1,r);
}
void Init(int N,int A[])
{
    n=N;
    for(int i=0;i<n;i++){
        a[i]=A[i];
    }
    dac(0,n-1);
}
int Query(int l,int r)
{
    int lo=0,hi=n-1;
    while(lo!=hi){
        int m=(lo+hi)/2;
        if(m>=l&&m<r){
            return Secret(pre[m][l],pre[m+1][r]);
        }
        else if(m==r){
            return pre[m][l];
        }
        else if(m<l){
            lo=m+1;
        }
        else r=m;
    }
    return pre[lo][lo];
}
/* stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN
 * DON'T GET STUCK ON ONE APPROACH
 */
# 결과 실행 시간 메모리 Grader output
1 Incorrect 79 ms 6728 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 0.
2 Incorrect 79 ms 6680 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 79 ms 6772 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 300 ms 8264 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 0.
5 Incorrect 300 ms 8240 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 321 ms 8296 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0.
7 Incorrect 300 ms 8300 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 314 ms 8304 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 309 ms 8264 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 316 ms 8300 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.