結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,284 KB
testcase_01 AC 84 ms
15,168 KB
testcase_02 AC 86 ms
15,176 KB
testcase_03 AC 87 ms
15,224 KB
testcase_04 AC 84 ms
15,044 KB
testcase_05 AC 85 ms
15,144 KB
testcase_06 AC 112 ms
15,284 KB
testcase_07 AC 114 ms
15,272 KB
testcase_08 AC 115 ms
15,216 KB
testcase_09 AC 87 ms
15,192 KB
testcase_10 AC 88 ms
15,240 KB
testcase_11 AC 90 ms
15,392 KB
testcase_12 AC 1,068 ms
15,340 KB
testcase_13 AC 1,067 ms
15,272 KB
testcase_14 AC 1,137 ms
15,276 KB
testcase_15 AC 100 ms
15,260 KB
testcase_16 AC 85 ms
15,200 KB
testcase_17 AC 112 ms
15,248 KB
testcase_18 AC 85 ms
15,332 KB
testcase_19 AC 90 ms
15,336 KB
testcase_20 AC 90 ms
15,216 KB
testcase_21 AC 85 ms
15,092 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 Rational(l,r)
			}
		}
	}
end

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