結果
問題 |
No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
|
ユーザー |
👑 ![]() |
提出日時 | 2024-04-18 02:47:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 76 ms / 2,000 ms |
コード長 | 807 bytes |
コンパイル時間 | 1,027 ms |
コンパイル使用メモリ | 82,064 KB |
最終ジャッジ日時 | 2025-02-21 02:57:28 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using i64 = long long; #define rep(i,n) for(int i=0; i<(n); i++) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int num_items; cin >> num_items; int num_choice_a; cin >> num_choice_a; vector<i64> value_a(num_items); for(auto& a : value_a) cin >> a; vector<i64> value_b(num_items); for(auto& a : value_b) cin >> a; vector<pair<i64,i64>> value_ids(num_items); for(int i=0; i<num_items; i++){ value_ids[i].first = value_a[i] - value_b[i]; value_ids[i].second = i; } string ans = string(num_items, 'B'); sort(value_ids.begin(), value_ids.end(), greater<pair<i64,i64>>()); for(int i=0; i<num_choice_a; i++) ans[value_ids[i].second] = 'A'; cout << ans << "\n"; return 0; }