結果

問題 No.2623 Room Allocation
ユーザー bluemeganebluemegane
提出日時 2024-02-10 11:08:17
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 1,022 bytes
コンパイル時間 14,007 ms
コンパイル使用メモリ 158,272 KB
実行使用メモリ 203,136 KB
最終ジャッジ日時 2024-02-10 11:08:46
合計ジャッジ時間 16,114 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
33,188 KB
testcase_01 AC 71 ms
33,188 KB
testcase_02 AC 70 ms
33,316 KB
testcase_03 AC 71 ms
33,188 KB
testcase_04 AC 72 ms
33,188 KB
testcase_05 AC 74 ms
33,316 KB
testcase_06 AC 188 ms
66,868 KB
testcase_07 AC 164 ms
66,852 KB
testcase_08 AC 182 ms
66,852 KB
testcase_09 AC 163 ms
66,852 KB
testcase_10 AC 179 ms
62,628 KB
testcase_11 AC 241 ms
62,628 KB
testcase_12 AC 157 ms
49,388 KB
testcase_13 AC 127 ms
49,388 KB
testcase_14 AC 322 ms
89,504 KB
testcase_15 AC 138 ms
56,996 KB
testcase_16 AC 89 ms
40,996 KB
testcase_17 AC 74 ms
33,572 KB
testcase_18 AC 141 ms
56,996 KB
testcase_19 AC 135 ms
56,996 KB
testcase_20 AC 135 ms
56,996 KB
testcase_21 AC 145 ms
56,996 KB
testcase_22 AC 146 ms
56,100 KB
testcase_23 AC 105 ms
46,372 KB
testcase_24 AC 137 ms
56,996 KB
testcase_25 AC 128 ms
56,996 KB
testcase_26 AC 82 ms
35,876 KB
testcase_27 AC 312 ms
77,080 KB
testcase_28 AC 201 ms
65,604 KB
testcase_29 AC 177 ms
58,868 KB
testcase_30 AC 274 ms
74,080 KB
testcase_31 AC 99 ms
39,716 KB
testcase_32 AC 177 ms
203,136 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (93 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System.Linq;
using System;

public class P
{
    public long a { get; set; }
    public long b { get; set; }
}

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var x = int.Parse(line[1]);
        var y = int.Parse(line[2]);
        getAns(n, x, y);
    }
    static void getAns(int n, int x, int y)
    {
        var m = x + y;
        var ps = new P[m];
        for (int i = 0; i < m; i++) ps[i] = new P { };
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var p = long.Parse(line[0]);
            var c = line[1];
            if (c == "A") ps[i % m].a += p;
            else ps[i % m].b += p;
        }
        ps = ps.OrderByDescending(z => z.a - z.b).ToArray();
        var ans = 0L;
        for (int i = 0; i < x; i++) ans += ps[i].a;
        for (int i = x; i < m; i++) ans += ps[i].b;
        Console.WriteLine(ans);
    }
}
0