結果

問題 No.1597 Matrix Sort
ユーザー googol_S0googol_S0
提出日時 2021-07-09 22:01:24
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 408 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 102,108 KB
最終ジャッジ日時 2023-09-14 09:04:54
合計ジャッジ時間 31,492 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,416 KB
testcase_01 AC 75 ms
75,304 KB
testcase_02 AC 68 ms
75,376 KB
testcase_03 AC 1,283 ms
97,796 KB
testcase_04 AC 1,337 ms
97,860 KB
testcase_05 AC 1,460 ms
98,688 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,099 ms
97,768 KB
testcase_09 TLE -
testcase_10 AC 1,164 ms
100,680 KB
testcase_11 AC 991 ms
98,676 KB
testcase_12 AC 884 ms
100,596 KB
testcase_13 AC 1,230 ms
99,888 KB
testcase_14 TLE -
testcase_15 AC 901 ms
100,836 KB
testcase_16 AC 1,222 ms
99,572 KB
testcase_17 TLE -
testcase_18 AC 1,387 ms
98,292 KB
testcase_19 AC 1,362 ms
97,820 KB
testcase_20 TLE -
testcase_21 AC 1,378 ms
98,724 KB
testcase_22 AC 1,376 ms
99,236 KB
testcase_23 TLE -
testcase_24 AC 219 ms
102,108 KB
testcase_25 AC 211 ms
101,824 KB
testcase_26 AC 70 ms
71,436 KB
testcase_27 AC 70 ms
71,352 KB
testcase_28 AC 69 ms
71,336 KB
testcase_29 AC 77 ms
75,604 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