結果
問題 | No.2182 KODOKU Stone |
ユーザー | MasKoaTS |
提出日時 | 2022-11-30 16:59:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,447 bytes |
コンパイル時間 | 322 ms |
コンパイル使用メモリ | 82,156 KB |
実行使用メモリ | 264,400 KB |
最終ジャッジ日時 | 2024-11-14 12:07:52 |
合計ジャッジ時間 | 20,551 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 131 ms
85,760 KB |
testcase_01 | AC | 127 ms
86,428 KB |
testcase_02 | AC | 132 ms
86,880 KB |
testcase_03 | WA | - |
testcase_04 | AC | 127 ms
86,252 KB |
testcase_05 | WA | - |
testcase_06 | AC | 143 ms
89,108 KB |
testcase_07 | AC | 145 ms
88,568 KB |
testcase_08 | AC | 142 ms
89,104 KB |
testcase_09 | AC | 142 ms
88,832 KB |
testcase_10 | AC | 125 ms
86,424 KB |
testcase_11 | WA | - |
testcase_12 | AC | 1,063 ms
244,328 KB |
testcase_13 | AC | 215 ms
101,896 KB |
testcase_14 | WA | - |
testcase_15 | AC | 1,053 ms
221,528 KB |
testcase_16 | AC | 1,046 ms
264,400 KB |
testcase_17 | AC | 189 ms
101,420 KB |
testcase_18 | AC | 937 ms
239,736 KB |
testcase_19 | AC | 571 ms
148,488 KB |
testcase_20 | AC | 807 ms
206,004 KB |
testcase_21 | AC | 241 ms
91,512 KB |
testcase_22 | AC | 229 ms
89,572 KB |
testcase_23 | WA | - |
testcase_24 | AC | 375 ms
104,516 KB |
testcase_25 | AC | 188 ms
89,876 KB |
testcase_26 | AC | 182 ms
89,400 KB |
testcase_27 | AC | 180 ms
89,876 KB |
testcase_28 | AC | 749 ms
192,500 KB |
testcase_29 | AC | 894 ms
222,008 KB |
testcase_30 | AC | 994 ms
245,244 KB |
testcase_31 | AC | 744 ms
188,148 KB |
testcase_32 | AC | 721 ms
183,004 KB |
testcase_33 | AC | 837 ms
213,740 KB |
testcase_34 | AC | 298 ms
95,224 KB |
testcase_35 | AC | 862 ms
212,000 KB |
testcase_36 | AC | 288 ms
96,056 KB |
testcase_37 | AC | 992 ms
242,796 KB |
testcase_38 | WA | - |
testcase_39 | AC | 131 ms
86,388 KB |
ソースコード
import itertools as iter import collections as coll import heapq as hq import bisect as bis from decimal import Decimal as dec from functools import cmp_to_key import math import sys #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10 ** 6) inp = sys.stdin.readline input = lambda : inp().rstrip() getN = lambda : int(inp()) getNs = lambda : map(int, inp().split()) getList = lambda :list(map(int, inp().split())) getStrs = lambda n : [input() for _ in [0] * n] def yexit(): print("Yes"); exit(0) def nexit(): print("No"); exit(0) pi = 3.141592653589793 mod = 1000000007 MOD = 998244353 INF = 4611686018427387903 dx = [1, 0, -1, 0]; dy = [0, 1, 0, -1] #di = coll.defaultdict(int) """ Main Code """ N = getN() K = getList() T = [0]*N A = [[] for _ in [0]*N] for i in range(N): T[i] = getN() A[i] = getList() def check(m): s = [0] * N P_tmp = [] Q_tmp = [] for i in range(N): s[i] = sum((k >= m) for k in A[i]) if(s[i] != len(A[i])): P_tmp.append(s[i]) else: Q_tmp.append(s[i]) P = coll.deque(sorted(P_tmp)) Q = coll.deque(sorted(Q_tmp)) for i, k in enumerate(K[::-1]): p = P[-1] if(P) else -1 q = Q[-1] if(Q) else -1 if(max(p,q) >= k): return True elif(p == k-1 and i < N): P.pop() elif(q != -1): Q.popleft() else: return False return True ok = 0 ng = 10 ** 9 + 1 while(ng - ok > 1): mid = (ok + ng) >> 1 if(check(mid)): ok = mid else: ng = mid print(ok)