結果

問題 No.1345 Beautiful BINGO
ユーザー googol_S0googol_S0
提出日時 2021-01-16 13:46:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,279 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 79,984 KB
最終ジャッジ日時 2023-08-19 00:00:22
合計ジャッジ時間 25,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,224 KB
testcase_01 AC 61 ms
71,356 KB
testcase_02 AC 67 ms
71,360 KB
testcase_03 AC 63 ms
71,256 KB
testcase_04 AC 61 ms
71,368 KB
testcase_05 AC 113 ms
76,852 KB
testcase_06 AC 60 ms
71,424 KB
testcase_07 AC 111 ms
77,872 KB
testcase_08 AC 59 ms
71,256 KB
testcase_09 AC 60 ms
71,224 KB
testcase_10 AC 68 ms
75,864 KB
testcase_11 AC 71 ms
76,668 KB
testcase_12 AC 61 ms
71,424 KB
testcase_13 AC 111 ms
77,864 KB
testcase_14 AC 60 ms
71,420 KB
testcase_15 AC 60 ms
71,428 KB
testcase_16 AC 68 ms
75,996 KB
testcase_17 AC 60 ms
71,608 KB
testcase_18 AC 60 ms
71,224 KB
testcase_19 AC 61 ms
71,332 KB
testcase_20 AC 59 ms
71,292 KB
testcase_21 AC 59 ms
71,248 KB
testcase_22 AC 82 ms
76,908 KB
testcase_23 AC 194 ms
76,884 KB
testcase_24 AC 183 ms
78,516 KB
testcase_25 AC 155 ms
78,744 KB
testcase_26 AC 380 ms
78,820 KB
testcase_27 AC 1,227 ms
79,604 KB
testcase_28 AC 118 ms
78,052 KB
testcase_29 AC 354 ms
78,664 KB
testcase_30 AC 104 ms
77,264 KB
testcase_31 AC 141 ms
78,528 KB
testcase_32 AC 144 ms
78,520 KB
testcase_33 AC 1,208 ms
79,656 KB
testcase_34 AC 84 ms
77,732 KB
testcase_35 AC 94 ms
77,788 KB
testcase_36 AC 1,185 ms
79,636 KB
testcase_37 AC 127 ms
78,660 KB
testcase_38 AC 367 ms
78,724 KB
testcase_39 AC 1,216 ms
79,000 KB
testcase_40 AC 623 ms
79,076 KB
testcase_41 AC 665 ms
78,744 KB
testcase_42 AC 62 ms
71,236 KB
testcase_43 AC 63 ms
71,100 KB
testcase_44 AC 65 ms
71,200 KB
testcase_45 AC 64 ms
71,296 KB
testcase_46 AC 64 ms
71,248 KB
testcase_47 AC 61 ms
71,292 KB
testcase_48 AC 60 ms
71,616 KB
testcase_49 AC 63 ms
71,440 KB
testcase_50 AC 61 ms
71,204 KB
testcase_51 AC 61 ms
71,360 KB
testcase_52 AC 1,218 ms
79,792 KB
testcase_53 AC 1,239 ms
79,260 KB
testcase_54 AC 459 ms
78,752 KB
testcase_55 AC 713 ms
79,144 KB
testcase_56 AC 1,225 ms
79,664 KB
testcase_57 AC 1,267 ms
79,692 KB
testcase_58 AC 1,279 ms
79,600 KB
testcase_59 AC 1,247 ms
79,984 KB
testcase_60 AC 1,229 ms
79,052 KB
testcase_61 AC 905 ms
79,304 KB
testcase_62 AC 1,268 ms
79,776 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