結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,092 KB
testcase_01 AC 70 ms
71,248 KB
testcase_02 AC 70 ms
70,976 KB
testcase_03 WA -
testcase_04 AC 276 ms
167,712 KB
testcase_05 AC 302 ms
167,772 KB
testcase_06 AC 306 ms
167,796 KB
testcase_07 AC 259 ms
167,784 KB
testcase_08 AC 250 ms
167,744 KB
testcase_09 AC 253 ms
167,672 KB
testcase_10 AC 195 ms
167,396 KB
testcase_11 AC 201 ms
167,656 KB
testcase_12 AC 135 ms
102,884 KB
testcase_13 AC 185 ms
100,896 KB
testcase_14 AC 302 ms
168,012 KB
testcase_15 AC 142 ms
103,396 KB
testcase_16 AC 166 ms
100,744 KB
testcase_17 AC 247 ms
167,748 KB
testcase_18 AC 279 ms
167,960 KB
testcase_19 AC 232 ms
167,756 KB
testcase_20 AC 215 ms
167,748 KB
testcase_21 AC 216 ms
167,736 KB
testcase_22 AC 206 ms
167,636 KB
testcase_23 AC 202 ms
167,476 KB
testcase_24 AC 101 ms
101,672 KB
testcase_25 AC 112 ms
101,500 KB
testcase_26 WA -
testcase_27 AC 75 ms
71,180 KB
testcase_28 AC 68 ms
71,076 KB
testcase_29 AC 127 ms
153,712 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 = 0
right = P
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