結果

問題 No.3024 等式
ユーザー cielciel
提出日時 2017-04-22 23:21:21
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 414 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 11,496 KB
実行使用メモリ 19,636 KB
最終ジャッジ日時 2023-09-28 21:43:59
合計ジャッジ時間 12,484 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
15,316 KB
testcase_01 AC 92 ms
15,256 KB
testcase_02 AC 89 ms
15,040 KB
testcase_03 AC 88 ms
15,256 KB
testcase_04 AC 87 ms
15,196 KB
testcase_05 AC 87 ms
15,328 KB
testcase_06 AC 117 ms
15,392 KB
testcase_07 AC 117 ms
15,292 KB
testcase_08 AC 121 ms
15,340 KB
testcase_09 AC 88 ms
15,036 KB
testcase_10 AC 88 ms
15,148 KB
testcase_11 AC 94 ms
15,220 KB
testcase_12 AC 1,126 ms
15,228 KB
testcase_13 AC 1,132 ms
15,108 KB
testcase_14 AC 1,184 ms
15,124 KB
testcase_15 AC 100 ms
15,148 KB
testcase_16 AC 90 ms
15,208 KB
testcase_17 AC 115 ms
15,208 KB
testcase_18 AC 87 ms
15,304 KB
testcase_19 AC 96 ms
15,288 KB
testcase_20 AC 95 ms
15,260 KB
testcase_21 AC 89 ms
15,296 KB
testcase_22 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:19: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
def dfs(a,&block)
	return to_enum(:dfs,a) if !block_given?
	yield a[0] if a.size<2
	(a.size-1).times{|i|
		dfs(a[0..i]){|l|
			dfs(a[i+1..-1]){|r|
				(puts :YES;exit) if l==r
				next if l<r
				yield l+r
				yield l-r
				yield l*r
				yield l.is_a?(Rational) || r.is_a?(Rational) ? l/r : Rational(l,r)
			}
		}
	}
end

n,*a=`dd`.split.map(&:to_i)
a.permutation{|b|
	dfs(b).each{|e|
	}
}
puts :NO
0