結果

問題 No.43 野球の試合
ユーザー titiatitia
提出日時 2022-01-03 00:52:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 282 ms / 5,000 ms
コード長 706 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 78,552 KB
最終ジャッジ日時 2024-04-20 10:25:06
合計ジャッジ時間 3,532 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 178 ms
78,552 KB
testcase_01 AC 150 ms
78,020 KB
testcase_02 AC 188 ms
78,148 KB
testcase_03 AC 210 ms
78,072 KB
testcase_04 AC 249 ms
78,320 KB
testcase_05 AC 229 ms
78,288 KB
testcase_06 AC 269 ms
77,808 KB
testcase_07 AC 282 ms
78,084 KB
testcase_08 AC 265 ms
78,080 KB
testcase_09 AC 255 ms
77,876 KB
testcase_10 AC 268 ms
78,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy

N=int(input())
S=[list(input().strip()) for i in range(N)]

ANS=100
for i in range(1<<15):
    A=deepcopy(S)

    c=0

    for j in range(N):
        for k in range(N):
            if A[j][k]=="-":
                if i & (1<<c) !=0:
                    A[j][k]="o"
                    A[k][j]="x"
                else:
                    A[j][k]="x"
                    A[k][j]="o"
                c+=1

    B=[]
    for j in range(N):
        win=0
        for k in range(N):
            if A[j][k]=="o":
                win+=1
        B.append(win)

    C=sorted(set(B),reverse=True)

    for j in range(len(C)):
        if C[j]==B[0]:
            ANS=min(ANS,j+1)

print(ANS)
0