結果

問題 No.43 野球の試合
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-23 08:07:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 360 ms / 5,000 ms
コード長 679 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 8,340 KB
最終ジャッジ日時 2023-08-19 11:15:15
合計ジャッジ時間 2,684 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,176 KB
testcase_01 AC 19 ms
8,316 KB
testcase_02 AC 17 ms
8,340 KB
testcase_03 AC 17 ms
8,228 KB
testcase_04 AC 24 ms
8,304 KB
testcase_05 AC 24 ms
8,332 KB
testcase_06 AC 340 ms
8,208 KB
testcase_07 AC 360 ms
8,308 KB
testcase_08 AC 325 ms
8,172 KB
testcase_09 AC 322 ms
8,332 KB
testcase_10 AC 305 ms
8,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
from bisect import bisect_right as br

n=int(input())
ss=[input() for i in range(n)]
ans=10

for p in product([0,1],repeat=(n*(n-1)//2)):
    shori=[0]*n
    pind=0
    for i in range(n-1):
        for j in range(i+1,n):
            if ss[i][j] == 'o':
                shori[i] += 1
            elif ss[i][j] == 'x':
                shori[j] += 1
            else:
                if p[pind] == 1:
                    shori[i] += 1
                else:
                    shori[j] += 1
            pind += 1
            
    shori_s=sorted(list(set(shori)))
    ans = min(ans , len(set(shori))-br(shori_s,shori[0])+1 )
    
print(ans)
            
0