結果

問題 No.239 にゃんぱすー
ユーザー 💕💖💞
提出日時 2016-09-16 21:01:32
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-11-17 08:05:27
合計ジャッジ時間 4,963 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.include?("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