結果

問題 No.2182 KODOKU Stone
ユーザー 👑 rin204rin204
提出日時 2023-12-29 15:39:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 967 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 161,584 KB
最終ジャッジ日時 2023-12-29 15:40:05
合計ジャッジ時間 16,546 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 43 ms
59,332 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 48 ms
61,596 KB
testcase_07 AC 52 ms
63,780 KB
testcase_08 AC 49 ms
61,596 KB
testcase_09 AC 49 ms
61,596 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 958 ms
153,536 KB
testcase_12 AC 934 ms
152,188 KB
testcase_13 AC 126 ms
88,844 KB
testcase_14 AC 135 ms
77,324 KB
testcase_15 AC 963 ms
147,184 KB
testcase_16 AC 938 ms
161,584 KB
testcase_17 AC 119 ms
87,400 KB
testcase_18 AC 820 ms
146,080 KB
testcase_19 AC 461 ms
99,740 KB
testcase_20 AC 713 ms
126,452 KB
testcase_21 AC 183 ms
78,108 KB
testcase_22 AC 144 ms
76,792 KB
testcase_23 WA -
testcase_24 AC 264 ms
82,340 KB
testcase_25 AC 102 ms
76,536 KB
testcase_26 AC 95 ms
76,664 KB
testcase_27 AC 95 ms
76,664 KB
testcase_28 AC 662 ms
118,828 KB
testcase_29 AC 777 ms
134,484 KB
testcase_30 AC 889 ms
147,268 KB
testcase_31 AC 620 ms
118,744 KB
testcase_32 AC 629 ms
114,968 KB
testcase_33 AC 723 ms
129,664 KB
testcase_34 AC 238 ms
80,036 KB
testcase_35 AC 737 ms
130,040 KB
testcase_36 AC 233 ms
79,948 KB
testcase_37 AC 869 ms
146,728 KB
testcase_38 AC 37 ms
53,460 KB
testcase_39 AC 37 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
K = list(map(int, input().split()))
A = [[] for _ in range(n)]
for i in range(n):
    input()
    A[i] = list(map(int, input().split()))


def ok(x):
    C = []
    all_ = []
    for row in A:
        c = sum(a >= x for a in row)
        if c == len(row):
            all_.append(c)
        else:
            C.append(c)

    if not C:
        return True
    C.sort()
    all_.sort(reverse=True)
    for k in K[::-1]:
        if C and C[-1] >= k:
            return True
        elif all_ and all_[0] >= k:
            return True

        if C[-1] == k - 1:
            if all_ and all_[-1] < k - 1:
                all_.pop()
            else:
                C.pop()
        elif all_:
            all_.pop()
        else:
            return False

        if not C and all_:
            return True

    return False


l = 1
r = 1 << 30
while r - l > 1:
    mid = (l + r) // 2
    if ok(mid):
        l = mid
    else:
        r = mid

print(l)
0