Submission #959776

# Submission time Handle Problem Language Result Execution time Memory
959776 2024-04-09T05:06:05 Z irmuun Secret (JOI14_secret) C++17
0 / 100
364 ms 11828 KB
#include<bits/stdc++.h>
#include "secret.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

const ll maxn=1e3+5;

int n;
vector<pair<int,int>>v;
int pre[maxn][maxn],suf[maxn][maxn];
int a[maxn];
void build(int l,int r){
    if(l+1>=r) return;
    int mid=(l+r)/2;
    suf[mid][mid]=a[mid];
    for(int i=mid-1;i>=l;i--){
        suf[mid][i]=Secret(suf[mid][i+1],a[i]);
    }
    pre[mid+1][mid+1]=a[mid+1];
    for(int i=mid+2;i<=r;i++){
        pre[mid+1][i]=Secret(pre[mid+1][i-1],a[i]);
    }
    build(l,mid);
    build(mid+1,r);
}
int ask(int l,int r,int L,int R){
    int mid=(l+r)/2;
    if(R<=mid){
        return ask(l,mid,L,R);
    }
    if(L>=mid+1){
        return ask(mid+1,r,L,R);
    }
    return Secret(suf[mid][L],pre[mid+1][R]);
}
void Init(int N,int A[]){
    n=N;
    for(int i=0;i<n;i++){
        a[i]=A[i];
    }
    build(0,n-1);
}
int Query(int l,int r){
    if(l==r){
        return a[l];
    }
    if(l+1==r){
        return Secret(a[l],a[r]);
    }
    return ask(0,n-1,l,r);
}
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 10828 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015.
2 Incorrect 95 ms 10920 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 107 ms 10920 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 360 ms 11828 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 364 ms 11564 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 354 ms 11692 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445.
7 Incorrect 361 ms 11600 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 356 ms 11688 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 351 ms 11604 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 351 ms 11600 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.