結果

問題 No.43 野球の試合
ユーザー zombietanzombietan
提出日時 2016-05-10 07:19:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-15 15:02:03
合計ジャッジ時間 1,603 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 34 ms
10,752 KB
testcase_04 WA -
testcase_05 AC 32 ms
10,752 KB
testcase_06 AC 35 ms
10,880 KB
testcase_07 AC 583 ms
11,136 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 AC 31 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
S = [list(input()) for _ in range(N)]

count = 0
for s in S:
    for m in s:
        if m == '-':
            count += 1
    
rg = count//2
WL = ('o','x')
rup = []
for pat in itertools.product(WL, repeat=rg):
    wn = []
    CS = [x[:] for x in S]
    for j in range(N):
        for k in range(N):
            if CS[j][k] == '-':
                wl = list(pat).pop()
                if wl == 'o':
                    CS[j][k] = 'o'
                    CS[k][j] = 'x'
                else:
                    CS[j][k] = 'x'
                    CS[k][j] = 'o'
    for cs in CS:
        w = cs.count('o')
        wn.append(w)
    tw = wn[0]
    swn = list(set(wn))
    wn = sorted(swn, reverse=True)
    rank = wn.index(tw) + 1
    rup.append(rank)

print(min(rup))
0