結果

問題 No.2247 01 ZigZag
ユーザー tnakao0123tnakao0123
提出日時 2023-05-18 13:59:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 881 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 52,328 KB
実行使用メモリ 813,932 KB
最終ジャッジ日時 2023-08-22 09:21:45
合計ジャッジ時間 3,795 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2247.cc:  No.2247 01 ZigZag - yukicoder
 */

#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

/* constant */

/* typedef */

typedef vector<int> vi;

/* global variables */

/* subroutines */

void putv(vi &vs) {
  for (int i = 0; i < vs.size(); i++) {
    int ch = '0' + (i & 1);
    for (int j = 0; j < vs[i]; j++) putchar(ch);
  }
}

/* main */

int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  if (k > min(max(n, m), min(n, m) + 1)) { puts("-1"); return 0; }

  vi vs({n, m});

  if (k == 0) {
    if (n > 0 && m > 0) { puts("-1"); return 0; }
    putv(vs);
    return 0;
  }

  while (k > 1) {
    int l = vs.size();
    if (! (l & 1)) {
      vs[0]--;
      vs.push_back(1);
    }
    else {
      int c1 = vs[n - 2];
      vs[n - 2] = 1;
      vs.push_back(c1 - 1);
    }
  }

  putv(vs);
  return 0;
}
0