Submission #708104

# Submission time Handle Problem Language Result Execution time Memory
708104 2023-03-11T05:16:27 Z Dan4Life Secret (JOI14_secret) C++17
0 / 100
465 ms 4420 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

const int mxN = 1010;
const int mxLg = 10;
int n, a[mxN], ans[mxLg][mxN], mask[mxN];

void dnc(int l, int r, int lev){
    if(l==r) return;
    int m = (l+r)/2; ans[lev][m]=a[m], ans[lev][m+1]=a[m+1];
    for(int i = m-1; i>=l; i--) ans[lev][m] = Secret(a[i],ans[lev][i+1]);
    for(int i = m+2; i<=r; i++) ans[lev][i] = Secret(ans[lev][i-1],a[i]);
    for(int i = m+1; i<=r; i++) mask[i]^=(1<<lev);
    dnc(l,m,lev+1), dnc(m+1,r,lev+1);
}

void Init(int N, int A[]) {
    for(int i = 0; i < N; i++) a[i]=A[i];
    dnc(0,N-1,0); n=N;
}

int Query(int L, int R) {
    if(L==R) return a[L];
    int m = __builtin_ctz(mask[L]^mask[R]);
    return Secret(ans[m][L],ans[m][R]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 127 ms 2476 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 860971434.
2 Incorrect 116 ms 2508 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 712055264.
3 Incorrect 117 ms 2420 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 539361598.
4 Incorrect 457 ms 4376 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 374358039.
5 Incorrect 431 ms 4316 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 483966986.
6 Incorrect 436 ms 4360 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 815981841.
7 Incorrect 454 ms 4420 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 177907722.
8 Incorrect 446 ms 4320 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 489869504.
9 Incorrect 439 ms 4352 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 702032905.
10 Incorrect 465 ms 4372 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 336488262.