結果

問題 No.232 めぐるはめぐる (2)
ユーザー kagasankagasan
提出日時 2019-08-24 20:44:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 133 ms / 1,000 ms
コード長 1,520 bytes
コンパイル時間 1,554 ms
コンパイル使用メモリ 165,160 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 13:50:53
合計ジャッジ時間 3,478 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
4,348 KB
testcase_01 AC 133 ms
4,352 KB
testcase_02 AC 128 ms
4,352 KB
testcase_03 AC 128 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 91 ms
4,352 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 2 ms
4,356 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 3 ms
4,348 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 1 ms
4,352 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;};


int main(){

    ll T, A, B;
    cin >> T >> A >> B;
    if(T < A || T < B){
        cout << "NO" << endl;
        return 0;
    }
    if(T == 1 && A == 0 && B == 0){
        cout << "NO" << endl;
        return 0;
    } 
    cout << "YES" << endl;
    ll y = 0, x = 0;
    for(ll i = 0; i < T; i++){
        ll t = T - i;
        if(y == A && x == B){
            cout << "<"<<endl;
            x--;
            continue;
        }
        if(t != 2){
            if(y < A){
                cout << "^";
                y++;
            }
            if(x < B){
                cout << ">";
                x++;
            }
            cout << endl;
            continue;
        }
        if(y == A && x + 1 == B){
            cout << "^" << endl;
            cout << "v>" << endl;
            x++;
            i++;
        }
        else if(x == B && y + 1 == A){
            cout << ">" << endl;
            cout << "<^" << endl;
            y++;
            i++;
        }
        else if(y + 1 == A && x + 1 == B){
            cout << "^" << endl;
            cout << ">" << endl;
            i++;
        }
        else{
            if(y < A){
                cout << "^";
                y++;
            }
            if(x < B){
                cout << ">";
                x++;
            }
            cout << endl;
        }
    }


    return 0;
}
0