結果
問題 |
No.232 めぐるはめぐる (2)
|
ユーザー |
|
提出日時 | 2020-08-02 15:12:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 1,000 ms |
コード長 | 1,028 bytes |
コンパイル時間 | 1,153 ms |
コンパイル使用メモリ | 78,472 KB |
最終ジャッジ日時 | 2025-01-12 13:19:34 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#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> xs(t, ""), ys(t, ""); { if (a > t) fail(); for (int i = 0; i < a; ++i) xs[i].push_back('^'); for (int i = a; i + 1 < t; i += 2) { xs[i].push_back('^'); xs[i + 1].push_back('v'); } std::reverse(xs.begin(), xs.end()); } { if (b > t) fail(); for (int i = 0; i < b; ++i) ys[i].push_back('>'); for (int i = b; i + 1 < t; i += 2) { ys[i].push_back('>'); ys[i + 1].push_back('<'); } } if (xs.front().empty() && ys.front().empty()) fail(); std::cout << "YES\n"; for (int i = 0; i < t; ++i) { std::cout << xs[i] << ys[i] << "\n"; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }