結果

問題 No.232 めぐるはめぐる (2)
ユーザー omu
提出日時 2015-07-13 09:03:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,351 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 72,572 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 06:36:28
合計ジャッジ時間 2,463 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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

	bool fa = false;
	rep(i, a){
		ud.push_back('^');
	}
	int ta = t - a;
	if (ta % 2){
		fa = true;			
		ta--;
	}
	{
		rep(i, ta / 2){
			ud.push_back('^');
			ud.push_back('v');
		}
	}


	bool fb = false;
	rep(i, b){
		rl.push_back('>');
	}
	int tb = t - b;
	if (tb % 2){
		fb = true;
		tb--;
	}
	{
		rep(i, tb / 2){
			rl.push_back('>');
			rl.push_back('<');
		}
	}

	if ((fa && !tb) || (fb && !ta)){
		cout << "NO" << endl; return 0;
	}

	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