結果
問題 |
No.2247 01 ZigZag
|
ユーザー |
|
提出日時 | 2023-03-21 23:49:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 607 bytes |
コンパイル時間 | 1,712 ms |
コンパイル使用メモリ | 191,592 KB |
最終ジャッジ日時 | 2025-02-11 15:57:51 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 WA * 22 |
ソースコード
#include <bits/stdc++.h> using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int N, M, K; std::cin >> N >> M >> K; if ((N && M && K < 1) || K > std::min({2 * N, 2 * M, N + M - 1})) { std::cout << -1 << "\n"; return 0; } int t = N > M ? 0 : 1; int cnt[2] = {N, M}; for (int i = 0; i < N + M; i++) { if ((K == 1 && !cnt[t]) || (i > 0 && K > 1)) { t ^= 1; K -= 1; } std::cout << t; cnt[t] -= 1; } std::cout << "\n"; return 0; }