結果

問題 No.349 干支の置き物
ユーザー ぴろずぴろず
提出日時 2016-04-15 14:33:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 2,607 ms
コンパイル使用メモリ 91,128 KB
実行使用メモリ 42,072 KB
最終ジャッジ日時 2024-11-17 07:30:26
合計ジャッジ時間 8,890 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

package no349;

import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long max =
				Stream.generate(sc::next).limit(n)
				.collect(Collectors.groupingBy(x -> x, Collectors.counting())).values().stream().mapToLong(x -> x).max().getAsLong();
		System.out.println(max <= (n+1)/2 ? "YES" : "NO");
	}

}
0