結果
問題 | No.3024 等式 |
ユーザー | ciel |
提出日時 | 2017-04-22 22:48:36 |
言語 | Ruby (3.2.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 453 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 11,424 KB |
実行使用メモリ | 19,868 KB |
最終ジャッジ日時 | 2023-09-28 21:36:18 |
合計ジャッジ時間 | 8,982 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
15,364 KB |
testcase_01 | AC | 89 ms
15,272 KB |
testcase_02 | AC | 94 ms
15,260 KB |
testcase_03 | AC | 92 ms
15,148 KB |
testcase_04 | AC | 86 ms
15,020 KB |
testcase_05 | AC | 87 ms
15,288 KB |
testcase_06 | AC | 295 ms
15,220 KB |
testcase_07 | AC | 305 ms
15,344 KB |
testcase_08 | AC | 315 ms
15,248 KB |
testcase_09 | AC | 93 ms
15,072 KB |
testcase_10 | AC | 99 ms
15,196 KB |
testcase_11 | AC | 93 ms
15,416 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
コンパイルメッセージ
Main.rb:19: warning: assigned but unused variable - n Syntax OK
ソースコード
#!/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| (puts :YES;exit) if l==0 dfs(a[i+1..-1]){|r| (puts :YES;exit) if r==0 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 :YES;exit) if e==0 } } puts :NO