結果

問題 No.232 めぐるはめぐる (2)
ユーザー MisterMister
提出日時 2020-08-02 14:53:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,031 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 78,496 KB
実行使用メモリ 6,436 KB
最終ジャッジ日時 2023-09-25 17:31:29
合計ジャッジ時間 3,869 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,140 KB
testcase_01 AC 9 ms
6,108 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
6,436 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,468 KB
testcase_08 WA -
testcase_09 AC 3 ms
5,224 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0