結果
| 問題 |
No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
|
| コンテスト | |
| ユーザー |
merlin
|
| 提出日時 | 2021-10-29 21:41:03 |
| 言語 | Java (openjdk 23) |
| 結果 |
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 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
ソースコード
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);
}
}
merlin