結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー ks2mks2m
提出日時 2021-10-29 21:35:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,018 bytes
コンパイル時間 2,588 ms
コンパイル使用メモリ 83,540 KB
実行使用メモリ 80,908 KB
最終ジャッジ日時 2024-04-16 14:19:00
合計ジャッジ時間 22,477 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
37,444 KB
testcase_01 AC 65 ms
37,440 KB
testcase_02 AC 59 ms
37,324 KB
testcase_03 AC 61 ms
37,080 KB
testcase_04 AC 62 ms
37,352 KB
testcase_05 AC 62 ms
37,448 KB
testcase_06 AC 60 ms
37,500 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 62 ms
37,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 555 ms
80,428 KB
testcase_32 AC 644 ms
80,468 KB
testcase_33 AC 660 ms
80,208 KB
testcase_34 AC 632 ms
80,404 KB
testcase_35 AC 664 ms
79,992 KB
testcase_36 AC 61 ms
37,316 KB
testcase_37 AC 60 ms
37,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int k = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.i = i;
			o.a = Integer.parseInt(sa[i]);
			arr[i] = o;
		}
		PriorityQueue<Obj> que = new PriorityQueue<>((o1, o2) -> o2.v - o1.v);
		sa = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			Obj o = arr[i];
			o.b = Integer.parseInt(sa[i]);
			o.v = o.a - o.b;
			que.add(o);
		}
		br.close();

		char[] ans = new char[n];
		Arrays.fill(ans, 'B');
		for (int i = 0; i < k; i++) {
			Obj o = que.poll();
			ans[o.i] = 'A';
		}
		System.out.println(ans);
	}

	static class Obj {
		int i, a, b, v;
	}
}
0