結果

問題 No.349 干支の置き物
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-03-01 00:03:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 2,556 ms
コンパイル使用メモリ 72,556 KB
実行使用メモリ 56,496 KB
最終ジャッジ日時 2023-08-24 17:53:54
合計ジャッジ時間 7,921 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,980 KB
testcase_01 AC 123 ms
56,272 KB
testcase_02 AC 123 ms
56,020 KB
testcase_03 AC 124 ms
55,788 KB
testcase_04 AC 128 ms
55,712 KB
testcase_05 AC 125 ms
56,028 KB
testcase_06 AC 126 ms
55,760 KB
testcase_07 AC 125 ms
55,708 KB
testcase_08 AC 129 ms
56,044 KB
testcase_09 AC 127 ms
55,764 KB
testcase_10 AC 123 ms
55,916 KB
testcase_11 AC 128 ms
56,496 KB
testcase_12 AC 127 ms
56,252 KB
testcase_13 AC 126 ms
55,716 KB
testcase_14 AC 126 ms
55,788 KB
testcase_15 AC 126 ms
55,988 KB
testcase_16 AC 126 ms
55,708 KB
testcase_17 AC 126 ms
55,740 KB
testcase_18 WA -
testcase_19 AC 123 ms
55,756 KB
testcase_20 WA -
testcase_21 AC 123 ms
55,752 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 123 ms
55,900 KB
testcase_26 AC 125 ms
55,916 KB
testcase_27 AC 129 ms
56,124 KB
testcase_28 AC 129 ms
56,108 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 128 ms
55,444 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