結果
| 問題 | No.232 めぐるはめぐる (2) | 
| コンテスト | |
| ユーザー |  airis | 
| 提出日時 | 2015-06-27 13:00:08 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 133 ms / 1,000 ms | 
| コード長 | 1,831 bytes | 
| コンパイル時間 | 624 ms | 
| コンパイル使用メモリ | 82,492 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-14 12:33:57 | 
| 合計ジャッジ時間 | 2,399 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <numeric>
#include <bitset>
#include <complex>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)
#define EPS (1e-14)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;
int t, a, b;
int y, x; //現在地
int main() {
	cin >> t >> a >> b;
	if (a == 0 && b == 0 && t == 1) {
		cout << "NO" << endl;
		return 0;
	}
	if (max(a, b) > t) {
		cout << "NO" << endl;
		return 0;
	} 
	cout << "YES" << endl;
	int r = t - max(a, b);
	// 無駄な動きが1だけ必要なときは最小に無駄に動く
	if (r == 1) {
		if (min(a, b) > 0) {
			cout << "^" << endl;
			cout << ">" << endl;
			x++; y++;
		} else if (a == 0 && b > 0) {
			cout << "^>" << endl;
			cout << "v" << endl;
			x++;
		} else {
			//a > 0 && b == 0
			cout << "^>" << endl;
			cout << "<" << endl;
			y++;
		}
		t -= 2;
	}
	// ゴールまで行く
	while (a != y || b != x) {
		if (y < a && x < b) {
			cout << "^>" << endl;
			x++; y++;
		} else if (y < a) {
			cout << "^" << endl;
			y++;
		} else {
			// x < b;
			cout << ">" << endl;
			x++;
		}
		t--;
	}
	// 残り無駄な動きでゴール位置で帳尻あわせ
	// tは1以外の値になっている
	while (t > 0) {
		if (t % 2 == 1) {
			cout << ">" << endl;
			cout << "v" << endl;
			cout << "<^" << endl;
			t -= 3;
		} else {
			cout << ">" << endl;
			cout << "<" << endl;
			t -= 2;
		}
	}
	return 0;
}
            
            
            
        