結果

問題 No.1597 Matrix Sort
ユーザー mkawa2mkawa2
提出日時 2021-07-09 22:08:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 351 ms / 1,500 ms
コード長 994 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 102,300 KB
最終ジャッジ日時 2023-09-14 09:14:54
合計ジャッジ時間 8,510 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,336 KB
testcase_01 AC 73 ms
71,396 KB
testcase_02 AC 76 ms
71,252 KB
testcase_03 AC 314 ms
98,040 KB
testcase_04 AC 323 ms
98,064 KB
testcase_05 AC 351 ms
98,140 KB
testcase_06 AC 345 ms
97,956 KB
testcase_07 AC 350 ms
97,984 KB
testcase_08 AC 284 ms
98,172 KB
testcase_09 AC 293 ms
98,140 KB
testcase_10 AC 136 ms
99,444 KB
testcase_11 AC 153 ms
98,212 KB
testcase_12 AC 221 ms
99,084 KB
testcase_13 AC 289 ms
99,744 KB
testcase_14 AC 314 ms
98,084 KB
testcase_15 AC 211 ms
102,300 KB
testcase_16 AC 265 ms
99,736 KB
testcase_17 AC 283 ms
98,100 KB
testcase_18 AC 327 ms
98,112 KB
testcase_19 AC 285 ms
98,116 KB
testcase_20 AC 278 ms
98,080 KB
testcase_21 AC 274 ms
98,180 KB
testcase_22 AC 277 ms
98,736 KB
testcase_23 AC 178 ms
99,636 KB
testcase_24 AC 126 ms
101,880 KB
testcase_25 AC 115 ms
101,592 KB
testcase_26 AC 78 ms
71,168 KB
testcase_27 AC 77 ms
71,592 KB
testcase_28 AC 78 ms
71,324 KB
testcase_29 AC 83 ms
75,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7

n, k, p = LI()
k -= 1
aa = LI()
bb = LI()
aa.sort()
bb.sort()

# mより小さい数を数える
def cnt(m):
    res = 0
    i = n-1
    for a in aa:
        while i >= 0 and a+bb[i] >= m:
            i -= 1
        if i < 0: break
        res += i+1
    return res

l, r = 0, p
while l+1 < r:
    m = (l+r)//2
    if cnt(m)-cnt(p)+cnt(m+p) > k: r = m
    else: l = m

print(l)
0