Submission #396208

# Submission time Handle Problem Language Result Execution time Memory
396208 2021-04-29T14:33:46 Z Killer2501 Secret (JOI14_secret) C++14
0 / 100
515 ms 4564 KB
#include<bits/stdc++.h>
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#include "secret.h"
#define task "hopscotch"
#define pii pair<ll, pll>
using namespace std;
using ll = long long;
const int  N = 1e3+55;
const ll mod = 998244353;
const ll base = 350;
const ll cs = 331;
ll m, n, t, k, a[N], ans, tong, b[N], c[N], d[N], P[N][10];
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;
}

ll findp(ll u, ll lab[])
{
    return lab[u] < 0 ? u : lab[u] = findp(lab[u], lab);
}
void hop(ll u, ll v, ll lab[])
{
    u = findp(u, lab);
    v = findp(v, lab);
    if(u == v)return;
    if(lab[u] > lab[v])swap(lab[u], lab[v]);
    lab[u] += lab[v];
    lab[v] = u;
}
void dfs(ll u, ll p)
{
    for(ll v : adj[u])
    {
        if(v == p)continue;

    }
}
void sol()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i ++)cin >> a[i];
    for(int i = 1; i < n; i ++)
    {
        ll x, y;
        cin >> x >> y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    dfs(m, 0);
    cin >> m;
    while(m -- > 0)
    {
        ll xi, ki;
        cin >> xi >> ki;
        xi = (xi + ans) % n + 1;
        ki = (ki + ans) % n;
    }
}
void Init(int n, int a[])
{
    for(int i = 0; i < n; i ++)P[i][0] = a[i];
    for(int j = 1; j < 10; j ++)
    {
        int len = (1<<j);
        for(int i = len; i < n; i += 2*len)
        {
            P[i][j] = a[i];
            P[i-1][j] = a[i-1];
            for(int l = 1; l < len; l ++)
            {
                P[i-l-1][j] = Secret(a[i-l-1], P[i-l][j]);
                P[i+l][j] = Secret(a[i+l], P[i+l-1][j]);
            }
        }
    }
}
int Query(int l, int r)
{
    if(l == r)return P[l][0];
    int id = 31 - __builtin_clz(l^r);
    return Secret(P[l][id], P[r][id]);
}

# Verdict Execution time Memory Grader output
1 Incorrect 131 ms 2388 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 152 ms 2400 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 132 ms 2460 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996.
4 Incorrect 491 ms 4420 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 70926549.
5 Incorrect 496 ms 4564 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 849351688.
6 Incorrect 498 ms 4560 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 722663411.
7 Incorrect 498 ms 4420 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 661138442.
8 Incorrect 500 ms 4468 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 878738504.
9 Incorrect 500 ms 4452 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 26754469.
10 Incorrect 515 ms 4388 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 7889739.