結果

問題 No.2094 Symmetry
ユーザー 👑 kakel-sankakel-san
提出日時 2022-10-07 21:50:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 1,431 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 68,104 KB
実行使用メモリ 40,140 KB
最終ジャッジ日時 2023-09-03 01:29:16
合計ジャッジ時間 11,278 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,836 KB
testcase_01 AC 65 ms
23,884 KB
testcase_02 AC 63 ms
21,800 KB
testcase_03 AC 63 ms
23,988 KB
testcase_04 AC 62 ms
21,856 KB
testcase_05 AC 62 ms
21,840 KB
testcase_06 AC 62 ms
21,848 KB
testcase_07 AC 63 ms
21,840 KB
testcase_08 AC 65 ms
21,868 KB
testcase_09 AC 265 ms
38,864 KB
testcase_10 AC 268 ms
36,988 KB
testcase_11 AC 267 ms
34,912 KB
testcase_12 AC 268 ms
38,940 KB
testcase_13 AC 266 ms
36,820 KB
testcase_14 AC 265 ms
39,048 KB
testcase_15 AC 265 ms
38,988 KB
testcase_16 AC 264 ms
36,988 KB
testcase_17 AC 263 ms
37,064 KB
testcase_18 AC 263 ms
37,076 KB
testcase_19 AC 264 ms
36,864 KB
testcase_20 AC 264 ms
38,832 KB
testcase_21 AC 266 ms
37,016 KB
testcase_22 AC 264 ms
36,960 KB
testcase_23 AC 262 ms
36,892 KB
testcase_24 AC 271 ms
38,868 KB
testcase_25 AC 263 ms
36,936 KB
testcase_26 AC 264 ms
38,992 KB
testcase_27 AC 64 ms
21,880 KB
testcase_28 AC 224 ms
37,448 KB
testcase_29 AC 62 ms
23,760 KB
testcase_30 AC 225 ms
36,016 KB
testcase_31 AC 223 ms
39,572 KB
testcase_32 AC 229 ms
40,140 KB
testcase_33 AC 63 ms
23,848 KB
testcase_34 AC 194 ms
28,580 KB
testcase_35 AC 183 ms
28,608 KB
testcase_36 AC 185 ms
30,656 KB
権限があれば一括ダウンロードができます

ソースコード

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(int n) => Enumerable.Repeat(0, n).Select(_ => ReadLine()).ToArray();
    static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, k) = ((int)c[0], c[1]);
        n <<= 1;
        var b = 0;
        for (var i = 0; i < n; ++i)
        {
            b += ReadLine().Count(s => s == '#');
        }
        var clist = new long[n * n];
        var slist = new long[n * n / 2];
        for (var i = 0; i < n; ++i)
        {
            c = NList;
            for (var j = 0; j < n; ++j)
            {
                clist[i * n + j] = c[j];
                if (j < n / 2) slist[i * n / 2 + j] += c[j];
                else slist[i * n / 2 + n - j - 1] += c[j];
            }
        }
        Array.Sort(clist, (l, r) => r.CompareTo(l));
        Array.Sort(slist, (l, r) => r.CompareTo(l));
        var res = 0L;
        for (var i = 0; i < b; ++i) res += clist[i];
        if (b % 2 == 0)
        {
            var sub = k;
            for (var i = 0; i < b / 2; ++i) sub += slist[i];
            res = Math.Max(res, sub);
        }
        WriteLine(res);
    }
}
0