結果
問題 |
No.232 めぐるはめぐる (2)
|
ユーザー |
|
提出日時 | 2020-08-02 14:53:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,031 bytes |
コンパイル時間 | 1,019 ms |
コンパイル使用メモリ | 77,424 KB |
最終ジャッジ日時 | 2025-01-12 13:18:59 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 12 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> void fail() { std::cout << "NO\n"; std::exit(0); } void solve() { int t, a, b; std::cin >> t >> a >> b; std::vector<std::string> ans(t); { if (a > t) fail(); for (int i = 0; i < a; ++i) ans[i].push_back('>'); for (int i = a; i + 1 < t; i += 2) { ans[i].push_back('>'); ans[i + 1].push_back('<'); } } { if (b > t) fail(); for (int i = 0; i < b; ++i) ans[i].push_back('^'); if ((t - b) % 2 != 0) ++b; for (int i = b; i + 1 < t; i += 2) { ans[i].push_back('^'); ans[i + 1].push_back('v'); } } if (std::any_of(ans.begin(), ans.end(), [](const auto& s) { return s.empty(); })) fail(); std::cout << "YES\n"; for (auto& s : ans) std::cout << s << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }