結果
| 問題 |
No.349 干支の置き物
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-20 12:14:21 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 2,000 ms |
| コード長 | 743 bytes |
| コンパイル時間 | 3,555 ms |
| コンパイル使用メモリ | 85,172 KB |
| 実行使用メモリ | 41,336 KB |
| 最終ジャッジ日時 | 2024-07-19 20:36:40 |
| 合計ジャッジ時間 | 8,361 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
Map<String, Integer> F = new HashMap<>();
for (int i = 0; i < N; i++) {
String input = sc.next();
if (!F.containsKey(input)) {
F.put(input, 0);
}
F.put(input, F.get(input) + 1);
}
int max = -1;
for (Integer value : F.values()) {
if (max < value) {
max = value;
}
}
if (2 * (max - 1) < N) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}