結果
問題 |
No.43 野球の試合
|
ユーザー |
|
提出日時 | 2017-06-15 12:43:03 |
言語 | Ruby (3.4.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 478 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-09-25 02:09:36 |
合計ジャッジ時間 | 1,815 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 3 WA * 1 RE * 3 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i S = N.times.map{ gets[0,N] } res = N.times.map{[nil]*N} S.each_with_index{|s, i| s.chars.each_with_index{|c, ii| res[i][ii] = c } } N.times{|x| if res[0][x] == ?- res[0][x] = ?o res[x][0] = ?x end } while res.any?{|a|a.any?{|c|c == ?-}} y = res.min_by{|a|[-a.count(?o), -a.count(?-)]}.index(?#) x = res[y].index(?-) res[y][x] = ?x res[x][y] = ?o end win = res[0].count(?o) p 1 + res.map{|a|a.count(?o)}.sort_by{|o|-o}.uniq.index(win)