結果

問題 No.2182 KODOKU Stone
ユーザー MasKoaTSMasKoaTS
提出日時 2022-08-25 13:59:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 982 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 129,668 KB
最終ジャッジ日時 2024-04-26 21:04:29
合計ジャッジ時間 11,736 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,632 KB
testcase_01 WA -
testcase_02 AC 46 ms
53,888 KB
testcase_03 AC 45 ms
53,632 KB
testcase_04 AC 46 ms
53,632 KB
testcase_05 WA -
testcase_06 AC 62 ms
63,360 KB
testcase_07 AC 65 ms
64,384 KB
testcase_08 AC 63 ms
63,744 KB
testcase_09 AC 63 ms
64,128 KB
testcase_10 AC 46 ms
53,632 KB
testcase_11 AC 512 ms
99,100 KB
testcase_12 AC 578 ms
120,008 KB
testcase_13 AC 152 ms
100,992 KB
testcase_14 WA -
testcase_15 AC 595 ms
129,668 KB
testcase_16 WA -
testcase_17 AC 132 ms
97,024 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 167 ms
84,480 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 122 ms
76,928 KB
testcase_26 AC 101 ms
77,312 KB
testcase_27 AC 101 ms
77,056 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 392 ms
92,852 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# WA

import sys
from collections import defaultdict as dfdict
input = sys.stdin.readline

N = int(input())
K = list(map(int, input().split()))
T = [0] * N
A = [[] for _ in [0] * N]
st = set([])
for i in range(N):
	T[i] = int(input())
	A[i] = list(map(int, input().split()))
	st |= set(A[i])
Alis = sorted(st)

ok = 0
ng = len(Alis)

def check():
	dic = dfdict(int)
	wild = []
	for lis in A:
		s = sum((k >= md) for k in lis)
		if(s == len(lis)):
			wild.append(s)
		else:
			dic[s] += 1
	if(wild and max(wild) >= min(K)):
		return True
	wild.sort(reverse = True)
	slis = sorted(dic.keys())
	for i, k in enumerate(K[::-1]):
		s = slis[-1] if(slis) else -1
		w = wild[0] if(wild) else -1
		if(max(s, w) >= k):
			break
		elif(s == k - 1):
			dic[s] -= 1
			if(dic[s] == 0):
				slis.pop()
		elif(wild):
			wild.pop()
		else:
			return False
	return True

while(ng - ok > 1):
	mid = (ok + ng) >> 1
	md = Alis[mid]
	if check():
		ok = mid
	else:
		ng = mid

ans = Alis[ok]
print(ans)	
0