結果

問題 No.2182 KODOKU Stone
ユーザー MasKoaTSMasKoaTS
提出日時 2022-08-24 22:15:02
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 960 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 104,404 KB
最終ジャッジ日時 2024-04-26 21:02:47
合計ジャッジ時間 13,206 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,760 KB
testcase_01 AC 45 ms
53,632 KB
testcase_02 AC 45 ms
53,632 KB
testcase_03 AC 45 ms
53,632 KB
testcase_04 WA -
testcase_05 AC 45 ms
53,504 KB
testcase_06 AC 61 ms
63,360 KB
testcase_07 WA -
testcase_08 AC 62 ms
63,744 KB
testcase_09 AC 63 ms
64,256 KB
testcase_10 AC 46 ms
53,760 KB
testcase_11 AC 521 ms
99,476 KB
testcase_12 AC 579 ms
101,616 KB
testcase_13 AC 150 ms
100,992 KB
testcase_14 AC 159 ms
83,012 KB
testcase_15 AC 608 ms
104,404 KB
testcase_16 AC 556 ms
103,756 KB
testcase_17 AC 133 ms
97,024 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 160 ms
84,864 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 116 ms
76,928 KB
testcase_26 AC 101 ms
77,440 KB
testcase_27 AC 102 ms
76,928 KB
testcase_28 WA -
testcase_29 AC 525 ms
95,988 KB
testcase_30 AC 555 ms
99,816 KB
testcase_31 AC 422 ms
92,720 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 483 ms
96,200 KB
testcase_36 WA -
testcase_37 AC 559 ms
99,536 KB
testcase_38 WA -
testcase_39 AC 45 ms
53,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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():
	st = set([])
	dic = dfdict(int)
	for lis in A:
		s = sum((k >= md) for k in lis)
		st.add(s)
		dic[(s << 1) | (s == len(lis))] += 1
	slis = sorted(st)
	for i, k in enumerate(K[::-1]):
		id0 = (slis[-1] << 1)
		id1 = (id0 | 1)
		if(slis[-1] >= k):
			return True
		elif(i == N - 1):
			return (dic[id1] > 0)
		elif(slis[-1] < k-1 or dic[id0] == 0):
			if(dic[id1] == 0):
				break
			dic[id1] -= 1
		else:
			dic[id0] -= 1
		if(dic[id0] == 0 and dic[id1] == 0):
			slis.pop()
	return False

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

ans = Alis[ok]
print(ans)	
0