結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
zazaboon
|
| 提出日時 | 2017-02-03 17:23:51 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 24,448 KB |
| 最終ジャッジ日時 | 2024-12-24 04:20:40 |
| 合計ジャッジ時間 | 56,929 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 1 TLE * 9 |
コンパイルメッセージ
Main.rb:22: warning: `:' after local variable or literal is interpreted as binary operator Main.rb:22: warning: even though it seems like symbol literal Syntax OK
ソースコード
def zent(x,s)
return if($f == 1)
return if(s > $s)
return if(x >= $n)
if(s == $s)
$f = 1; return;
end
zent(x+1,s)
s += $a[x]
zent(x+1,s)
end
$f = 0
$n=gets.chomp.to_i
$a=gets.chomp.split(" ").map(&:to_i).sort.reverse
$s = $a.inject(:+)
if ($s%2 == 1)
puts "impossible"
exit
end
$s = $s/2
zent(1,$a[0])
puts ($f == 1)? "possible" :"impossible"
zazaboon