結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2021-05-21 01:29:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 457 bytes |
| コンパイル時間 | 374 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 78,208 KB |
| 最終ジャッジ日時 | 2024-10-10 07:25:43 |
| 合計ジャッジ時間 | 1,804 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
ソースコード
from heapq import heapify
from collections import defaultdict
T=int(input())
for _ in range(T):
N=int(input())
L=list(map(int,input().split()))
D=defaultdict(int)
for a in L:
D[a]+=1
Q=list(D.keys())
heapify(Q)
X=0
while len(Q)>=3:
p=Q.pop()
q=Q.pop()
r=Q.pop()
X+=1
for x in [p,q,r]:
D[x]-=1
if D[x]>=1:
Q.append(x)
print(X)
Kazun