結果

問題 No.4 おもりと天秤
ユーザー tanukidontanukidon
提出日時 2018-04-09 02:14:20
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 11,556 KB
実行使用メモリ 15,368 KB
最終ジャッジ日時 2023-09-09 03:21:01
合計ジャッジ時間 3,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,032 KB
testcase_01 WA -
testcase_02 AC 82 ms
15,088 KB
testcase_03 AC 81 ms
15,028 KB
testcase_04 WA -
testcase_05 AC 85 ms
15,112 KB
testcase_06 AC 81 ms
15,108 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 81 ms
15,160 KB
testcase_10 AC 80 ms
15,080 KB
testcase_11 AC 80 ms
15,236 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 81 ms
15,312 KB
testcase_15 WA -
testcase_16 AC 79 ms
15,044 KB
testcase_17 WA -
testcase_18 AC 81 ms
15,024 KB
testcase_19 AC 80 ms
15,132 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.chomp.split.map(&:to_i).map{|i| i/2 % 2}
c = 0
n.times do |i|
  b = a.rotate(i).dup
  x = b.shift
  y = 0
  b.each do |j|
    if x < y
      x += j
    else
      y += j
    end
  end
  c +=1 if x == y
  break if c > 0
end
puts c == 1 ? "possible" : "impossible"
0