結果

問題 No.1597 Matrix Sort
ユーザー PNJPNJ
提出日時 2023-11-24 07:34:23
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 427 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 103,640 KB
最終ジャッジ日時 2023-11-24 07:35:02
合計ジャッジ時間 36,279 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 58 ms
59,096 KB
testcase_02 AC 45 ms
59,116 KB
testcase_03 AC 1,491 ms
100,608 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 1,031 ms
102,632 KB
testcase_11 AC 1,052 ms
100,644 KB
testcase_12 AC 934 ms
103,300 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 1,016 ms
103,312 KB
testcase_16 AC 1,351 ms
103,388 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 AC 169 ms
100,752 KB
testcase_25 AC 157 ms
100,368 KB
testcase_26 AC 36 ms
53,460 KB
testcase_27 AC 36 ms
53,460 KB
testcase_28 AC 36 ms
53,460 KB
testcase_29 AC 45 ms
61,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N,K,P = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.sort()

l = -1
r = P - 1
while r - l > 1:
  m = (l + r) // 2
  res = 0
  for b in B:
    # a + b は 0 ~ 2*P - 1. m,m+P
    c = bisect.bisect_right(A,m-b)
    res += c
    c = bisect.bisect_right(A,m+P-b) - bisect.bisect_right(A,P-1-b)
    res += c
  if res < K:
    l = m
  else:
    r = m
print(r)
0