結果

問題 No.349 干支の置き物
ユーザー ぴろずぴろず
提出日時 2016-04-15 14:33:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 2,676 ms
コンパイル使用メモリ 91,620 KB
実行使用メモリ 41,840 KB
最終ジャッジ日時 2024-04-28 14:46:45
合計ジャッジ時間 7,385 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,676 KB
testcase_01 AC 132 ms
41,392 KB
testcase_02 AC 116 ms
40,072 KB
testcase_03 AC 133 ms
41,512 KB
testcase_04 AC 128 ms
40,784 KB
testcase_05 AC 142 ms
41,688 KB
testcase_06 AC 129 ms
40,760 KB
testcase_07 AC 130 ms
41,004 KB
testcase_08 AC 149 ms
41,480 KB
testcase_09 AC 141 ms
41,424 KB
testcase_10 AC 124 ms
40,748 KB
testcase_11 AC 123 ms
40,596 KB
testcase_12 AC 138 ms
41,628 KB
testcase_13 AC 136 ms
41,416 KB
testcase_14 AC 131 ms
41,724 KB
testcase_15 AC 124 ms
40,636 KB
testcase_16 AC 136 ms
40,416 KB
testcase_17 AC 138 ms
41,680 KB
testcase_18 AC 122 ms
40,912 KB
testcase_19 AC 126 ms
40,744 KB
testcase_20 AC 131 ms
41,692 KB
testcase_21 AC 130 ms
41,592 KB
testcase_22 AC 120 ms
40,108 KB
testcase_23 AC 113 ms
40,520 KB
testcase_24 AC 121 ms
40,780 KB
testcase_25 AC 139 ms
41,840 KB
testcase_26 AC 143 ms
41,652 KB
testcase_27 AC 144 ms
41,620 KB
testcase_28 AC 123 ms
40,720 KB
testcase_29 AC 124 ms
40,616 KB
testcase_30 AC 136 ms
41,480 KB
testcase_31 AC 122 ms
40,468 KB
権限があれば一括ダウンロードができます

ソースコード

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