結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー tnakao0123tnakao0123
提出日時 2021-10-30 16:19:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 842 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 54,608 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-04-16 16:24:07
合計ジャッジ時間 7,935 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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 2 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 2 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 40 ms
5,376 KB
testcase_17 AC 72 ms
6,912 KB
testcase_18 AC 55 ms
6,144 KB
testcase_19 AC 23 ms
5,376 KB
testcase_20 AC 26 ms
5,376 KB
testcase_21 AC 76 ms
7,168 KB
testcase_22 AC 76 ms
6,912 KB
testcase_23 AC 77 ms
7,168 KB
testcase_24 AC 76 ms
7,004 KB
testcase_25 AC 76 ms
6,944 KB
testcase_26 AC 77 ms
7,040 KB
testcase_27 AC 76 ms
6,912 KB
testcase_28 AC 77 ms
7,040 KB
testcase_29 AC 76 ms
6,912 KB
testcase_30 AC 76 ms
6,912 KB
testcase_31 AC 76 ms
6,912 KB
testcase_32 AC 79 ms
6,940 KB
testcase_33 AC 77 ms
7,040 KB
testcase_34 AC 79 ms
7,040 KB
testcase_35 AC 79 ms
7,040 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1724.cc:  No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia - yukicoder
 */

#include<cstdio>
#include<algorithm>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

int as[MAX_N], bs[MAX_N];
pii ps[MAX_N];
char s[MAX_N + 4];

/* subroutines */

/* main */

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", as + i);
  for (int i = 0; i < n; i++) scanf("%d", bs + i);

  for (int i = 0; i < n; i++) ps[i] = pii(as[i] - bs[i], i);
  sort(ps, ps + n, greater<pii>());
  //for (int i = 0; i < n; i++) printf("%d,%d ", ps[i].first, ps[i].second);
  //putchar('\n');

  fill(s, s + n, 'B');
  for (int i = 0; i < k; i++) s[ps[i].second] = 'A';

  puts(s);
  return 0;
}
0