competitive-programming-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub kmyk/competitive-programming-library

:warning: utils/mex_calculator.hpp

Code

#pragma once
#include <cassert>

class mex_calculator {
    uint64_t used;
public:
    mex_calculator()
            : used(0) {
    }
    void put(int x) {
        assert (0 <= x and x < 64 - 1);
        used |= 1ull << x;
    }
    int get() const {
        return __builtin_ctzll(~ used);
    }
    void clear() {
        used = 0;
    }
};
#line 2 "utils/mex_calculator.hpp"
#include <cassert>

class mex_calculator {
    uint64_t used;
public:
    mex_calculator()
            : used(0) {
    }
    void put(int x) {
        assert (0 <= x and x < 64 - 1);
        used |= 1ull << x;
    }
    int get() const {
        return __builtin_ctzll(~ used);
    }
    void clear() {
        used = 0;
    }
};
Back to top page