結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー bluemegane
提出日時 2021-10-30 09:21:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 308 ms / 2,000 ms
コード長 855 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 114,648 KB
実行使用メモリ 72,292 KB
最終ジャッジ日時 2024-10-07 13:29:50
合計ジャッジ時間 13,883 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System;

public class P
{
    public int amb { get; set; }
    public int id { get; set; }
}

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        string[] line2 = Console.ReadLine().Trim().Split(' ');
        var ps = new P[n];
        for (int i = 0; i < n; i++)
            ps[i] = new P { id = i, amb = int.Parse(line[i]) - int.Parse(line2[i]) };
        getAns(n, k, ps);
    }
    static void getAns(int n, int k, P[] ps)
    {
        var ans = Enumerable.Repeat('B', n).ToArray();
        foreach (var x in ps.OrderByDescending(x => x.amb).Take(k))
            ans[x.id] = 'A';
        Console.WriteLine(new string(ans));
    }
}
0