結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー tentententen
提出日時 2023-08-04 19:02:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 887 ms / 2,000 ms
コード長 2,450 bytes
コンパイル時間 2,632 ms
コンパイル使用メモリ 84,040 KB
実行使用メモリ 67,580 KB
最終ジャッジ日時 2024-04-22 17:07:17
合計ジャッジ時間 24,938 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
37,260 KB
testcase_01 AC 54 ms
37,204 KB
testcase_02 AC 56 ms
37,076 KB
testcase_03 AC 54 ms
36,900 KB
testcase_04 AC 60 ms
37,196 KB
testcase_05 AC 53 ms
37,068 KB
testcase_06 AC 55 ms
37,228 KB
testcase_07 AC 56 ms
37,192 KB
testcase_08 AC 56 ms
37,300 KB
testcase_09 AC 56 ms
37,392 KB
testcase_10 AC 56 ms
37,260 KB
testcase_11 AC 71 ms
38,196 KB
testcase_12 AC 59 ms
37,168 KB
testcase_13 AC 71 ms
38,112 KB
testcase_14 AC 78 ms
38,348 KB
testcase_15 AC 64 ms
37,388 KB
testcase_16 AC 478 ms
54,120 KB
testcase_17 AC 748 ms
67,580 KB
testcase_18 AC 551 ms
57,684 KB
testcase_19 AC 389 ms
49,892 KB
testcase_20 AC 371 ms
48,936 KB
testcase_21 AC 784 ms
67,056 KB
testcase_22 AC 780 ms
64,696 KB
testcase_23 AC 749 ms
60,820 KB
testcase_24 AC 807 ms
64,648 KB
testcase_25 AC 749 ms
60,084 KB
testcase_26 AC 743 ms
64,680 KB
testcase_27 AC 749 ms
64,812 KB
testcase_28 AC 856 ms
60,048 KB
testcase_29 AC 756 ms
59,956 KB
testcase_30 AC 887 ms
64,988 KB
testcase_31 AC 804 ms
64,792 KB
testcase_32 AC 516 ms
64,956 KB
testcase_33 AC 596 ms
67,168 KB
testcase_34 AC 566 ms
64,256 KB
testcase_35 AC 544 ms
64,000 KB
testcase_36 AC 54 ms
36,916 KB
testcase_37 AC 54 ms
37,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    static final int MOD = 998244353;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int k = sc.nextInt();
        Thing[] things = new Thing[n];
        for (int i = 0; i < n; i++) {
            things[i] = new Thing(i, sc.nextInt());
        }
        for (int i = 0; i < n; i++) {
            things[i].value -= sc.nextInt();
        }
        Arrays.sort(things);
        char[] ans = new char[n];
        Arrays.fill(ans, 'B');
        for (int i = 0; i < k; i++) {
            ans[things[i].idx] = 'A';
        }
        System.out.println(ans);
    }
    
    static class Thing implements Comparable<Thing> {
        int idx;
        int value;
        
        public Thing(int idx, int value) {
            this.idx = idx;
            this.value = value;
        }
        
        public int compareTo(Thing another) {
            if (another.value == value) {
                return 0;
            } else if (another.value < value) {
                return -1;
            } else {
                return 1;
            }
        }
    }
} 
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0