結果

問題 No.349 干支の置き物
ユーザー akko_yukkyakko_yukky
提出日時 2017-04-26 18:02:55
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 291 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 11,512 KB
実行使用メモリ 15,312 KB
最終ジャッジ日時 2023-10-11 13:57:28
合計ジャッジ時間 3,894 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,204 KB
testcase_01 AC 81 ms
15,036 KB
testcase_02 AC 79 ms
15,276 KB
testcase_03 AC 80 ms
15,272 KB
testcase_04 AC 79 ms
15,064 KB
testcase_05 AC 80 ms
15,260 KB
testcase_06 AC 79 ms
15,224 KB
testcase_07 AC 80 ms
14,980 KB
testcase_08 AC 79 ms
15,112 KB
testcase_09 AC 79 ms
15,260 KB
testcase_10 AC 80 ms
15,088 KB
testcase_11 AC 80 ms
15,268 KB
testcase_12 AC 79 ms
15,068 KB
testcase_13 AC 79 ms
14,968 KB
testcase_14 AC 80 ms
15,056 KB
testcase_15 AC 79 ms
15,068 KB
testcase_16 AC 78 ms
15,136 KB
testcase_17 AC 78 ms
15,204 KB
testcase_18 WA -
testcase_19 AC 78 ms
15,044 KB
testcase_20 WA -
testcase_21 AC 80 ms
15,116 KB
testcase_22 WA -
testcase_23 AC 80 ms
15,268 KB
testcase_24 WA -
testcase_25 AC 79 ms
15,036 KB
testcase_26 AC 78 ms
15,220 KB
testcase_27 AC 79 ms
15,208 KB
testcase_28 AC 79 ms
15,040 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 78 ms
14,976 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
a=$stdin.read.split(?\n).map().sort

if n==1
  puts "YES"
  return
end

m=0
a.each {|str|
  m=(m>a.count(str)? m:a.count(str))
  }

flag = 0 

if n%4==0
  if m<=n/2
    flag=1
  end 
else
  if m<=(n-1)/2
    flag=1
  end 
end

if flag==1
  puts "YES"
elsif flag==0
  puts"NO"
end
0