結果

問題 No.232 めぐるはめぐる (2)
ユーザー yuruhiyayuruhiya
提出日時 2020-05-18 16:36:33
言語 Ruby
(3.3.0)
結果
AC  
実行時間 107 ms / 1,000 ms
コード長 426 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 11,564 KB
実行使用メモリ 16,944 KB
最終ジャッジ日時 2023-10-12 13:52:30
合計ジャッジ時間 4,526 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
16,724 KB
testcase_01 AC 106 ms
16,704 KB
testcase_02 AC 107 ms
16,844 KB
testcase_03 AC 106 ms
16,944 KB
testcase_04 AC 78 ms
15,172 KB
testcase_05 AC 78 ms
15,112 KB
testcase_06 AC 79 ms
15,228 KB
testcase_07 AC 79 ms
15,084 KB
testcase_08 AC 100 ms
16,452 KB
testcase_09 AC 79 ms
15,108 KB
testcase_10 AC 79 ms
15,124 KB
testcase_11 AC 79 ms
15,012 KB
testcase_12 AC 81 ms
15,040 KB
testcase_13 AC 79 ms
15,016 KB
testcase_14 AC 78 ms
15,100 KB
testcase_15 AC 79 ms
15,224 KB
testcase_16 AC 78 ms
15,020 KB
testcase_17 AC 79 ms
15,084 KB
testcase_18 AC 80 ms
15,212 KB
testcase_19 AC 80 ms
15,132 KB
testcase_20 AC 79 ms
15,104 KB
testcase_21 AC 80 ms
15,212 KB
testcase_22 AC 79 ms
15,020 KB
testcase_23 AC 78 ms
15,072 KB
testcase_24 AC 78 ms
15,212 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