結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー mahiro72mahiro72
提出日時 2021-10-29 22:12:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 421 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 135,984 KB
最終ジャッジ日時 2024-10-07 11:35:09
合計ジャッジ時間 13,143 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
use = [True]*N
C = []

for i,(a,b) in enumerate(zip(A,B)):
    heapq.heappush(C,(-(b-a),i))

for i in range(N-K):
    value,index = heapq.heappop(C)
    use[index]=False

ans = ''.join(list(map(lambda x:'A'if x else 'B',use)))
print(ans)
0