結果
| 問題 | No.29 パワーアップ | 
| コンテスト | |
| ユーザー |  YamaKasa | 
| 提出日時 | 2018-04-20 01:06:48 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 166 ms / 5,000 ms | 
| コード長 | 703 bytes | 
| コンパイル時間 | 2,145 ms | 
| コンパイル使用メモリ | 85,628 KB | 
| 実行使用メモリ | 46,792 KB | 
| 最終ジャッジ日時 | 2025-10-24 21:06:15 | 
| 合計ジャッジ時間 | 5,994 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
//		int []a = new int[N];
//		int []b = new int[N];
//		int []c = new int[N];
		int []x = new int[3 *N];
		for(int i = 0; i < 3 * N; i++) {
			x[i] = scan.nextInt();
		}
		scan.close();
		Arrays.sort(x);
		int temp = x[0];
		int cnt1 = 1;
		int cnt2 = 0;
		int ans = 0;
		for(int i = 1; i < 3 * N; i++) {
			if(temp == x[i]) {
				cnt1 ++;
			}else {
				ans += cnt1 / 2;
				cnt2 += cnt1 % 2;
				temp = x[i];
				cnt1 = 1;
			}
		}
		ans += cnt1 / 2;
		cnt2 += cnt1 % 2;
		ans += cnt2 / 4;
		System.out.println(ans);
	}
}
            
            
            
        