結果

問題 No.349 干支の置き物
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-03-01 00:03:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 2,667 ms
コンパイル使用メモリ 72,240 KB
実行使用メモリ 58,000 KB
最終ジャッジ日時 2023-08-24 17:54:03
合計ジャッジ時間 7,492 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,140 KB
testcase_01 AC 123 ms
55,984 KB
testcase_02 AC 123 ms
55,972 KB
testcase_03 AC 127 ms
56,028 KB
testcase_04 AC 138 ms
56,080 KB
testcase_05 AC 135 ms
55,776 KB
testcase_06 AC 137 ms
55,792 KB
testcase_07 AC 134 ms
55,840 KB
testcase_08 AC 140 ms
55,980 KB
testcase_09 AC 136 ms
55,748 KB
testcase_10 AC 135 ms
55,784 KB
testcase_11 AC 138 ms
55,668 KB
testcase_12 AC 138 ms
55,780 KB
testcase_13 AC 128 ms
58,000 KB
testcase_14 AC 126 ms
56,284 KB
testcase_15 AC 131 ms
55,520 KB
testcase_16 AC 128 ms
56,008 KB
testcase_17 AC 133 ms
55,464 KB
testcase_18 AC 139 ms
55,784 KB
testcase_19 AC 132 ms
55,768 KB
testcase_20 AC 122 ms
56,080 KB
testcase_21 AC 122 ms
56,056 KB
testcase_22 AC 121 ms
55,732 KB
testcase_23 AC 123 ms
56,052 KB
testcase_24 AC 132 ms
55,752 KB
testcase_25 AC 132 ms
55,756 KB
testcase_26 AC 137 ms
55,780 KB
testcase_27 AC 141 ms
55,972 KB
testcase_28 AC 135 ms
55,768 KB
testcase_29 AC 130 ms
55,772 KB
testcase_30 AC 130 ms
55,840 KB
testcase_31 AC 129 ms
56,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		Map<String,Integer> map = new LinkedHashMap<>();
		String s;
		for (int i=0; i<n; i++) {
			s = sc.next();
			map.put(s,map.getOrDefault(s,0));
			map.put(s,map.get(s)+1);
		}
		int max = -1;
		for (Map.Entry<String,Integer> entry : map.entrySet()) {
			max = Math.max(max,entry.getValue());
		}
		if (max <= (n+1)/2) {out.println("YES");}
		else {out.println("NO");}
	}
}
0