結果

問題 No.43 野球の試合
ユーザー char134217728char134217728
提出日時 2017-09-10 17:58:46
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-25 03:10:35
合計ジャッジ時間 2,313 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,160 KB
testcase_01 AC 92 ms
12,160 KB
testcase_02 AC 92 ms
12,416 KB
testcase_03 AC 93 ms
12,288 KB
testcase_04 AC 95 ms
12,288 KB
testcase_05 AC 103 ms
12,288 KB
testcase_06 AC 152 ms
12,288 KB
testcase_07 AC 347 ms
12,288 KB
testcase_08 WA -
testcase_09 AC 146 ms
12,288 KB
testcase_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
  (1...@n).each{|j| r += 1 if w[j] > w[0]}
  @mi = r if r < @mi
end
(0...(1<<@ml)).each{|i| check(i)}
p @mi
0