結果
| 問題 | No.43 野球の試合 | 
| コンテスト | |
| ユーザー |  lllllll88938494 | 
| 提出日時 | 2022-01-23 08:07:13 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 372 ms / 5,000 ms | 
| コード長 | 679 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-11-29 03:22:23 | 
| 合計ジャッジ時間 | 2,831 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 7 | 
ソースコード
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)
            
            
            
            
        