Submission #540788

# Submission time Handle Problem Language Result Execution time Memory
540788 2022-03-21T17:49:04 Z Runtime_error_ Secret (JOI14_secret) C++14
0 / 100
436 ms 4700 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

int a[1111];
int n;
vector<int> pre[4444];
vector<int> suf[4444];
void build(int p,int s,int e)
{
    if(s==e){
        suf[p].push_back(a[s]);
        return;
    }
    int mid=(s+e)/2;
    build(p*2,s,mid);
    build(p*2+1,mid+1,e);
    pre[p].push_back(a[mid+1]);
    for(int i=mid+2;i<=e;i++){
        pre[p].push_back(Secret(a[i],pre[p].back()));
    }
    suf[p].push_back(a[mid]);
    for(int i=mid-1;i>=s;i--){
        suf[p].push_back(Secret(a[i],suf[p].back()));
    }
}
int get(int p,int s,int e,int a,int b)
{
    int mid=(s+e)/2;
    if(a<=mid&&mid<=b){
        if(b==mid){
            int h=mid-a;
            return suf[p][h];
        }
        else{
            int h=mid-a;
            int h2=b-(mid+1);
            return Secret(suf[p][h],pre[p][h2]);
        }
    }
    if(b<=mid){
        return get(p*2,s,mid,a,b);
    }
    else{
        return get(p*2+1,mid+1,e,a,b);
    }
}
void Init(int N, int A[]){
    n=N;
    for(int i=0;i<n;i++){
        a[i]=A[i];
    }
    build(1,0,n-1);
}

int Query(int L, int R) {
    return get(1,0,n-1,L,R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 128 ms 2628 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 116 ms 2588 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 112 ms 2560 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 432 ms 4528 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 427 ms 4576 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 427 ms 4492 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 434 ms 4512 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 434 ms 4596 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 436 ms 4500 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 426 ms 4700 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.