답안 #396260

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
396260 2021-04-29T15:53:51 Z Killer2501 비밀 (JOI14_secret) C++14
0 / 100
537 ms 8856 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][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]);
                if(i+l<n)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]);
}

# 결과 실행 시간 메모리 Grader output
1 Runtime error 135 ms 4752 KB Execution killed with signal 11
2 Runtime error 134 ms 4716 KB Execution killed with signal 11
3 Runtime error 137 ms 4680 KB Execution killed with signal 11
4 Runtime error 522 ms 8856 KB Execution killed with signal 11
5 Runtime error 495 ms 8608 KB Execution killed with signal 11
6 Runtime error 501 ms 8632 KB Execution killed with signal 11
7 Runtime error 537 ms 8796 KB Execution killed with signal 11
8 Runtime error 499 ms 8712 KB Execution killed with signal 11
9 Runtime error 495 ms 8616 KB Execution killed with signal 11
10 Runtime error 519 ms 8712 KB Execution killed with signal 11