結果

問題 No.1345 Beautiful BINGO
ユーザー titiatitia
提出日時 2021-01-18 09:17:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 779 bytes
コンパイル時間 1,236 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 78,320 KB
最終ジャッジ日時 2023-08-20 16:36:36
合計ジャッジ時間 22,925 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,412 KB
testcase_01 AC 76 ms
71,628 KB
testcase_02 AC 79 ms
71,120 KB
testcase_03 AC 76 ms
71,148 KB
testcase_04 AC 76 ms
71,296 KB
testcase_05 WA -
testcase_06 AC 76 ms
71,456 KB
testcase_07 WA -
testcase_08 AC 76 ms
71,328 KB
testcase_09 AC 77 ms
71,480 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 78 ms
71,412 KB
testcase_15 AC 78 ms
71,420 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 75 ms
71,296 KB
testcase_19 WA -
testcase_20 AC 75 ms
71,608 KB
testcase_21 AC 76 ms
71,288 KB
testcase_22 AC 84 ms
76,424 KB
testcase_23 AC 126 ms
76,592 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 104 ms
76,536 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 99 ms
76,504 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 76 ms
71,480 KB
testcase_43 AC 77 ms
71,376 KB
testcase_44 AC 77 ms
71,316 KB
testcase_45 AC 77 ms
71,316 KB
testcase_46 AC 76 ms
71,476 KB
testcase_47 AC 77 ms
71,416 KB
testcase_48 AC 78 ms
71,532 KB
testcase_49 AC 77 ms
71,352 KB
testcase_50 AC 76 ms
71,616 KB
testcase_51 AC 78 ms
71,344 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 140 ms
77,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

ANS=1<<30
for i in range(1<<(N+2)):
    
    x=0
    for j in range(N+2):
        if (1<<j) & i !=0:
            x+=1

    r=M-x

    if r<0 or r>N:
        continue

    SCORE=0
    C=[]

    for j in range(N):
        sc=0
        for k in range(N):
            if (1<<k) & i != 0:
                SCORE+=A[k*N+j]
            elif j==k and (1<<N) & i !=0:
                SCORE+=A[k*N+j]
            elif j==N-k-1 and (1<<(N+1)) & i !=0:
                SCORE+=A[k*N+j]
            else:
                sc+=A[k*N+j]
        C.append(sc)

    ANS=min(ANS,SCORE+sum(sorted(C[:r])))

print(ANS)
    
            
            

    
        
0