結果

問題 No.2623 Room Allocation
ユーザー 👑 kakel-sankakel-san
提出日時 2024-02-09 22:40:38
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 1,133 bytes
コンパイル時間 6,813 ms
コンパイル使用メモリ 157,852 KB
実行使用メモリ 186,064 KB
最終ジャッジ日時 2024-02-09 22:40:52
合計ジャッジ時間 11,550 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
32,804 KB
testcase_01 AC 66 ms
32,804 KB
testcase_02 AC 67 ms
32,804 KB
testcase_03 AC 65 ms
32,804 KB
testcase_04 AC 64 ms
32,804 KB
testcase_05 AC 67 ms
32,804 KB
testcase_06 AC 143 ms
65,844 KB
testcase_07 AC 147 ms
65,844 KB
testcase_08 AC 167 ms
65,848 KB
testcase_09 AC 145 ms
65,844 KB
testcase_10 AC 148 ms
39,264 KB
testcase_11 AC 154 ms
39,264 KB
testcase_12 AC 108 ms
36,192 KB
testcase_13 AC 108 ms
36,192 KB
testcase_14 AC 224 ms
72,452 KB
testcase_15 AC 142 ms
62,896 KB
testcase_16 AC 101 ms
40,996 KB
testcase_17 AC 68 ms
33,060 KB
testcase_18 AC 141 ms
62,896 KB
testcase_19 AC 135 ms
62,796 KB
testcase_20 AC 137 ms
62,868 KB
testcase_21 AC 139 ms
62,900 KB
testcase_22 AC 116 ms
56,868 KB
testcase_23 AC 95 ms
46,628 KB
testcase_24 AC 140 ms
62,900 KB
testcase_25 AC 155 ms
62,600 KB
testcase_26 AC 74 ms
35,492 KB
testcase_27 AC 229 ms
70,916 KB
testcase_28 AC 147 ms
47,780 KB
testcase_29 AC 141 ms
41,764 KB
testcase_30 AC 217 ms
70,152 KB
testcase_31 AC 87 ms
35,620 KB
testcase_32 AC 146 ms
186,064 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (96 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;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, x, y) = (c[0], c[1], c[2]);
        var query = SList(n);
        var arr = new Pair[x + y];
        for (var i = 0; i < n; ++i)
        {
            var s = query[i].Split();
            var p = int.Parse(s[0]);
            if (s[1] == "A") arr[i % (x + y)].A += p;
            else arr[i % (x + y)].B += p;
        }
        Array.Sort(arr, (l, r) => (l.B - l.A).CompareTo(r.B - r.A));
        var ans = 0L;
        for (var i = 0; i < x; ++i) ans += arr[i].A;
        for (var i = x; i < arr.Length; ++i) ans += arr[i].B;
        WriteLine(ans);
    }
    struct Pair
    {
        public long A;
        public long B;
    }
}
0