結果

問題 No.232 めぐるはめぐる (2)
コンテスト
ユーザー femto
提出日時 2015-12-20 23:55:23
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,101 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 520 ms
コンパイル使用メモリ 77,668 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-06 11:17:01
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int t, a, b;
	cin >> t >> a >> b;

	if(t < max(a, b) || a == 0 && b == 0 && t == 1) {
		cout << "NO" << endl;
		return 0;
	}

	cout << "YES" << endl;
	int x = 0, y = 0;
	while(max(a - x, b - y) > 1) {
		if(a - x != 0) {
			x++;
			cout << ">";
		}
		if(b - y != 0) {
			y++;
			cout << "^";
		}
		t--;
		cout << endl;
	}

	if(a == x && b == y) {
		if(t % 2 == 1) {
			cout << "^" << endl;
			cout << ">" << endl;
			cout << "<v" << endl;
			t -= 3;
		}
	}
	else if(a - x + b - y == 2) {
		if(t % 2 == 0) {
			cout << "^" << endl;
			cout << ">" << endl;
			t -= 2;
		}
		else {
			cout << "^>" << endl;
			t--;
		}
	}
	else if(a - x == 0) {
		if(t % 2 == 0) {
			cout << "^" << endl;
			cout << ">v" << endl;
			t -= 2;
		}
		else {
			cout << ">" << endl;
			t--;
		}
	}
	else {
		if(t % 2 == 0) {
			cout << ">" << endl;
			cout << "^<" << endl;
			t -= 2;
		}
		else {
			cout << "^" << endl;
			t--;
		}
	}
	while(t > 0) {
		cout << ">" << endl;
		cout << "<" << endl;
		t -= 2;
	}
}
0