結果

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

ソースコード

diff #

t2x = [[]]

n = gets.to_i

inv = 1.upto(n).map { |x| 
  gets.split(" ").map { |x2| 
    res = 0 
    if x2 == "nyanpass" then
      res = 1
    else
      res = 0 
    end 
    res 
  }
}
heads = (0..n-1).map {|x|  
  inv.map { |i| 
    i[x]
  }.inject {|a,s| a+s} 
}.map.with_index { |o, i|  
  [i+1, o]
}.map { |x| x} .sort { |a,b| b[1] <=> a[1] }

head = heads.first
seco = heads[1]
if head[1] == n-1 and head[1] != 0 and head[1] != seco[1] then 
  puts head[0]
else 
  puts "-1"
end
0