結果

問題 No.43 野球の試合
ユーザー zimphazimpha
提出日時 2017-12-13 23:26:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 5,000 ms
コード長 713 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 77,764 KB
最終ジャッジ日時 2023-08-21 02:29:50
合計ジャッジ時間 2,275 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,488 KB
testcase_01 AC 73 ms
71,620 KB
testcase_02 AC 74 ms
71,516 KB
testcase_03 AC 74 ms
71,432 KB
testcase_04 AC 73 ms
71,060 KB
testcase_05 AC 72 ms
71,344 KB
testcase_06 AC 95 ms
76,604 KB
testcase_07 AC 174 ms
77,764 KB
testcase_08 AC 73 ms
71,340 KB
testcase_09 AC 76 ms
71,388 KB
testcase_10 AC 75 ms
71,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n = int(input())
s = [list(input()) for i in range(n)]

ret = n
undefined = []
for i in range(n):
    for j in range(i + 1, n):
        if s[i][j] == '-':
            undefined.append((i, j))
for d in itertools.product('ox', repeat = len(undefined)):
    win = [0] * n
    for i in range(n):
        for j in range(i + 1, n):
            if s[i][j] == 'o':
                win[i] += 1
            elif s[i][j] == 'x':
                win[j] += 1
            elif s[i][j] == '-':
                if d[undefined.index((i,j))] == 'o':
                    win[i] += 1
                else:
                    win[j] += 1
    ret = min(ret, sorted(list(set(win)))[::-1].index(win[0]) + 1)
print(ret)
0