Submission #476764

# Submission time Handle Problem Language Result Execution time Memory
476764 2021-09-28T13:39:38 Z Karliver Secret (JOI14_secret) C++17
0 / 100
535 ms 4476 KB
    
#include <bits/stdc++.h>
#include "secret.h"

#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(20) << (x)
#define all(v) (v).begin(), (v).end()
using namespace  std;
#define forn(i,n) for (int i = 0; i < (n); ++i)
#define rforn(i, n) for(int i = (n) - 1;i >= 0;--i)
using ll = long long;
int mod = (ll)1e9 + 7;
#define PI acos(-1)
typedef pair<int, int> pairs;

const int INF = 1e9 + 1;
const int N = 1002;
const double eps = 1e-7;

template <class T> using V = vector<T>;  
template <class T> using VV = V<V<T>>;  

template <typename XPAX>
void ckma(XPAX &x, XPAX y) {
    x = (x < y ? y : x);
}
template <typename XPAX>
void ckmi(XPAX &x, XPAX y) {
    x = (x > y ? y : x);
}
int F[N][11];
int mask[N];
V<int> A(N);
int n;
void divi(int l, int r, int lev) {
    if(l == r)
        return;

    int rm = (l + r) / 2;
    F[rm][lev] = A[rm];
    F[rm + 1][lev] = A[rm + 1];
    for(int i = rm - 1;i >= l;--i)
        F[i][lev] = Secret(A[i], F[i + 1][lev]);

    for(int i = rm + 2;i <= r;++i)
        F[i][lev] = Secret(A[i], F[i - 1][lev]);

    for(int i = rm + 1;i <= r;++i)
        mask[i] ^= 1 << lev;

    divi(l, rm, lev + 1);
    divi(rm + 1, r, lev + 1);
}
void Init(int D, int s[]) {
    forn(i, D) A[i] = s[i];
    n = D;
    divi(0, n - 1, 0);
}
int Query(int L, int R) {
    if(L == R)
        return A[L];

    int b = __builtin_ctz(mask[L] ^  mask[R]);

    return Secret(F[L][b], F[R][b]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 2364 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 162 ms 2484 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 134 ms 2460 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 502 ms 4348 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 508 ms 4476 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 503 ms 4380 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 525 ms 4292 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 511 ms 4340 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 507 ms 4320 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 535 ms 4340 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.