結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2022-10-18 10:47:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 487 ms / 5,000 ms |
| コード長 | 519 bytes |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-06-28 19:49:36 |
| 合計ジャッジ時間 | 2,653 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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,1<<30,is_ok)
print(ans)
vwxyz