結果
| 問題 |
No.2247 01 ZigZag
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-17 21:49:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,100 bytes |
| コンパイル時間 | 1,548 ms |
| コンパイル使用メモリ | 172,064 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-18 10:40:02 |
| 合計ジャッジ時間 | 4,651 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 RE * 1 |
| other | AC * 2 WA * 36 RE * 12 |
ソースコード
#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;
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[0] << '\n';
}