結果

問題 No.2094 Symmetry
ユーザー 👑 KazunKazun
提出日時 2022-10-07 21:36:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 108,124 KB
最終ジャッジ日時 2023-09-03 00:43:41
合計ジャッジ時間 7,960 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,160 KB
testcase_01 AC 71 ms
71,476 KB
testcase_02 AC 72 ms
71,372 KB
testcase_03 AC 73 ms
71,468 KB
testcase_04 AC 74 ms
71,412 KB
testcase_05 AC 73 ms
71,508 KB
testcase_06 AC 73 ms
71,428 KB
testcase_07 AC 72 ms
71,372 KB
testcase_08 AC 73 ms
71,380 KB
testcase_09 AC 214 ms
107,272 KB
testcase_10 AC 212 ms
107,040 KB
testcase_11 AC 212 ms
108,072 KB
testcase_12 AC 212 ms
107,656 KB
testcase_13 AC 181 ms
98,176 KB
testcase_14 AC 211 ms
107,816 KB
testcase_15 AC 210 ms
107,720 KB
testcase_16 AC 210 ms
107,336 KB
testcase_17 AC 178 ms
98,004 KB
testcase_18 AC 179 ms
97,988 KB
testcase_19 AC 212 ms
107,728 KB
testcase_20 AC 212 ms
107,740 KB
testcase_21 AC 213 ms
108,124 KB
testcase_22 AC 211 ms
106,880 KB
testcase_23 AC 180 ms
98,220 KB
testcase_24 AC 184 ms
98,276 KB
testcase_25 AC 210 ms
107,712 KB
testcase_26 AC 208 ms
107,364 KB
testcase_27 AC 72 ms
71,556 KB
testcase_28 AC 145 ms
103,304 KB
testcase_29 AC 73 ms
71,496 KB
testcase_30 AC 142 ms
103,216 KB
testcase_31 AC 146 ms
106,272 KB
testcase_32 AC 147 ms
106,216 KB
testcase_33 AC 72 ms
71,428 KB
testcase_34 AC 141 ms
105,364 KB
testcase_35 AC 141 ms
105,516 KB
testcase_36 AC 134 ms
97,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N,K=map(int,input().split())

    M=0
    for _ in range(2*N):
        M+=input().count("#")

    C=[]
    for _ in range(2*N):
        C.append(list(map(int,input().split())))

    # Type 1
    X=[]
    for i in range(2*N):
        X.extend(C[i])
    X.sort(reverse=True)
    alpha=sum(X[:M])

    # Type 2
    if M%2==0:
        Y=[]
        for i in range(2*N):
            Ci=C[i]
            for j in range(N):
                Y.append(Ci[j]+Ci[(2*N-1)-j])
        Y.sort(reverse=True)
        beta=sum(Y[:M//2])+K
    else:
        beta=-float("inf")

    return max(alpha, beta)
#==================================================
print(solve())
0