結果

問題 No.2247 01 ZigZag
ユーザー packer_jppacker_jp
提出日時 2023-03-17 22:06:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 11,713 bytes
コンパイル時間 2,124 ms
コンパイル使用メモリ 205,884 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 16:09:37
合計ジャッジ時間 3,252 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 6 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 AC 7 ms
5,376 KB
testcase_17 AC 5 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 6 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 6 ms
5,376 KB
testcase_26 AC 5 ms
5,376 KB
testcase_27 AC 6 ms
5,376 KB
testcase_28 AC 5 ms
5,376 KB
testcase_29 AC 4 ms
5,376 KB
testcase_30 AC 7 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 6 ms
5,376 KB
testcase_33 AC 4 ms
5,376 KB
testcase_34 AC 4 ms
5,376 KB
testcase_35 AC 4 ms
5,376 KB
testcase_36 AC 4 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 1 ms
5,376 KB
testcase_41 AC 7 ms
5,376 KB
testcase_42 AC 6 ms
5,376 KB
testcase_43 AC 1 ms
5,376 KB
testcase_44 AC 1 ms
5,376 KB
testcase_45 AC 8 ms
5,376 KB
testcase_46 AC 8 ms
5,376 KB
testcase_47 AC 1 ms
5,376 KB
testcase_48 AC 2 ms
5,376 KB
testcase_49 AC 1 ms
5,376 KB
testcase_50 AC 2 ms
5,376 KB
testcase_51 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
#define uniq(a) (a).erase(unique(all(a)), (a).end())
#define t0 first
#define t1 second
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
using vll = vector<ll>;
constexpr double pi = 3.14159265358979323846;
constexpr ll dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr ll dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
constexpr ll sign(ll a) { return (a > 0) - (a < 0); }
constexpr ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); }
constexpr ll cdiv(ll a, ll b) { return -fdiv(-a, b); }
constexpr ll pw(ll n) { return 1ll << n; }
constexpr ll flg(ll n) { return 63 - __builtin_clzll(n); }
constexpr ll clg(ll n) { return flg(n - 1) + 1; }
constexpr ll safemod(ll x, ll mod) { return (x % mod + mod) % mod; }
template <typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
template <typename T> constexpr T sq(const T &a) { return a * a; }
template <typename T, typename U> constexpr bool chmax(T &a, const U &b) { return a < b ? a = b, true : false; }
template <typename T, typename U> constexpr bool chmin(T &a, const U &b) { return a > b ? a = b, true : false; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &a) {
    os << "(" << a.first << ", " << a.second << ")";
    return os;
}
template <typename T, typename U, typename V> ostream &operator<<(ostream &os, const tuple<T, U, V> &a) {
    os << "(" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &a) {
    os << "(";
    for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
    os << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &a) {
    os << "{";
    for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &a) {
    os << "{";
    for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
    os << "}";
    return os;
}
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &a) {
    os << "{";
    for (auto itr = a.begin(); itr != a.end(); ++itr) os << *itr << (next(itr) != a.end() ? ", " : "");
    os << "}";
    return os;
}
#ifdef ONLINE_JUDGE
#define dump(...) (void(0))
#else
void debug() { cerr << endl; }
template <typename Head, typename... Tail> void debug(Head &&head, Tail &&...tail) {
    cerr << head;
    if (sizeof...(Tail)) cerr << ", ";
    debug(tail...);
}
#define dump(...) cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ", debug(__VA_ARGS__)
#endif
struct rep {
    struct itr {
        ll v;
        itr(ll v) : v(v) {}
        void operator++() { ++v; }
        ll operator*() const { return v; }
        bool operator!=(itr i) const { return v < *i; }
    };
    ll l, r;
    rep(ll l, ll r) : l(l), r(r) {}
    rep(ll r) : rep(0, r) {}
    itr begin() const { return l; };
    itr end() const { return r; };
};
struct per {
    struct itr {
        ll v;
        itr(ll v) : v(v) {}
        void operator++() { --v; }
        ll operator*() const { return v; }
        bool operator!=(itr i) const { return v > *i; }
    };
    ll l, r;
    per(ll l, ll r) : l(l), r(r) {}
    per(ll r) : per(0, r) {}
    itr begin() const { return r - 1; };
    itr end() const { return l - 1; };
};
struct io_setup {
    static constexpr int PREC = 20;
    io_setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} iOS;

