結果

問題 No.1345 Beautiful BINGO
ユーザー googol_S0googol_S0
提出日時 2021-01-16 13:46:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,406 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 78,316 KB
最終ジャッジ日時 2024-05-06 06:53:25
合計ジャッジ時間 25,993 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,608 KB
testcase_01 AC 38 ms
52,864 KB
testcase_02 AC 40 ms
53,248 KB
testcase_03 AC 37 ms
52,992 KB
testcase_04 AC 38 ms
52,736 KB
testcase_05 AC 60 ms
68,096 KB
testcase_06 AC 36 ms
52,352 KB
testcase_07 AC 100 ms
76,952 KB
testcase_08 AC 38 ms
52,352 KB
testcase_09 AC 38 ms
52,224 KB
testcase_10 AC 49 ms
61,056 KB
testcase_11 AC 50 ms
62,720 KB
testcase_12 AC 40 ms
52,352 KB
testcase_13 AC 101 ms
76,712 KB
testcase_14 AC 40 ms
52,480 KB
testcase_15 AC 37 ms
51,968 KB
testcase_16 AC 48 ms
61,312 KB
testcase_17 AC 40 ms
53,248 KB
testcase_18 AC 38 ms
52,096 KB
testcase_19 AC 39 ms
53,504 KB
testcase_20 AC 38 ms
52,096 KB
testcase_21 AC 39 ms
52,480 KB
testcase_22 AC 67 ms
76,012 KB
testcase_23 AC 197 ms
75,564 KB
testcase_24 AC 181 ms
76,944 KB
testcase_25 AC 142 ms
77,440 KB
testcase_26 AC 408 ms
77,144 KB
testcase_27 AC 1,369 ms
77,872 KB
testcase_28 AC 100 ms
76,800 KB
testcase_29 AC 373 ms
76,852 KB
testcase_30 AC 88 ms
76,288 KB
testcase_31 AC 121 ms
77,048 KB
testcase_32 AC 122 ms
77,184 KB
testcase_33 AC 1,378 ms
77,872 KB
testcase_34 AC 65 ms
73,956 KB
testcase_35 AC 78 ms
76,160 KB
testcase_36 AC 1,365 ms
78,080 KB
testcase_37 AC 115 ms
77,056 KB
testcase_38 AC 394 ms
77,696 KB
testcase_39 AC 1,381 ms
77,916 KB
testcase_40 AC 716 ms
77,304 KB
testcase_41 AC 742 ms
77,568 KB
testcase_42 AC 38 ms
52,352 KB
testcase_43 AC 39 ms
52,480 KB
testcase_44 AC 40 ms
52,992 KB
testcase_45 AC 39 ms
53,376 KB
testcase_46 AC 37 ms
52,096 KB
testcase_47 AC 37 ms
52,352 KB
testcase_48 AC 38 ms
52,096 KB
testcase_49 AC 37 ms
52,352 KB
testcase_50 AC 37 ms
52,224 KB
testcase_51 AC 38 ms
52,480 KB
testcase_52 AC 1,360 ms
77,824 KB
testcase_53 AC 1,346 ms
77,788 KB
testcase_54 AC 448 ms
77,440 KB
testcase_55 AC 778 ms
77,824 KB
testcase_56 AC 1,374 ms
77,696 KB
testcase_57 AC 1,376 ms
77,864 KB
testcase_58 AC 1,406 ms
78,208 KB
testcase_59 AC 1,396 ms
78,004 KB
testcase_60 AC 1,382 ms
78,316 KB
testcase_61 AC 976 ms
77,568 KB
testcase_62 AC 1,395 ms
77,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
P=10**18
for x in range(4):
  for y in range(1<<N):
    C=bin(x).count('1')+bin(y).count('1')
    C=M-C
    if C>N:
      continue
    B=[A[i][:] for i in range(N)]
    Q=0
    if x&1:
      for j in range(N):
        Q+=B[j][j]
        B[j][j]=0
    if x&2:
      for j in range(N):
        Q+=B[j][N-1-j]
        B[j][N-1-j]=0
    for i in range(N):
      if y&(1<<i):
        for j in range(N):
          Q+=B[j][i]
          B[j][i]=0
    z=sorted([sum(B[i]) for i in range(N)])
    for i in range(C):
      Q+=z[i]
    P=min(Q,P)
print(P)
0