結果

問題 No.2247 01 ZigZag
ユーザー penguin8331penguin8331
提出日時 2023-03-17 21:56:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,591 bytes
コンパイル時間 2,494 ms
コンパイル使用メモリ 167,880 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-18 14:33:23
合計ジャッジ時間 3,236 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#line 2 "/home/penguin8331/vscode/library/template/template.hpp"
#include <bits/stdc++.h>
#line 3 "/home/penguin8331/vscode/library/template/macro.hpp"

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define elif else if
#define updiv(N, X) (((N) + (X) - (1)) / (X))
#define sigma(a, b) ((a + b) * (b - a + 1) / 2)
#line 3 "/home/penguin8331/vscode/library/template/alias.hpp"

using ll = long long;
using ld = long double;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
constexpr int inf = 1 << 30;
constexpr ll INF = 1LL << 60;
constexpr int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int mod = 998244353;
constexpr int MOD = 1e9 + 7;
#line 3 "/home/penguin8331/vscode/library/template/func.hpp"

template <typename T>
inline bool chmax(T& a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template <typename T>
inline bool chmin(T& a, T b) { return ((a > b) ? (a = b, true) : (false)); }
#line 3 "/home/penguin8331/vscode/library/template/util.hpp"

struct IOSetup {
    IOSetup() {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
        std::cout.tie(0);
        std::cout << std::fixed << std::setprecision(12);
        std::cerr << std::fixed << std::setprecision(12);
    }
} IOSetup;
#line 1 "/home/penguin8331/vscode/library/template/debug.hpp"
#ifdef LOCAL
#include <algo/debug.hpp>
#else
#define debug(...)
#endif
#line 8 "/home/penguin8331/vscode/library/template/template.hpp"
using namespace std;
#line 2 "A.cpp"

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    // 00000 0 1 0 1 0 1 0 1 111111
    if (min(min(N, M) * 2, N + M - 1) < K) {
        cout << -1 << endl;
        return 0;
    }
    if ((N == 0 || M == 0) && K > 0) {
        cout << -1 << endl;
        return 0;
    }
    int fzero = 0, lone = 0;
    while (true) {
        if (min(min(N - 1, M) * 2, N + M - 2) < K) {
            break;
        }
        N--;
        fzero++;
    }
    while (true) {
        if (min(min(N, M - 1) * 2, N + M - 2) < K) {
            break;
        }
        M--;
        lone++;
    }
    debug(fzero, lone, N, M);
    for (int i = 0; i < fzero; i++) {
        debug(i);
        cout << 0;
    }
    if (N != M) {
        if (N > M) {
            cout << 0;
            N--;
        } else {
            cout << 1;
            M--;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << "01";
    }
    for (int i = 0; i < lone; i++) {
        cout << 1;
    }
    cout << endl;
}
0