結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
ki_ki33
|
| 提出日時 | 2015-01-09 00:23:21 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,096 bytes |
| コンパイル時間 | 2,792 ms |
| コンパイル使用メモリ | 95,468 KB |
| 実行使用メモリ | 66,156 KB |
| 最終ジャッジ日時 | 2024-06-13 03:25:12 |
| 合計ジャッジ時間 | 6,673 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
ソースコード
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);
}
}
ki_ki33