Submission #565527

# Submission time Handle Problem Language Result Execution time Memory
565527 2022-05-21T04:12:01 Z ac2hu Secret (JOI14_secret) C++14
0 / 100
877 ms 12224 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
const int _N = 1e3 + 1;
int RR[_N][_N];// right[i][j] = query(j, i)
int LL[_N][_N]; // left[i][j] = query(i, j)
vector<int> temp;
int a[_N];
int n;
void build(int l,int r){
    if(l + 1 < r){
        int mid = (l + r + 1)/2; 
        assert(mid < r && l <= mid);
        temp.push_back(mid);
        RR[mid + 1][mid] = a[mid + 1];
        for(int i = mid + 2;i<=r;i++){
            RR[i][mid] = Secret(RR[i - 1][mid],  a[i]);
        }
        LL[mid][mid] = a[mid];
        for(int i = mid - 1;i>=0;i--){
            LL[i][mid] = Secret(LL[i + 1][mid], a[i]);
        }
        build(l, mid);
        build(mid, r);
    }
}
void Init(int N, int A[]) {
    for(int i = 0;i<N;i++)
        a[i] = A[i];
    build(1, N - 1);
}
int Query(int L, int R) {
    if(L == R){
        return a[L];
    }
    else if(L + 1 == R)
        return Secret(a[L], a[R]);
    else{
        for(auto e : temp){
            if(L <= e && e < R)return Secret(LL[L][e], RR[R][e]);
        }
        assert(false);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 249 ms 6264 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536955102.
2 Incorrect 218 ms 6292 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 747241792.
3 Incorrect 232 ms 6408 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 688130334.
4 Incorrect 869 ms 12004 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 391774777.
5 Incorrect 869 ms 12104 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 497583184.
6 Incorrect 877 ms 12020 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192.
7 Incorrect 850 ms 12224 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 657493000.
8 Incorrect 867 ms 12044 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 764569728.
9 Incorrect 866 ms 12120 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277877441.
10 Incorrect 872 ms 12176 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 69725386.