結果

問題 No.1597 Matrix Sort
ユーザー penguinmanpenguinman
提出日時 2021-05-05 02:17:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 168,364 KB
最終ジャッジ日時 2023-09-14 06:47:27
合計ジャッジ時間 7,634 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,212 KB
testcase_01 AC 70 ms
71,292 KB
testcase_02 AC 70 ms
71,080 KB
testcase_03 AC 272 ms
167,612 KB
testcase_04 AC 281 ms
167,536 KB
testcase_05 AC 323 ms
167,708 KB
testcase_06 AC 326 ms
167,940 KB
testcase_07 WA -
testcase_08 AC 266 ms
167,716 KB
testcase_09 AC 270 ms
167,848 KB
testcase_10 AC 189 ms
167,344 KB
testcase_11 AC 196 ms
167,780 KB
testcase_12 AC 131 ms
102,608 KB
testcase_13 AC 181 ms
100,864 KB
testcase_14 AC 305 ms
167,628 KB
testcase_15 AC 143 ms
103,036 KB
testcase_16 AC 166 ms
101,024 KB
testcase_17 AC 238 ms
167,800 KB
testcase_18 AC 289 ms
167,968 KB
testcase_19 AC 233 ms
168,044 KB
testcase_20 AC 215 ms
167,980 KB
testcase_21 AC 213 ms
167,692 KB
testcase_22 AC 212 ms
167,940 KB
testcase_23 AC 196 ms
167,412 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 71 ms
71,144 KB
testcase_27 AC 68 ms
71,216 KB
testcase_28 AC 69 ms
70,920 KB
testcase_29 AC 127 ms
153,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,P = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
imos = [0]*(P+1)
for i in range(N):
    imos[B[i]+1] += 1
for i in range(P):
    imos[i+1] += imos[i]
left = -1
right = P-2
while left+1 < right:
    mid = (left+right)//2
    cnt = 0
    for i in range(N):
        l = -A[i]
        r = mid-A[i]
        if r < 0:
            cnt += imos[r+P+1]-imos[l+P]
        else:
            cnt += imos[r+1]+imos[P]-imos[l+P]
    if cnt >= K:
        right = mid
    else:
        left = mid
print(right)
0