結果

問題 No.1597 Matrix Sort
ユーザー googol_S0googol_S0
提出日時 2021-07-09 23:13:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 401 ms / 1,500 ms
コード長 457 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 102,280 KB
最終ジャッジ日時 2023-09-14 10:43:48
合計ジャッジ時間 9,708 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,384 KB
testcase_01 AC 76 ms
71,408 KB
testcase_02 AC 71 ms
71,404 KB
testcase_03 AC 354 ms
97,736 KB
testcase_04 AC 371 ms
97,828 KB
testcase_05 AC 388 ms
98,072 KB
testcase_06 AC 394 ms
97,912 KB
testcase_07 AC 401 ms
97,776 KB
testcase_08 AC 307 ms
97,872 KB
testcase_09 AC 328 ms
97,932 KB
testcase_10 AC 241 ms
100,764 KB
testcase_11 AC 180 ms
98,660 KB
testcase_12 AC 262 ms
100,552 KB
testcase_13 AC 345 ms
99,600 KB
testcase_14 AC 368 ms
97,896 KB
testcase_15 AC 233 ms
100,844 KB
testcase_16 AC 290 ms
99,496 KB
testcase_17 AC 313 ms
97,824 KB
testcase_18 AC 379 ms
98,108 KB
testcase_19 AC 322 ms
97,888 KB
testcase_20 AC 310 ms
97,936 KB
testcase_21 AC 301 ms
98,000 KB
testcase_22 AC 308 ms
98,600 KB
testcase_23 AC 288 ms
100,000 KB
testcase_24 AC 141 ms
102,280 KB
testcase_25 AC 121 ms
102,276 KB
testcase_26 AC 71 ms
71,516 KB
testcase_27 AC 72 ms
71,304 KB
testcase_28 AC 71 ms
71,368 KB
testcase_29 AC 73 ms
71,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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