結果

問題 No.43 野球の試合
ユーザー char134217728char134217728
提出日時 2017-09-10 18:02:20
言語 Ruby
(3.3.0)
結果
AC  
実行時間 347 ms / 5,000 ms
コード長 439 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-25 03:10:51
合計ジャッジ時間 2,726 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
12,160 KB
testcase_01 AC 95 ms
12,160 KB
testcase_02 AC 89 ms
12,416 KB
testcase_03 AC 91 ms
12,288 KB
testcase_04 AC 95 ms
12,288 KB
testcase_05 AC 101 ms
12,288 KB
testcase_06 AC 154 ms
12,288 KB
testcase_07 AC 347 ms
12,416 KB
testcase_08 AC 147 ms
12,288 KB
testcase_09 AC 150 ms
12,288 KB
testcase_10 AC 146 ms
12,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

@n = gets.to_i
@a = @n.times.map{gets.chomp}
@m = [*0...@n].combination(2).to_a
@ml = @m.length
@mi = 100
def check(i)
  w = [0]*@n
  (0...@ml).each do |j|
    c, d = @m[j]
    if (1<<j) & i > 0
      w[c] += 1
      return if @a[c][d] == 'x'
    else
      w[d] += 1
      return if @a[c][d] == 'o'
    end
  end
  r = 1
  w = w.uniq
  w[1..-1].each{|j| r += 1 if j > w[0]}
  @mi = r if r < @mi
end
(0...(1<<@ml)).each{|i| check(i)}
p @mi
0