結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー merlinmerlin
提出日時 2021-10-29 21:41:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 651 ms / 2,000 ms
コード長 1,101 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 78,172 KB
実行使用メモリ 71,500 KB
最終ジャッジ日時 2024-10-07 10:31:33
合計ジャッジ時間 20,000 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
36,768 KB
testcase_01 AC 47 ms
36,572 KB
testcase_02 AC 47 ms
37,080 KB
testcase_03 AC 48 ms
36,708 KB
testcase_04 AC 47 ms
37,012 KB
testcase_05 AC 47 ms
36,804 KB
testcase_06 AC 48 ms
36,908 KB
testcase_07 AC 49 ms
36,512 KB
testcase_08 AC 48 ms
36,864 KB
testcase_09 AC 46 ms
37,040 KB
testcase_10 AC 47 ms
36,644 KB
testcase_11 AC 55 ms
37,336 KB
testcase_12 AC 51 ms
37,088 KB
testcase_13 AC 66 ms
37,460 KB
testcase_14 AC 61 ms
37,924 KB
testcase_15 AC 56 ms
37,020 KB
testcase_16 AC 514 ms
57,656 KB
testcase_17 AC 539 ms
70,440 KB
testcase_18 AC 493 ms
68,872 KB
testcase_19 AC 336 ms
53,780 KB
testcase_20 AC 335 ms
53,952 KB
testcase_21 AC 598 ms
71,500 KB
testcase_22 AC 511 ms
70,468 KB
testcase_23 AC 572 ms
70,512 KB
testcase_24 AC 563 ms
70,636 KB
testcase_25 AC 556 ms
70,568 KB
testcase_26 AC 604 ms
71,492 KB
testcase_27 AC 628 ms
71,412 KB
testcase_28 AC 546 ms
70,364 KB
testcase_29 AC 643 ms
71,404 KB
testcase_30 AC 562 ms
70,216 KB
testcase_31 AC 514 ms
70,308 KB
testcase_32 AC 651 ms
70,600 KB
testcase_33 AC 564 ms
70,364 KB
testcase_34 AC 571 ms
70,744 KB
testcase_35 AC 557 ms
70,712 KB
testcase_36 AC 46 ms
36,716 KB
testcase_37 AC 47 ms
36,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        String s[]=bu.readLine().split(" ");
        int n=Integer.parseInt(s[0]),k=Integer.parseInt(s[1]);
        int i,a[]=new int[n],b[]=new int[n];

        s=bu.readLine().split(" ");
        for(i=0;i<n;i++) a[i]=Integer.parseInt(s[i]);
        PriorityQueue<int[]> pq=new PriorityQueue<>(new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                if(o1[0]<o2[0]) return 1;
                else return -1;
            }});
        s=bu.readLine().split(" ");
        for(i=0;i<n;i++)
        {
            b[i]=Integer.parseInt(s[i]);
            pq.add(new int[]{a[i]-b[i],i});
        }

        int ans[]=new int[n];
        while(k-->0) ans[pq.poll()[1]]=1;
        for(i=0;i<n;i++)
        if(ans[i]==0) sb.append("B");
        else sb.append("A");
        System.out.println(sb);
    }
}
0