結果
| 問題 | No.29 パワーアップ | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-03-31 17:48:35 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 38 ms / 5,000 ms | 
| コード長 | 432 bytes | 
| コンパイル時間 | 250 ms | 
| コンパイル使用メモリ | 82,340 KB | 
| 実行使用メモリ | 53,896 KB | 
| 最終ジャッジ日時 | 2025-10-24 21:21:37 | 
| 合計ジャッジ時間 | 1,633 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
ソースコード
n = int(input())
counts = [0] * 10  # 1-based to 10, indexed 0-9
for _ in range(n):
    a, b, c = map(int, input().split())
    counts[a-1] += 1
    counts[b-1] += 1
    counts[c-1] += 1
# Calculate maximum pairs
pairs = sum(c // 2 for c in counts)
# Sum remaining items after pairs
remaining = sum(c % 2 for c in counts)
# Calculate quadruples from remaining
quadruples = remaining // 4
total = pairs + quadruples
print(total)
            
            
            
        