結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー erbowl
提出日時 2022-08-20 10:21:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 696 bytes
コンパイル時間 2,430 ms
コンパイル使用メモリ 204,932 KB
最終ジャッジ日時 2025-01-31 01:58:23
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;

#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n,k;
    std::cin >> n>>k;
    vector<ll> a(n),b(n);
    vector<pair<ll,ll>> c(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
        c[i] = {a[i] - b[i],i};
    }
    sort(c.rbegin(),c.rend());
    vector<bool> change(n);
    for (int i = 0; i < k; i++) {
        change[c[i].second]=true;
    }
    for (int i = 0; i < n; i++) {
        if(change[i]){
            std::cout << "A";
        }else{
            std::cout << "B";
        }
    }
    std::cout << std::endl;
}
0