結果

問題 No.1597 Matrix Sort
ユーザー mkawa2mkawa2
提出日時 2021-07-09 22:08:38
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 348 ms / 1,500 ms
コード長 994 bytes
コンパイル時間 580 ms
使用メモリ 105,764 KB
最終ジャッジ日時 2023-02-01 23:44:02
合計ジャッジ時間 8,938 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 79 ms
75,512 KB
testcase_01 AC 79 ms
75,468 KB
testcase_02 AC 79 ms
75,688 KB
testcase_03 AC 315 ms
99,368 KB
testcase_04 AC 324 ms
99,536 KB
testcase_05 AC 348 ms
99,588 KB
testcase_06 AC 340 ms
99,096 KB
testcase_07 AC 346 ms
99,376 KB
testcase_08 AC 288 ms
99,400 KB
testcase_09 AC 294 ms
99,068 KB
testcase_10 AC 139 ms
102,628 KB
testcase_11 AC 156 ms
99,300 KB
testcase_12 AC 218 ms
103,392 KB
testcase_13 AC 284 ms
101,060 KB
testcase_14 AC 310 ms
99,116 KB
testcase_15 AC 209 ms
103,704 KB
testcase_16 AC 256 ms
101,108 KB
testcase_17 AC 270 ms
99,348 KB
testcase_18 AC 321 ms
99,484 KB
testcase_19 AC 277 ms
99,104 KB
testcase_20 AC 275 ms
99,104 KB
testcase_21 AC 266 ms
99,528 KB
testcase_22 AC 265 ms
99,668 KB
testcase_23 AC 179 ms
101,680 KB
testcase_24 AC 126 ms
105,308 KB
testcase_25 AC 116 ms
105,764 KB
testcase_26 AC 78 ms
75,464 KB
testcase_27 AC 79 ms
75,704 KB
testcase_28 AC 78 ms
75,776 KB
testcase_29 AC 82 ms
80,136 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