Submission #442668

# Submission time Handle Problem Language Result Execution time Memory
442668 2021-07-08T14:27:47 Z Lam_lai_cuoc_doi ICC (CEOI16_icc) C++17
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

constexpr bool typetest = 1;
constexpr int N = 1e2 + 5;
struct dsu
{
    int n;
    int par[N];
    dsu()
    {
        memset(par, -1, sizeof par);
    }
    int findpar(int v)
    {
        return par[v] < 0 ? v : par[v] = findpar(par[v]);
    }
    void Merge(int u, int v)
    {
        u = findpar(u);
        v = findpar(v);
        if (u == v)
            return;
        if (par[u] < par[v])
            swap(u, v);
        par[v] += par[u];
        par[u] = v;
    }
} f;
int a[N], b[N], x, y, c[N];

#include "icc.h"

#define bit(i, x) (((x) >> (i)) & 1)

int Cal(int m, int a[N], int n, int b[N])
{
    int l = 1, r = m;
    while (l <= r)
    {
        int mid = (l + r) / 2;
        for (int i = l; i <= mid; ++i)
            c[i - l + 1] = a[l];

        if (query(mid - l + 1, n, c, b))
            r = mid - 1;
        else
            l = mid + 1;
    }

    return l;
}

void run(int n)
{
    f.n = n;
    for (int i = 1; i < n; ++i)
    {
        for (int j = 6; ~j; --j)
        {
            x = 0;
            y = 0;
            for (int t = 1; t <= n; ++t)
                if (bit(j, f.findpar(t)))
                    a[++x] = t;
                else
                    b[++y] = t;
            if (x != 0 && y != 0 && query(x, y, a, b))
                break;
        }
        if (x != 1)
        {
            a[1] = Cal(x, a, y, b);
            x = 1;
        }
        if (y != 1)
        {
            b[1] = Cal(y, b, x, a);
            y = 1;
        }
        f.Merge(a[1], b[1]);
        setRoad(a[1], b[1]);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -