結果

問題 No.349 干支の置き物
ユーザー tsubaki961
提出日時 2016-05-19 00:30:39
言語 Perl
(5.40.0)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 05:45:18
合計ジャッジ時間 1,152 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;

my $N = <STDIN>;
my @list;
my $str;
for (my $i = 0; $i < $N; $i++)
{
	$str = <STDIN>;
	push(@list, $str);
}
@list = sort {$a <=> $b} @list;
my $cnt = 0;
my $cnt_max = 0;
my $res = "";
foreach my $i(@list)
{
	if($i ne $res)
	{
		$cnt = 0;
	}
	$cnt++;
	$res = $i;
	if($cnt > $cnt_max)
	{
		$cnt_max = $cnt;
	}
}
if($cnt_max > @list / 2 + 1)
{
	print "NO\n";
}
else
{
	print "YES\n";
}
	
0