結果

問題 No.2247 01 ZigZag
ユーザー kumakumakumakuma
提出日時 2023-03-13 04:13:16
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,664 bytes
コンパイル時間 1,746 ms
コンパイル使用メモリ 203,332 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-18 16:05:23
合計ジャッジ時間 2,946 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 49 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 2000000000000000000
#define ll long long
#define ull unsigned long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const double PI = 3.141592653589793;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M, K;
  cin >> N >> M >> K;
  if (N < M && K == N * 2) {
    string ans;
    for (ll i = 0; i < N; ++i) {
      ans += '1';
      ans += '0';
    }
    while (ans.size() != N + M) {
      ans += '1';
    }
    cout << ans << "\n";
    return 0;
  }
  if (K % 2 == 1) {
    //0000 010101 111
    ll num = (K + 1) / 2;
    if (N < num || M < num) {
      cout << -1 << "\n";
    }
    else {
      string ans;
      for (ll i = 0; i < N - (num); ++i) {
        ans += '0';
      }
      for (ll i = 0; i < num; ++i) {
        ans += '0';
        ans += '1';
      }
      for (ll i = 0; i < M - num; ++i) {
        ans += '1';
      }
      cout << ans << "\n";
    }
  }
  else {
    //0000 0101 11110
    ll num = K / 2;
    if (N < num + 1 || M < num) {
      cout << -1 << "\n";
    }
    else {
      string ans;
      for (ll i = 0; i < N - (num + 1); ++i) {
        ans += '0';
      }
      for (ll i = 0; i < num; ++i) {
        ans += '0';
        ans += '1';
      }
      for (ll i = 0; i < M - num; ++i) {
        ans += '1';
      }
      ans += '0';
      cout << ans << "\n";
    }
  }
}
0