結果
| 問題 |
No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-10-29 21:37:32 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 2,000 ms |
| コード長 | 980 bytes |
| コンパイル時間 | 3,384 ms |
| コンパイル使用メモリ | 121,976 KB |
| 最終ジャッジ日時 | 2025-01-25 08:36:04 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
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;
}
struct ios_do_not_sync {
ios_do_not_sync() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
} ios_do_not_sync_instance;
Nachia