結果

問題 No.232 めぐるはめぐる (2)
ユーザー maine_honzukimaine_honzuki
提出日時 2021-04-26 17:53:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,176 bytes
コンパイル時間 2,168 ms
コンパイル使用メモリ 204,924 KB
実行使用メモリ 14,308 KB
最終ジャッジ日時 2023-09-18 12:34:08
合計ジャッジ時間 4,485 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
13,336 KB
testcase_01 AC 146 ms
13,848 KB
testcase_02 AC 147 ms
14,308 KB
testcase_03 AC 147 ms
12,740 KB
testcase_04 AC 18 ms
13,324 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 9 ms
7,504 KB
testcase_08 AC 105 ms
12,880 KB
testcase_09 AC 13 ms
11,828 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int T, A, B;
    cin >> T >> A >> B;
    vector<string> updown, leftright;
    for (int i = 0; i < A + (T - A) / 2; i++) {
        updown.emplace_back("^");
    }
    for (int i = 0; i < (T - A) / 2; i++) {
        updown.emplace_back("v");
    }
    for (int i = 0; i < B + (T - B) / 2; i++) {
        leftright.emplace_back(">");
    }
    for (int i = 0; i < (T - B) / 2; i++) {
        leftright.emplace_back("<");
    }
    if (updown.size() != T)
        updown.emplace_back("");
    if (leftright.size() != T)
        leftright.emplace_back("");
    reverse(leftright.begin(), leftright.end());
    vector<string> ans(T);
    int x = 0, y = 0;
    for (int i = 0; i < T; i++) {
        ans[i] = updown[i] + leftright[i];
        if (updown[i] == "^")
            y++;
        else if (updown[i] == "v")
            y--;
        if (leftright[i] == ">")
            x++;
        else if (leftright[i] == "<")
            x--;
    }
    if (x == B && y == A) {
        cout << "YES" << endl;
        for (auto&& s : ans) {
            cout << s << endl;
        }
    } else
        cout << "NO" << endl;
}
0