結果

問題 No.1597 Matrix Sort
ユーザー googol_S0googol_S0
提出日時 2021-07-09 22:01:24
言語 PyPy3
(7.3.8)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 408 bytes
コンパイル時間 274 ms
使用メモリ 105,992 KB
最終ジャッジ日時 2023-02-01 23:30:51
合計ジャッジ時間 29,840 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 87 ms
75,732 KB
testcase_01 AC 91 ms
80,056 KB
testcase_02 AC 89 ms
80,008 KB
testcase_03 AC 1,244 ms
98,780 KB
testcase_04 AC 1,330 ms
98,456 KB
testcase_05 AC 1,474 ms
98,824 KB
testcase_06 AC 1,450 ms
98,692 KB
testcase_07 TLE -
testcase_08 AC 1,077 ms
99,052 KB
testcase_09 TLE -
testcase_10 AC 1,060 ms
102,524 KB
testcase_11 AC 884 ms
99,968 KB
testcase_12 AC 817 ms
99,720 KB
testcase_13 AC 1,143 ms
98,612 KB
testcase_14 AC 1,451 ms
99,260 KB
testcase_15 AC 784 ms
99,644 KB
testcase_16 AC 1,098 ms
98,236 KB
testcase_17 AC 1,495 ms
99,288 KB
testcase_18 AC 1,305 ms
98,700 KB
testcase_19 AC 1,259 ms
98,456 KB
testcase_20 AC 1,471 ms
99,036 KB
testcase_21 AC 1,292 ms
98,716 KB
testcase_22 AC 1,260 ms
98,604 KB
testcase_23 TLE -
testcase_24 AC 228 ms
101,620 KB
testcase_25 AC 220 ms
105,992 KB
testcase_26 AC 84 ms
75,788 KB
testcase_27 AC 86 ms
75,676 KB
testcase_28 AC 84 ms
75,740 KB
testcase_29 AC 93 ms
80,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *
N,K,P=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
B=list(map(int,input().split()))
B.sort()
L,R=0,P
while L<R:
  M=(L+R)>>1
  C=0
  for i in range(N):
    if M>=A[i]:
      C+=bisect_right(B,M-A[i])+bisect_right(B,P+M-A[i])-bisect_left(B,P-A[i])
    else:
      C+=bisect_right(B,P+M-A[i])-bisect_left(B,P-A[i])
  if C>=K:
    R=M
  else:
    L=max(L+1,M)
print(L)
0