結果
| 問題 | No.2247 01 ZigZag |
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-04-09 12:24:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,375 bytes |
| 記録 | |
| コンパイル時間 | 2,219 ms |
| コンパイル使用メモリ | 196,224 KB |
| 最終ジャッジ日時 | 2025-02-20 23:19:26 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 49 RE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
fast_io();
int n, m, k;
cin >> n >> m >> k;
if (k % 2 == 1) {
if (n < (k + 1) / 2 || m < (k + 1) / 2) {
cout << "-1\n";
return 0;
}
vector<int> cnt(k + 1, 1);
cnt[0] += n - (k + 1) / 2;
cnt.back() += m - (k + 1) / 2;
for (int i = 0; i <= k; i++) {
for (int j = 0; j < cnt[i]; j++) {
cout << i % 2;
}
}
cout << endl;
return 0;
}
if (n < (k + 1) / 2 || m < (k + 1) / 2) {
cout << "-1\n";
return 0;
}
if (n < (k + 2) / 2) {
if (m < (k + 2) / 2) {
cout << "-1\n";
return 0;
}
vector<int> cnt(k + 1, 1);
cnt[1] += n - (k + 1) / 2;
cnt.back() += m - (k + 2) / 2;
for (int i = 0; i <= k; i++) {
for (int j = 0; j < cnt[i]; j++) {
cout << (i + 1) % 2;
}
}
cout << endl;
return 0;
}
vector<int> cnt(k + 1, 1);
cnt[0] += n - (k + 2) / 2;
cnt[k - 1] += m - (k + 1) / 2;
for (int i = 0; i <= k; i++) {
for (int j = 0; j < cnt[i]; j++) {
cout << i % 2;
}
}
cout << endl;
}
eve__fuyuki