結果

問題 No.1345 Beautiful BINGO
ユーザー chineristACchineristAC
提出日時 2021-01-16 13:16:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 784 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 86,340 KB
最終ジャッジ日時 2024-05-05 15:14:08
合計ジャッジ時間 32,586 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
58,240 KB
testcase_01 AC 41 ms
58,240 KB
testcase_02 AC 43 ms
59,520 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 38 ms
53,120 KB
testcase_05 AC 68 ms
72,832 KB
testcase_06 AC 38 ms
52,352 KB
testcase_07 AC 102 ms
76,520 KB
testcase_08 AC 37 ms
51,968 KB
testcase_09 AC 38 ms
52,480 KB
testcase_10 AC 58 ms
67,200 KB
testcase_11 AC 66 ms
71,808 KB
testcase_12 AC 37 ms
52,900 KB
testcase_13 AC 100 ms
77,028 KB
testcase_14 AC 54 ms
65,664 KB
testcase_15 AC 37 ms
52,352 KB
testcase_16 AC 52 ms
64,384 KB
testcase_17 AC 41 ms
57,856 KB
testcase_18 AC 36 ms
52,352 KB
testcase_19 AC 42 ms
58,496 KB
testcase_20 AC 37 ms
52,096 KB
testcase_21 AC 41 ms
58,240 KB
testcase_22 AC 227 ms
77,596 KB
testcase_23 TLE -
testcase_24 AC 1,185 ms
77,792 KB
testcase_25 AC 170 ms
76,884 KB
testcase_26 AC 755 ms
77,872 KB
testcase_27 TLE -
testcase_28 AC 176 ms
76,928 KB
testcase_29 AC 774 ms
77,556 KB
testcase_30 AC 347 ms
77,196 KB
testcase_31 AC 216 ms
77,048 KB
testcase_32 AC 120 ms
77,124 KB
testcase_33 TLE -
testcase_34 AC 151 ms
77,380 KB
testcase_35 AC 150 ms
77,568 KB
testcase_36 TLE -
testcase_37 AC 141 ms
77,564 KB
testcase_38 AC 786 ms
77,820 KB
testcase_39 TLE -
testcase_40 AC 1,176 ms
77,948 KB
testcase_41 AC 1,209 ms
78,876 KB
testcase_42 AC 37 ms
52,480 KB
testcase_43 AC 36 ms
52,352 KB
testcase_44 AC 42 ms
59,648 KB
testcase_45 AC 42 ms
58,496 KB
testcase_46 AC 37 ms
52,352 KB
testcase_47 AC 38 ms
52,352 KB
testcase_48 AC 38 ms
52,864 KB
testcase_49 AC 37 ms
51,968 KB
testcase_50 AC 37 ms
52,608 KB
testcase_51 AC 41 ms
58,496 KB
testcase_52 TLE -
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 TLE -
testcase_57 TLE -
testcase_58 TLE -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = [list(map(int,input().split())) for i in range(N)]

res = 10**18
for i in range(2**(N+2)):
    tmp_A = [[A[j][k] for k in range(N)] for j in range(N)]
    cost = 0
    cnt = M
    for j in range(N):
        if i>>j & 1:
            for k in range(N):
                cost += tmp_A[j][k]
                tmp_A[j][k] = 0
            cnt -= 1
    if i>>(N) & 1:
        for k in range(N):
            cost += tmp_A[k][k]
            tmp_A[k][k] = 0
        cnt -= 1
    if i>>(N+1) & 1:
        for k in range(N):
            cost += tmp_A[N-1-k][k]
            tmp_A[N-1-k][k] = 0
        cnt -= 1

    column = [sum(tmp_A[k][j] for k in range(N)) for j in range(N)]
    column.sort()
    cost += sum(column[:cnt])
    res = min(res,cost)

print(res)
0