結果
問題 | No.1597 Matrix Sort |
ユーザー | w0mbat |
提出日時 | 2021-07-09 22:12:13 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 817 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 87,192 KB |
実行使用メモリ | 100,644 KB |
最終ジャッジ日時 | 2023-09-14 09:23:56 |
合計ジャッジ時間 | 29,267 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,532 KB |
testcase_01 | AC | 74 ms
75,204 KB |
testcase_02 | AC | 73 ms
75,204 KB |
testcase_03 | WA | - |
testcase_04 | AC | 1,390 ms
97,192 KB |
testcase_05 | AC | 1,473 ms
97,644 KB |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | AC | 1,026 ms
97,780 KB |
testcase_09 | AC | 1,145 ms
97,852 KB |
testcase_10 | AC | 931 ms
97,028 KB |
testcase_11 | AC | 413 ms
96,540 KB |
testcase_12 | AC | 845 ms
99,080 KB |
testcase_13 | AC | 1,260 ms
96,316 KB |
testcase_14 | AC | 1,418 ms
97,900 KB |
testcase_15 | AC | 751 ms
99,952 KB |
testcase_16 | AC | 1,158 ms
96,320 KB |
testcase_17 | TLE | - |
testcase_18 | AC | 1,372 ms
97,372 KB |
testcase_19 | AC | 1,321 ms
97,388 KB |
testcase_20 | TLE | - |
testcase_21 | AC | 1,365 ms
97,576 KB |
testcase_22 | AC | 1,347 ms
96,924 KB |
testcase_23 | TLE | - |
testcase_24 | AC | 190 ms
100,584 KB |
testcase_25 | AC | 168 ms
100,644 KB |
testcase_26 | WA | - |
testcase_27 | AC | 72 ms
71,380 KB |
testcase_28 | AC | 71 ms
71,308 KB |
testcase_29 | AC | 79 ms
75,768 KB |
ソースコード
from bisect import bisect_left, bisect_right import sys def main(): input = sys.stdin.readline N, K, P = map(int, input().split()) *A, = map(int, input().split()) *B, = map(int, input().split()) A.sort() B.sort() # x以下の要素の数 def f(x): res = 0 for a in A: # Ai+Bj <= x if a + B[0] <= x: i = bisect_right(B, x - a) res += i # P <= Ai+Bi <= P+x if a + B[0] <= P + x: i = bisect_left(B, P - a) j = bisect_right(B, P + x - a) res += max(0, j - i) return res l = 0 r = P while r - l > 1: m = (l + r) // 2 if f(m) < K: l = m else: r = m print(r) if __name__ == '__main__': main()