結果

問題 No.232 めぐるはめぐる (2)
ユーザー omuomu
提出日時 2015-07-13 08:56:09
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,348 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 73,700 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 14:57:41
合計ジャッジ時間 3,930 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 134 ms
4,380 KB
testcase_02 AC 138 ms
4,376 KB
testcase_03 AC 134 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 RE -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 97 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 RE -
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
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 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <set>

using namespace std;

#define For(i,a,b) for(int i = (a);i < (b);i++)
#define rep(i,n) For(i,0,n)

const int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 };
string dc[8] = { ">", "v", "<", "^", ">^", ">v", "<^", "<v" };

typedef pair<int, int> P;

int main(){

	int t, a, b;
	cin >> t >> a >> b;

	vector<char> ud, rl;

	if (a > t || b > t){
		cout << "NO" << endl; return 0;
	}

	rep(i, a){
		ud.push_back('^');
	}
	int ta = t - a;
	if (ta % 2 == 0){
		if (!b){
			cout << "NO" << endl; return 0;
		}
		else{
			ta--;
		}
	}
	{
		rep(i, ta / 2){
			ud.push_back('^');
			ud.push_back('v');
		}
	}
	rep(i, b){
		rl.push_back('>');
	}
	int tb = t - b;
	if (tb % 2 == 0){
		if (!a){
			cout << "NO" << endl; return 0;
		}
		else{
			tb--;
		}
	}
	{
		rep(i, tb / 2){
			rl.push_back('>');
			rl.push_back('<');
		}
	}

	cout << "YES" << endl;


	while (t != max(rl.size(), ud.size())){
		if (rl.size() < ud.size()){
			cout << rl[rl.size() - 1] << endl;
			rl.pop_back();
		}
		else{
			cout << ud[ud.size() - 1] << endl;
			ud.pop_back();
		}
		t--;
	}
	
	rep(i, t){
		if (i < rl.size()){
			cout << rl[i];
		}
		if (i < ud.size()){
			cout << ud[i];
		}
		cout << endl;
	}

	return 0;
}
0