結果

問題 No.2182 KODOKU Stone
ユーザー MasKoaTSMasKoaTS
提出日時 2022-11-29 11:57:01
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 872 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 181,332 KB
最終ジャッジ日時 2024-04-26 21:07:18
合計ジャッジ時間 12,464 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
53,504 KB
testcase_01 AC 44 ms
53,760 KB
testcase_02 AC 45 ms
53,888 KB
testcase_03 AC 43 ms
53,760 KB
testcase_04 AC 44 ms
54,016 KB
testcase_05 AC 43 ms
53,504 KB
testcase_06 AC 58 ms
63,744 KB
testcase_07 AC 65 ms
64,640 KB
testcase_08 AC 61 ms
63,872 KB
testcase_09 AC 63 ms
64,640 KB
testcase_10 AC 44 ms
53,760 KB
testcase_11 AC 559 ms
177,852 KB
testcase_12 AC 550 ms
150,276 KB
testcase_13 AC 146 ms
101,376 KB
testcase_14 AC 155 ms
82,880 KB
testcase_15 AC 588 ms
150,476 KB
testcase_16 AC 592 ms
181,332 KB
testcase_17 AC 127 ms
96,896 KB
testcase_18 AC 558 ms
157,164 KB
testcase_19 AC 341 ms
110,596 KB
testcase_20 AC 505 ms
138,608 KB
testcase_21 AC 194 ms
85,248 KB
testcase_22 AC 160 ms
84,864 KB
testcase_23 WA -
testcase_24 AC 243 ms
87,812 KB
testcase_25 AC 117 ms
77,184 KB
testcase_26 AC 99 ms
77,312 KB
testcase_27 AC 98 ms
77,056 KB
testcase_28 AC 457 ms
132,316 KB
testcase_29 AC 543 ms
153,516 KB
testcase_30 AC 601 ms
165,736 KB
testcase_31 AC 484 ms
132,708 KB
testcase_32 AC 465 ms
127,760 KB
testcase_33 AC 529 ms
146,128 KB
testcase_34 AC 227 ms
90,752 KB
testcase_35 AC 544 ms
147,272 KB
testcase_36 AC 188 ms
81,832 KB
testcase_37 AC 602 ms
164,052 KB
testcase_38 WA -
testcase_39 AC 45 ms
53,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque
input = sys.stdin.readline

N = int(input())
K_rev = list(map(int, input().split()))[::-1]
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)

def check():
	P_tmp = [];	Q_tmp = []
	for lis in A:
		s = sum((k >= m) for k in lis)
		if(s < len(lis)):
			P_tmp.append(s)
		else:
			Q_tmp.append(s)
	P = deque(sorted(P_tmp))
	Q = deque(sorted(Q_tmp))
	for i, k in enumerate(K_rev):
		p = P[-1] if(P) else -1
		q = Q[-1] if(Q) else -1
		if(max(p, q) >= k):
			break
		elif(p == k - 1 and i < N - 1):
			P.pop()
		elif(q != -1):
			Q.popleft()
		else:
			return False
	return True

ok = 0
ng = len(Alis)
while(ng - ok > 1):
	t = (ok + ng) >> 1
	m = Alis[t]
	if check():
		ok = t
	else:
		ng = t

ans = Alis[ok]
print(ans)	
0