結果

問題 No.232 めぐるはめぐる (2)
ユーザー MisterMister
提出日時 2020-08-02 14:57:20
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,020 bytes
コンパイル時間 898 ms
コンパイル使用メモリ 77,900 KB
実行使用メモリ 9,892 KB
最終ジャッジ日時 2023-09-25 17:41:34
合計ジャッジ時間 3,646 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
9,272 KB
testcase_01 AC 15 ms
9,248 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 5 ms
9,892 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 3 ms
5,348 KB
testcase_08 WA -
testcase_09 AC 4 ms
7,176 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 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> 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('<');
        }
        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('v');
        }
    }

    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