結果

問題 No.232 めぐるはめぐる (2)
ユーザー MisterMister
提出日時 2020-08-02 15:12:53
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 14 ms / 1,000 ms
コード長 1,028 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 79,320 KB
実行使用メモリ 9,616 KB
最終ジャッジ日時 2023-10-12 13:52:38
合計ジャッジ時間 2,174 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
9,316 KB
testcase_01 AC 14 ms
9,324 KB
testcase_02 AC 14 ms
9,248 KB
testcase_03 AC 14 ms
9,256 KB
testcase_04 AC 5 ms
9,616 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 3 ms
5,284 KB
testcase_08 AC 11 ms
7,544 KB
testcase_09 AC 4 ms
7,068 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,356 KB
権限があれば一括ダウンロードができます

ソースコード

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