結果

問題 No.29 パワーアップ
ユーザー ゆるく
提出日時 2014-10-30 00:32:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 518 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-12-30 13:48:43
合計ジャッジ時間 2,245 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy

n = int(input())
c = itertools.count(0, 1)
d = defaultdict(int)
count = 0
for i in c:
    if i >= n:
        break
    a, b, c = map(int, input().split())
    d[a] += 1
    d[b] += 1
    d[c] += 1
f = 0
for i in d:
    t = d[i] // 2
    d[i] -= t * 2
    count += t
    f += d[i]
print(count + (f // 4))
0