結果
| 問題 |
No.2247 01 ZigZag
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-17 21:35:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 1,944 ms |
| コンパイル使用メモリ | 167,968 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-18 10:23:46 |
| 合計ジャッジ時間 | 3,251 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 WA * 23 |
ソースコード
#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 (n == 0) {
if (k == 0) {
cout << string(m, '1') << '\n';
} else {
cout << -1 << '\n';
}
return 0;
}
string ans = "0";
n--;
while (k--) {
if (ans.back() == '0') {
ans += '1';
m--;
if (m < 0) {
cout << -1 << '\n';
return 0;
}
} else {
ans += '0';
n--;
if (n < 0) {
cout << -1 << '\n';
return 0;
}
}
}
cout << string(n, '0') + ans + string(m, '1') << '\n';
}