結果
| 問題 | 
                            No.232 めぐるはめぐる (2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             omu
                         | 
                    
| 提出日時 | 2015-07-01 03:55:10 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,611 bytes | 
| コンパイル時間 | 725 ms | 
| コンパイル使用メモリ | 70,784 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-07 21:36:50 | 
| 合計ジャッジ時間 | 2,422 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 18 WA * 4 | 
ソースコード
#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;
	if (a == 0 && b == 0){
		if (t > 1){
			cout << "YES" << endl;
			if (t % 2){
				cout << "<v" << endl;
				cout << ">" << endl;
				cout << "^" << endl; t -= 3;
			}
			rep(i, t/2){
				cout << "v" << endl;
				cout << "^" << endl;
			}
			return 0;
		}
	}
	//取りあえず最短時間を出す
	int m = max(a, b);
	//最短時間が制限時間より長い場合は無理
	if (t < m){
		cout << "NO" << endl;
	}
	else{
		rep(k, 3){
			if (k == 1){
				a++; t--; m = max(a, b);
			}
			if (k == 2){
				a--; b++; m = max(a, b);
			}
			if (t <= 2 && (t - m) % 2){
				continue;
			}
			cout << "YES" << endl;
			if (k == 1){
				cout << "v" << endl;
			}
			if (k == 2){
				cout << "<" << endl;
			}
			if (t > 2 && (t - m) % 2){
				cout << ">" << endl;
				cout << "^" << endl;
				t -= 2; a--; b--; m--;
			}
			rep(i, min(a, b)){
				cout << "^>" << endl;
			}
			rep(i, m - min(a, b)){
				if (a > b)cout << "^" << endl;
				else      cout << ">" << endl;
			}
			if (t - m){
				rep(i, (t - m) / 2){
					cout << ">" << endl;
					cout << "<" << endl;
				}
			}
			return 0;
		}
		cout << "NO" << endl; return 0;
	}
	return 0;
}
            
            
            
        
            
omu