template <typename M> struct modint {
    ll val;
    modint(ll val = 0) : val(val >= 0 ? val % M::mod : (M::mod - (-val) % M::mod) % M::mod) {}
    static ll mod() { return M::mod; }
    modint inv() const {
        ll a = val, b = M::mod, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return u;
    }
    modint pow(ll k) const {
        modint ret = 1, mul = val;
        while (k) {
            if (k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }
    modint &operator+=(const modint &a) {
        if ((val += a.val) >= M::mod) val -= M::mod;
        return *this;
    }
    modint &operator-=(const modint &a) {
        if ((val += M::mod - a.val) >= M::mod) val -= M::mod;
        return *this;
    }
    modint &operator*=(const modint &a) {
        (val *= a.val) %= M::mod;
        return *this;
    }
    modint &operator/=(const modint &a) { return *this *= a.inv(); }
    modint operator+() const { return *this; }
    modint operator-() const { return modint(-val); }
    friend bool operator==(const modint &a, const modint &b) { return a.val == b.val; }
    friend bool operator!=(const modint &a, const modint &b) { return rel_ops::operator!=(a, b); }
    friend modint operator+(const modint &a, const modint &b) { return modint(a) += b; }
    friend modint operator-(const modint &a, const modint &b) { return modint(a) -= b; }
    friend modint operator*(const modint &a, const modint &b) { return modint(a) *= b; }
    friend modint operator/(const modint &a, const modint &b) { return modint(a) /= b; }
    friend istream &operator>>(istream &is, modint &a) {
        ll val;
        is >> val;
        a = modint(val);
        return is;
    }
    friend ostream &operator<<(ostream &os, const modint &a) { return os << a.val; }
};

struct _998244353 {
    constexpr static ll mod = 998244353;
};
struct _1000000007 {
    constexpr static ll mod = 1000000007;
};
using modint998244353 = modint<_998244353>;
using modint1000000007 = modint<_1000000007>;

struct arbitrary {
    static ll mod;
};
ll arbitrary::mod;

template <typename V> struct fenwick_tree {
    vector<V> data;
    fenwick_tree(ll n) : data(n + 1, V()) {}
    void add(ll i, const V &x) {
        for (++i; i < (ll)data.size(); i += i & -i) data[i] += x;
    }
    V sum(ll i) const {
        V ret = V();
        for (; i > 0; i -= i & -i) ret += data[i];
        return ret;
    }
    V sum(ll l, ll r) const { return sum(r) - sum(l); }
};
template <typename F> ll bisect(ll ok, ll ng, F f) {
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        (f(mid) ? ok : ng) = mid;
    }
    return ok;
}
template <typename P> struct unionfind {
    using V = typename P::V;
    ll n;
    vector<ll> ps;
    vector<V> val;
    unionfind(const vector<V> &val) : n(val.size()), ps(n, -1), val(val) {}
    unionfind(ll n, const V &a = {}) : unionfind(vector<V>(n, a)) {}
    ll find(ll i) {
        if (ps[i] < 0) return i;
        return ps[i] = find(ps[i]);
    }
    ll size(ll i) { return -ps[find(i)]; }
    void unite(ll i, ll j) {
        if ((i = find(i)) == (j = find(j))) return;
        if (-ps[i] < -ps[j]) swap(i, j);
        ps[i] += ps[j];
        P::merge(val[i], val[j]);
        ps[j] = i;
    }
    bool same(ll i, ll j) { return find(i) == find(j); }
    V &operator[](ll i) { return val[find(i)]; }
    vector<vector<ll>> groups() {
        vector<vector<ll>> ret(n);
        for (ll i : rep(n)) ret[find(i)].push_back(i);
        ret.erase(remove_if(all(ret), [](const vector<ll> &v) { return v.empty(); }), ret.end());
        return ret;
    }
};
struct normal_uf {
    using V = struct {};
    static void merge(V &a, const V &b) {}
};
template <typename P> struct segtree {
    using V = typename P::V;
    ll n, size;
    vector<V> val;
    segtree(ll n) : segtree(vector(n, P::e())) {}
    segtree(const vector<V> &src) : n(src.size()) {
        size = pw(clg(n));
        val.resize(size << 1);
        copy(all(src), val.begin() + size);
        for (ll i : per(1, size)) val[i] = P::op(val[i << 1 | 0], val[i << 1 | 1]);
    }
    void set(ll i, const V &a) {
        val[i += size] = a;
        while (i >>= 1) val[i] = P::op(val[i << 1 | 0], val[i << 1 | 1]);
    }
    V get(ll i) const { return val[i + size]; }
    V prod(ll l, ll r) const {
        V a = P::e(), b = P::e();
        for (l += size, r += size; l < r; l >>= 1, r >>= 1) {
            if (l & 1) a = P::op(a, val[l++]);
            if (r & 1) b = P::op(val[--r], b);
        }
        return P::op(a, b);
    }
    template <typename F> ll max_right(ll l, F f) const {
        if (l == n) return n;
        V a = P::e();
        l += size;
        do {
            while (~l & 1) l >>= 1;
            if (!f(P::op(a, val[l]))) {
                while (l < size) {
                    l = l << 1;
                    if (f(P::op(a, val[l]))) a = P::op(a, val[l++]);
                }
                return l - size;
            }
            a = P::op(a, val[l++]);
        } while ((l & -l) != l);
        return n;
    }
    template <typename F> ll min_left(ll r, F f) const {
        if (r == 0) return 0;
        V a = P::e();
        r += size;
        do {
            r--;
            while (r > 1 && r & 1) r >>= 1;
            if (!f(P::op(val[r], a))) {
                while (r < size) {
                    r = r << 1 | 1;
                    if (f(P::op(val[r], a))) a = P::op(val[r--], a);
                }
                return r + 1 - size;
            }
            a = P::op(val[r], a);
        } while ((r & -r) != r);
        return 0;
    }
};

using mint = modint998244353;
struct int_div {
    using V = pair<mint, ll>;
    static V op(V a, V b) { return {a.first * mint(10).pow(b.second) + b.first, a.second + b.second}; }
    static V e() { return {0, 0}; }
};

template <typename mint> struct combination {
    vector<mint> fact, finv, inv;
    combination(ll n) : fact(n + 1), finv(n + 1), inv(n + 1) {
        fact[0] = fact[1] = finv[0] = finv[1] = inv[1] = 1;
        for (ll i : rep(2, n + 1)) {
            fact[i] = fact[i - 1] * i;
            inv[i] = -inv[mint::mod() % i] * (mint::mod() / i);
            finv[i] = finv[i - 1] * inv[i];
        }
    }
    mint P(ll n, ll r) { return r < 0 || n < r ? 0 : (fact[n] * finv[n - r]); }
    mint C(ll n, ll r) { return P(n, r) * finv[r]; }
    mint H(ll n, ll r) { return C(n + r - 1, r); }
    mint catalan(ll n) { return C(2 * n, n) / (n + 1); }
};
ll mex(const vll &v) {
    ll n = v.size();
    vll cnt(n);
    for (ll vi : v) {
        if (vi < n) ++cnt[vi];
    }
    for (ll i : rep(n)) {
        if (cnt[i] == 0) return i;
    }
    return n;
}
int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    if (k == 0) {
        if (n == 0) {
            for (ll i : rep(m)) cout << 1;
            cout << endl;
        } else if (m == 0) {
            for (ll i : rep(n)) cout << 0;
            cout << endl;
        } else {
            cout << -1 << endl;
        }
    } else if (k % 2 == 0) {
        k /= 2;
        if (n - k - 1 >= 0 && m - k >= 0) {
            for (ll i : rep(n - k - 1)) cout << 0;
            for (ll i : rep(k)) cout << "01";
            for (ll i : rep(m - k)) cout << 1;
            cout << 0;
            cout << endl;
        } else if (n == k && m - k - 1 >= 0) {
            for (ll i : rep(k)) cout << "10";
            for (ll i : rep(m - k)) cout << 1;
            cout << endl;
        } else {
            cout << -1 << endl;
        }
    } else {
        k = cdiv(k, 2);
        if (n - k >= 0 && m - k >= 0) {
            for (ll i : rep(n - k)) cout << 0;
            for (ll i : rep(k)) cout << "01";
            for (ll i : rep(m - k)) cout << 1;
            cout << endl;
        } else {
            cout << -1 << endl;
        }
    }
}
0