結果

問題 No.43 野球の試合
ユーザー titiatitia
提出日時 2022-01-03 00:51:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,286 ms / 5,000 ms
コード長 706 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-20 10:23:11
合計ジャッジ時間 10,738 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 338 ms
11,008 KB
testcase_01 AC 323 ms
11,008 KB
testcase_02 AC 495 ms
10,880 KB
testcase_03 AC 675 ms
10,880 KB
testcase_04 AC 903 ms
10,880 KB
testcase_05 AC 886 ms
10,880 KB
testcase_06 AC 1,181 ms
10,880 KB
testcase_07 AC 1,286 ms
10,880 KB
testcase_08 AC 1,158 ms
11,008 KB
testcase_09 AC 1,135 ms
10,880 KB
testcase_10 AC 1,144 ms
10,880 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