結果
問題 | No.2182 KODOKU Stone |
ユーザー | Shirotsume |
提出日時 | 2022-09-19 00:45:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,839 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 261,200 KB |
最終ジャッジ日時 | 2024-11-14 12:03:16 |
合計ジャッジ時間 | 10,937 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
54,452 KB |
testcase_01 | AC | 40 ms
53,912 KB |
testcase_02 | AC | 39 ms
53,508 KB |
testcase_03 | AC | 36 ms
53,916 KB |
testcase_04 | AC | 37 ms
54,248 KB |
testcase_05 | WA | - |
testcase_06 | AC | 39 ms
54,988 KB |
testcase_07 | AC | 38 ms
53,812 KB |
testcase_08 | AC | 38 ms
53,884 KB |
testcase_09 | AC | 39 ms
53,356 KB |
testcase_10 | AC | 37 ms
53,212 KB |
testcase_11 | AC | 546 ms
259,620 KB |
testcase_12 | WA | - |
testcase_13 | AC | 75 ms
82,716 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 573 ms
261,200 KB |
testcase_17 | AC | 68 ms
85,116 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 79 ms
76,120 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 76 ms
76,320 KB |
testcase_26 | AC | 79 ms
76,380 KB |
testcase_27 | AC | 80 ms
76,328 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 395 ms
248,964 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 41 ms
53,732 KB |
testcase_39 | WA | - |
ソースコード
import sys input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 n = ii() k = [i - 1 for i in li()][::-1] a = [] for _ in range(n): _ = ii() a.append(list(sorted(li(), reverse=True))) def check(x): ind = [-1] * n s = set(range(n)) nowkind = 0 nowk = k[0] while s: for v in list(s): if nowk <= len(a[v]) - 1 and a[v][min(len(a[v]) - 1, nowk)] >= x: return True f = False p = -1 for v in list(s): if nowk >= len(a[v]) and a[v][-1] >= x: nowk = len(a[v]) - 1 s.discard(v) p = v f = True break for v in list(s): if a[v][min(len(a[v]) - 1, nowk)] >= x: return True if f: s.add(p) nowk = k[nowkind] mind = -1 mini = x for v in list(s): if a[v][min(len(a[v]) - 1, nowk - 1)] >= x and a[v][min(len(a[v]) - 1, nowk - 1)] < mini: mind = v mini = a[v][min(len(a[v]) - 1, nowk - 1)] if mind == -1: return False x = mini s.discard(mind) nowkind += 1 if nowkind >= len(k) or nowk <= k[nowkind]: return False nowk = k[nowkind] return False def check2(x): ind = [-1] * n s = set(range(n)) nowkind = 0 while s: nowk = k[nowkind] for v in list(s): if len(a[v]) != nowk and a[v][min(len(a[v]) - 1, nowk)] >= x: return True mind = -1 mini = inf for v in list(s): if a[v][min(len(a[v]) - 1, nowk - 1)] >= x and a[v][min(len(a[v]) - 1, nowk - 1)] < mini: mind = v mini = a[v][min(len(a[v]) - 1, nowk - 1)] if mind == -1: return False x = mini s.discard(mind) nowkind += 1 if nowkind >= len(k) or nowk <= k[nowkind]: return False return False ok = 0 ng = 10 ** 9 + 1 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if check(mid) or check2(mid): ok = mid else: ng = mid print(ok)