結果
| 問題 | No.120 傾向と対策:門松列(その1) | 
| コンテスト | |
| ユーザー |  kou6839 | 
| 提出日時 | 2015-01-14 00:59:37 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 909 bytes | 
| コンパイル時間 | 2,721 ms | 
| コンパイル使用メモリ | 79,660 KB | 
| 実行使用メモリ | 68,388 KB | 
| 最終ジャッジ日時 | 2024-06-22 11:23:38 | 
| 合計ジャッジ時間 | 6,998 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 4 | 
ソースコード
import java.math.*;
import java.util.*;
class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t= sc.nextInt();
        for(int i=0;i<t;i++){
        	int n = sc.nextInt();
        	HashMap<Integer,Integer> matu = new HashMap<>();
        	for(int j=0;j<n;j++){
        		int a = sc.nextInt();
        		if(!matu.containsKey(a)) matu.put(a, 0);
        		matu.put(a, matu.get(a)+1);
        	}
        	int ans=0;
        	tt:while(true){
        		if(matu.size()<3) break;
        		ans++;
        		int count=1;
        		for(int b:matu.keySet()){
        			matu.put(b, matu.get(b)-1);
        			if(count==3) break;
        			count++;
        		}
        		Object[] aaa = matu.keySet().toArray();
        		for(Object aa:aaa){
        			if(matu.get(aa)==0) matu.remove(aa);
        		}
        	}
        	System.out.println(ans);
        }
	}
}
            
            
            
        