結果
| 問題 |
No.2247 01 ZigZag
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-17 21:52:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,132 bytes |
| コンパイル時間 | 1,749 ms |
| コンパイル使用メモリ | 172,240 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-18 10:43:46 |
| 合計ジャッジ時間 | 3,598 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 40 WA * 7 RE * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, k;
cin >> n >> m >> k;
if (m == n + 1 && k == n + m - 1) {
for (int i = 0; i < n + m; i++) {
if (i & 1) {
cout << '0';
} else {
cout << '1';
}
}
cout << '\n';
return 0;
}
vector<string> can;
string x = "0";
bool ok1 = true;
int kk = k, nn = n, mm = m;
nn--;
while (kk--) {
if (x.back() == '0') {
x += '1';
mm--;
if (mm < 0) {
ok1 = false;
break;
}
} else {
x += '0';
nn--;
if (nn < 0) {
ok1 = false;
break;
}
}
}
if (ok1 && x.back() == '1') {
can.push_back(string(nn, '0') + x + string(mm, '1'));
} else if (ok1) {
x.pop_back();
can.push_back(string(nn, '0') + x + string(mm, '1') + '0');
}
cout << (can.size() ? can[0] : "-1") << '\n';
}