結果
問題 |
No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
|
ユーザー |
![]() |
提出日時 | 2021-10-30 16:19:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 842 bytes |
コンパイル時間 | 598 ms |
コンパイル使用メモリ | 53,316 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 13:45:44 |
合計ジャッジ時間 | 8,548 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
ソースコード
/* -*- 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; }