結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー kokatsukokatsu
提出日時 2021-10-29 21:59:45
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 2,603 ms
コンパイル使用メモリ 208,984 KB
実行使用メモリ 20,808 KB
最終ジャッジ日時 2023-09-04 14:44:41
合計ジャッジ時間 16,748 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 74 ms
14,256 KB
testcase_17 AC 134 ms
18,716 KB
testcase_18 AC 105 ms
20,808 KB
testcase_19 AC 41 ms
11,752 KB
testcase_20 AC 46 ms
10,840 KB
testcase_21 AC 142 ms
19,624 KB
testcase_22 AC 142 ms
19,588 KB
testcase_23 AC 143 ms
19,488 KB
testcase_24 AC 142 ms
19,572 KB
testcase_25 AC 143 ms
19,644 KB
testcase_26 AC 140 ms
19,588 KB
testcase_27 AC 141 ms
19,464 KB
testcase_28 AC 142 ms
19,552 KB
testcase_29 AC 142 ms
19,596 KB
testcase_30 AC 141 ms
19,664 KB
testcase_31 AC 143 ms
19,572 KB
testcase_32 AC 125 ms
19,644 KB
testcase_33 AC 127 ms
19,676 KB
testcase_34 AC 125 ms
19,528 KB
testcase_35 AC 127 ms
19,724 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

struct Cosmetic {
    long num;
    long a;
    long b;
}

void main() {
    int N, K;
    readf("%d %d\n", N, K);

    auto A = readln.chomp.split.to!(long[]);
    auto B = readln.chomp.split.to!(long[]);

    auto C = new Cosmetic[](N);
    foreach (i; 0 .. N) {
        C[i] = Cosmetic(i, A[i], B[i]);
    }

    C.sort!"a.a - a.b > b.a - b.b";

    auto S = new dchar[](N);
    foreach (i; 0 .. N) {
        if (i < K) {
            S[C[i].num] = 'A';
        }
        else {
            S[C[i].num] = 'B';
        }
    }

    S.writeln;
}
0