結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー ks2m
提出日時 2021-10-29 21:35:43
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,018 bytes
コンパイル時間 3,272 ms
コンパイル使用メモリ 81,176 KB
実行使用メモリ 92,284 KB
最終ジャッジ日時 2024-10-07 10:19:57
合計ジャッジ時間 21,348 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 23
権限があれば一括ダウンロードができます

ソースコード

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