結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー ki_ki33ki_ki33
提出日時 2015-01-09 00:23:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,096 bytes
コンパイル時間 4,344 ms
コンパイル使用メモリ 78,936 KB
実行使用メモリ 66,044 KB
最終ジャッジ日時 2023-09-03 22:47:11
合計ジャッジ時間 8,563 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.io.IOException;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static final int C =  1000000007;
	//static boolean MAP[][];
	static int N;
	static int Q;
	static int MAX = -1;
	//static int tic[][];
	static boolean NUM[];
	//static int max;
	static int A[];
	static int ST[][];
	//static int p[];
	//static ArrayList<HashSet<Integer>> al;
	static TreeMap<Integer, ArrayList<Integer>> hm;
	//static ArrayList<Integer> al;
	//static int a[][];
	//static char[][] ch;
	//static ArrayList<HashMap<Long, Long>> al;
	//static String a[];
	//static String str;
	//static int[] mach = new int[] {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};

	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);
		
		
		int T = sc.nextInt();

		int n[] = new int[T];
		//int a[][] = new int[T][1000000001];
		ArrayList<HashMap<Integer, Integer>> al = new ArrayList<HashMap<Integer,Integer>>();
		for (int t=0; t < T; t++) {
			n[t] = sc.nextInt();
			//a[i] = new int[n[i]];
			al.add(new HashMap<Integer, Integer>());
			for (int i = 0; i < n[t]; i++) {
				//a[t][sc.nextInt()]++;
				int num = sc.nextInt();
				HashMap<Integer,Integer> hm = al.get(t);
				hm.put(num, hm.containsKey(num)?hm.get(num)+1:1);
			}
		}
		//N = sc.nextInt();
		
		
		
		int ans[] = new int[T];
		
		for (int t=0; t < T; t++) {
			int num = 0;
			HashMap<Integer,Integer> hm = al.get(t);
			
			LOOP:while (true) {
			Iterator<Entry<Integer,Integer>> it = hm.entrySet().iterator();
			while(it.hasNext()) {
				Entry<Integer, Integer> e = it.next();
				e.setValue(e.getValue()-1);
				num++;
				if (e.getValue() ==0) {
					it.remove();
				}
				if (num == 3) {
					ans[t]++;
					num = 0;
					continue LOOP;
				}
				
			}
			break LOOP;
			}
		}
		
		for (int i=0; i < T; i++) {
			sb.append(ans[i]+ "\n");
		}
		System.out.print(sb);
		


	}
	
	
	

}
0