結果
問題 |
No.120 傾向と対策:門松列(その1)
|
ユーザー |
![]() |
提出日時 | 2022-10-18 10:47:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 155 ms / 5,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,288 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-28 19:49:41 |
合計ジャッジ時間 | 1,120 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 |
ソースコード
import sys from collections import Counter readline=sys.stdin.readline def Bisect_Int(ok,ng,is_ok): while abs(ok-ng)>1: mid=(ok+ng)//2 if is_ok(mid): ok=mid else: ng=mid return ok T=int(readline()) for t in range(T): N=int(readline()) L=list(map(int,readline().split())) C=Counter(L) def is_ok(ans): cnt=0 for l,c in C.items(): cnt+=min(c,ans) return ans*3<=cnt ans=Bisect_Int(0,N//3+1,is_ok) print(ans)