답안 #411872

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411872 2021-05-26T07:31:13 Z Killer2501 비밀 (JOI14_secret) C++14
0 / 100
564 ms 15600 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 = 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][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;
}

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 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]);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 155 ms 11716 KB Execution killed with signal 11
2 Runtime error 145 ms 11648 KB Execution killed with signal 11
3 Runtime error 142 ms 11640 KB Execution killed with signal 11
4 Runtime error 516 ms 15552 KB Execution killed with signal 11
5 Runtime error 507 ms 15560 KB Execution killed with signal 11
6 Runtime error 564 ms 15564 KB Execution killed with signal 11
7 Runtime error 519 ms 15508 KB Execution killed with signal 11
8 Runtime error 523 ms 15532 KB Execution killed with signal 11
9 Runtime error 513 ms 15600 KB Execution killed with signal 11
10 Runtime error 526 ms 15564 KB Execution killed with signal 11