結果

問題 No.349 干支の置き物
ユーザー ぴろずぴろず
提出日時 2016-04-15 14:33:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 4,206 ms
コンパイル使用メモリ 84,900 KB
実行使用メモリ 58,272 KB
最終ジャッジ日時 2023-08-10 21:43:17
合計ジャッジ時間 8,452 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
55,340 KB
testcase_01 AC 137 ms
55,596 KB
testcase_02 AC 135 ms
56,056 KB
testcase_03 AC 134 ms
56,240 KB
testcase_04 AC 143 ms
56,140 KB
testcase_05 AC 140 ms
55,924 KB
testcase_06 AC 143 ms
56,048 KB
testcase_07 AC 147 ms
56,000 KB
testcase_08 AC 144 ms
55,788 KB
testcase_09 AC 142 ms
55,624 KB
testcase_10 AC 137 ms
55,668 KB
testcase_11 AC 142 ms
56,756 KB
testcase_12 AC 138 ms
56,128 KB
testcase_13 AC 138 ms
56,268 KB
testcase_14 AC 138 ms
56,204 KB
testcase_15 AC 139 ms
58,272 KB
testcase_16 AC 138 ms
56,124 KB
testcase_17 AC 137 ms
55,628 KB
testcase_18 AC 132 ms
55,596 KB
testcase_19 AC 135 ms
55,408 KB
testcase_20 AC 134 ms
55,704 KB
testcase_21 AC 134 ms
55,704 KB
testcase_22 AC 136 ms
55,904 KB
testcase_23 AC 134 ms
55,788 KB
testcase_24 AC 134 ms
56,156 KB
testcase_25 AC 137 ms
55,748 KB
testcase_26 AC 137 ms
55,980 KB
testcase_27 AC 140 ms
55,944 KB
testcase_28 AC 141 ms
55,968 KB
testcase_29 AC 141 ms
56,156 KB
testcase_30 AC 137 ms
55,892 KB
testcase_31 AC 145 ms
55,708 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