結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー 👑 NachiaNachia
提出日時 2024-04-18 02:47:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 807 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 85,636 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2024-04-18 02:48:14
合計ジャッジ時間 9,414 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 42 ms
6,528 KB
testcase_17 AC 73 ms
9,344 KB
testcase_18 AC 53 ms
7,936 KB
testcase_19 AC 22 ms
5,376 KB
testcase_20 AC 25 ms
5,376 KB
testcase_21 AC 74 ms
9,672 KB
testcase_22 AC 72 ms
9,728 KB
testcase_23 AC 79 ms
9,728 KB
testcase_24 AC 68 ms
9,728 KB
testcase_25 AC 73 ms
9,856 KB
testcase_26 AC 69 ms
9,592 KB
testcase_27 AC 73 ms
9,644 KB
testcase_28 AC 68 ms
9,728 KB
testcase_29 AC 80 ms
9,728 KB
testcase_30 AC 70 ms
9,640 KB
testcase_31 AC 70 ms
9,728 KB
testcase_32 AC 76 ms
9,728 KB
testcase_33 AC 67 ms
9,640 KB
testcase_34 AC 82 ms
9,640 KB
testcase_35 AC 71 ms
9,856 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0