結果
| 問題 | No.349 干支の置き物 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-20 12:14:21 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 56 ms / 2,000 ms |
| + 791µs | |
| コード長 | 743 bytes |
| 記録 | |
| コンパイル時間 | 1,428 ms |
| コンパイル使用メモリ | 87,664 KB |
| 実行使用メモリ | 43,104 KB |
| 最終ジャッジ日時 | 2026-08-19 00:50:35 |
| 合計ジャッジ時間 | 5,389 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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");
}
}
}