結果

問題 No.1597 Matrix Sort
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-02-06 17:24:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 185,744 KB
最終ジャッジ日時 2023-09-02 07:02:20
合計ジャッジ時間 13,379 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,472 KB
testcase_01 AC 87 ms
71,428 KB
testcase_02 AC 88 ms
71,480 KB
testcase_03 AC 525 ms
183,980 KB
testcase_04 AC 539 ms
184,568 KB
testcase_05 AC 516 ms
185,068 KB
testcase_06 AC 509 ms
184,676 KB
testcase_07 WA -
testcase_08 AC 487 ms
185,420 KB
testcase_09 AC 492 ms
185,468 KB
testcase_10 AC 283 ms
167,868 KB
testcase_11 AC 288 ms
169,808 KB
testcase_12 AC 196 ms
102,824 KB
testcase_13 AC 246 ms
113,080 KB
testcase_14 AC 523 ms
185,744 KB
testcase_15 AC 194 ms
103,036 KB
testcase_16 AC 227 ms
101,020 KB
testcase_17 AC 400 ms
180,880 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 363 ms
169,140 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 137 ms
102,540 KB
testcase_26 AC 94 ms
71,712 KB
testcase_27 AC 92 ms
71,392 KB
testcase_28 AC 93 ms
71,568 KB
testcase_29 AC 236 ms
154,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,P = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.sort()
from collections import Counter
c = Counter(B)
F = [0]*(P+1)
for i in range(1,P):
    F[i+1] = F[i] + c[i]
def is_ok(x):
    tmp = 0
    for a in A:
        if 0<=x-a<=P-1:
            tmp += F[x-a+1] - F[0]
            
        if P-a <= P-1:
            tmp += F[min(P,P+x-a+1)] - F[P-a]
        
    return tmp >= K
            
            
y = 2*P
x = -1
while y-x>1:
    mid = (y+x)//2
    
    if is_ok(mid):
        y = mid
    else:
        x = mid
print(y)
        
    
0