結果

問題 No.239 にゃんぱすー
ユーザー 💕💖💞
提出日時 2016-09-16 18:20:03
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2024-11-17 07:32:48
合計ジャッジ時間 4,784 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - t2x
Syntax OK

ソースコード

diff #

t2x = [[]]

n = gets.to_i

de = (1..n).map { |x| 
  (1..n).map { |x2|
    "0" 
  }
}

(0..n-1).map { |t| 
   gets.split(" ").each_with_index { |x2, i|  
     de[t][i] = x2  
   }   
}

res = (0..n-1).map { |i| 
  al = 0 
  de.each_with_index { |l, e|  
    if de[e][i] == 'nyanpass' then
      al += 1
    end 
  }
  [i, al] 
}

tail = res.sort { |a, b| b[1] <=> a[1] }
max = tail[0][1]
len = tail.select { |xl| xl[1] == max }.length
if max == 0 or len > 1 then 
  puts "-1"
else
  puts tail[0][0]+1
end
0