結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-03-12 02:06:36 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 174 ms / 2,000 ms | 
| コード長 | 661 bytes | 
| コンパイル時間 | 3,918 ms | 
| コンパイル使用メモリ | 79,284 KB | 
| 実行使用メモリ | 42,140 KB | 
| 最終ジャッジ日時 | 2024-11-17 07:25:05 | 
| 合計ジャッジ時間 | 10,162 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
package 練習;
import java.util.Date;
import java.util.HashMap;
import java.util.Scanner;
public class main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		double n=sc.nextDouble();
		long exec_time=new Date().getTime();
		HashMap<String,Integer> map=new HashMap<>();
		for(int i=0;i<n;i++){
			String x=sc.next();
			if(!map.containsKey(x)){
				map.put(x, 1);
			}else{
				map.put(x,map.get(x)+1);
			}
		}
		int max=0;
		for(int v:map.values())max=Math.max(v, max);
		if(max*2 <= n+1){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		System.err.println(new Date().getTime()-exec_time+"ms");
	}
}