Submission #41806

# Submission time Handle Problem Language Result Execution time Memory
41806 2018-02-21T09:20:25 Z krauch Amusement Park (JOI17_amusement_park) C++14
Compilation error
0 ms 0 KB
#include "Ioi.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define eb emplace_back
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)

static const int MAXN = 2e4 + 6;

static int n, m, comp[MAXN], cnt, par[MAXN], CUR;
static ll X, sz[MAXN], lvl[MAXN], ans[66];
static vector < int > g[MAXN];
static bool u[MAXN];

void dfs(int v) {
    CUR++;
    u[v] = 1;
    for (auto to : g[v]) {
        if (u[to]) continue;
        if (sz[comp[v]] == 60)
            comp[to] = ++cnt;
        else
            comp[to] = comp[v];
        lvl[to] = sz[comp[to]];
        sz[comp[to]]++;
        par[to] = v;
        dfs(to);
    }
}

void dfs2(int v, int val) {
    u[v] = 1;
    ans[lvl[v]] |= val;
    for (auto to : g[v]) {
        if (u[to] || comp[to] != comp[v]) continue;
        int toval = Move(to - 1);
        dfs2(to, toval);
        val = Move(v - 1);
    }
}

ll Ioi(int _n, int _m, int A[], int B[], int _p, int _v, int _t) {
    n = _n, m = _m;
    int st = _p + 1, stval = _v;
    forn(i, 0, m - 1) {
        A[i]++, B[i]++;
        g[A[i]].eb(B[i]);
        g[B[i]].eb(A[i]);
    }

    cnt = 1;
    comp[1] = 1;
    sz[comp[1]] = 1;
    dfs(1);

    assert(CUR == 1);
    while (sz[comp[st]] != 60) {
        st = par[st];
        stval = Move(st - 1);
    }
    forn(i, 1, n) u[i] = 0;
    dfs2(st, stval);

    ll res = 0;
    forn(i, 0, 60) {
        res |= (ans[i] << ll(i));
    }
    return res;
}


#ifdef krauch
int main() {
    return 0;
}
#endif
#include "Ioi.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define eb emplace_back
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)

static const int MAXN = 2e4 + 6;

static int n, m, comp[MAXN], cnt, par[MAXN], CUR;
static ll X, sz[MAXN], lvl[MAXN], ans[66];
static vector < int > g[MAXN];
static bool u[MAXN];

void dfs(int v) {
    CUR++;
    u[v] = 1;
    for (auto to : g[v]) {
        if (u[to]) continue;
        if (sz[comp[v]] == 60)
            comp[to] = ++cnt;
        else
            comp[to] = comp[v];
        lvl[to] = sz[comp[to]];
        sz[comp[to]]++;
        par[to] = v;
        dfs(to);
    }
}

void dfs2(int v, int val) {
    u[v] = 1;
    ans[lvl[v]] |= val;
    for (auto to : g[v]) {
        if (u[to] || comp[to] != comp[v]) continue;
        int toval = Move(to - 1);
        dfs2(to, toval);
        val = Move(v - 1);
    }
}

ll Ioi(int _n, int _m, int A[], int B[], int _p, int _v, int _t) {
    n = _n, m = _m;
    int st = _p + 1, stval = _v;
    forn(i, 0, m - 1) {
        A[i]++, B[i]++;
        g[A[i]].eb(B[i]);
        g[B[i]].eb(A[i]);
    }

    cnt = 1;
    comp[1] = 1;
    sz[comp[1]] = 1;
    dfs(1);

    assert(CUR == n);
    while (sz[comp[st]] != 60) {
        st = par[st];
        stval = Move(st - 1);
    }
    forn(i, 1, n) u[i] = 0;
    dfs2(st, stval);

    ll res = 0;
    forn(i, 0, 60) {
        res |= (ans[i] << ll(i));
    }
    return res;
}


#ifdef krauch
int main() {
    return 0;
}
#endif

Compilation message

Joi.cpp: In function 'void dfs2(int, int)':
Joi.cpp:40:32: error: 'Move' was not declared in this scope
         int toval = Move(to - 1);
                                ^
Joi.cpp: In function 'll Ioi(int, int, int*, int*, int, int, int)':
Joi.cpp:63:28: error: 'Move' was not declared in this scope
         stval = Move(st - 1);
                            ^
Joi.cpp: At global scope:
Joi.cpp:15:11: warning: 'X' defined but not used [-Wunused-variable]
 static ll X, sz[MAXN], lvl[MAXN], ans[66];
           ^

Ioi.cpp:15:11: warning: 'X' defined but not used [-Wunused-variable]
 static ll X, sz[MAXN], lvl[MAXN], ans[66];
           ^