Submission #411880

# Submission time Handle Problem Language Result Execution time Memory
411880 2021-05-26T07:47:22 Z Killer2501 Secret (JOI14_secret) C++17
0 / 100
538 ms 6744 KB
#include<bits/stdc++.h>
#include "secret.h"
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define task "hopscotch"
#define pii pair<ll, pll>
using namespace std;
using ll = long long;
const int  N = 1e5+55;
const ll mod = 998244353;
const ll base = 350;
const ll cs = 331;
int m, n, t, k, a[N], ans, tong, b[N], c[N], d[N], P[N][22];
vector<ll> adj[N], kq;
ll pw(ll k, ll n)
{
    ll total = 1;
    for(; n; n >>= 1)
    {
        if(n & 1)total = total * k % mod;
        k = k * k % mod;
    }
    return total;
}

void build(int l, int r, int lv)
{
    if(l == r)return;
    ll mid = (l + r)  / 2;
    P[mid][lv] = b[mid];
    P[mid+1][lv] = b[mid+1];
    for(int i = mid-1; i >= l; i --)P[i][lv] = Secret(b[i], P[i+1][lv]);
    a[mid+1] ^= (1<<lv);
    for(int i = mid+2; i <= r; i ++)
    {
        P[i][lv] = Secret(b[i], P[i-1][lv]);
        a[i] ^= (1<<lv);
    }
    build(l, mid, lv+1);
    build(mid+1, r, lv+1);
}

void Init(int n, int A[])
{
    m = n;
    for(int i = 0; i < m; i ++)b[i] = A[i];
    build(0, m-1, 0);
}
int Query(int l, int r)
{
    if(l == r)return b[l];
    int id = __builtin_ctz(a[l]^a[r]);
    return Secret(P[l][id], P[r][id]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 139 ms 4700 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 169 ms 4788 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 140 ms 4748 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 519 ms 6744 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 535 ms 6680 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 509 ms 6704 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 515 ms 6664 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 538 ms 6644 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 520 ms 6628 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 514 ms 6676 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.