結果

問題 No.232 めぐるはめぐる (2)
ユーザー yuruhiyayuruhiya
提出日時 2020-05-18 16:34:45
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 426 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 13,952 KB
最終ジャッジ日時 2024-04-09 21:30:00
合計ジャッジ時間 3,481 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
13,824 KB
testcase_01 AC 102 ms
13,952 KB
testcase_02 AC 100 ms
13,824 KB
testcase_03 AC 108 ms
13,952 KB
testcase_04 AC 72 ms
12,160 KB
testcase_05 AC 71 ms
12,416 KB
testcase_06 AC 71 ms
12,288 KB
testcase_07 AC 73 ms
12,288 KB
testcase_08 AC 92 ms
13,696 KB
testcase_09 AC 75 ms
12,160 KB
testcase_10 AC 74 ms
12,160 KB
testcase_11 AC 74 ms
12,416 KB
testcase_12 AC 73 ms
12,288 KB
testcase_13 WA -
testcase_14 AC 73 ms
12,160 KB
testcase_15 AC 72 ms
12,416 KB
testcase_16 AC 72 ms
12,160 KB
testcase_17 AC 72 ms
12,288 KB
testcase_18 AC 72 ms
12,416 KB
testcase_19 AC 75 ms
12,288 KB
testcase_20 AC 73 ms
12,160 KB
testcase_21 AC 72 ms
12,160 KB
testcase_22 AC 72 ms
12,288 KB
testcase_23 AC 72 ms
12,160 KB
testcase_24 AC 71 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

t, a, b = gets.split.map &:to_i
if [a, b].max > t || [t, a, b] == [1, 0, 0]
	puts 'NO'
	exit
end

ans = []
ans.concat %w[^>] * [a, b].min
ans.concat a < b ? %w[>] * (b - a) : %w[^] * (a - b)
ans.concat %w[> <] if ans.empty?
if ans.size % 2 != t % 2
	case ans.pop
	when '^>'
		ans.concat %w[^ >]
	when '>'
		ans.concat %w[^> v]
	when '^'
		ans.concat %w[^> <]
	end
end
ans.concat %w[> <] * ((t - ans.size) / 2)
puts 'YES', ans
0