結果

問題 No.43 野球の試合
ユーザー 👑 colognecologne
提出日時 2022-01-24 15:12:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 646 bytes
コンパイル時間 1,207 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 77,128 KB
最終ジャッジ日時 2023-08-21 03:10:08
合計ジャッジ時間 3,127 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,232 KB
testcase_01 AC 73 ms
71,528 KB
testcase_02 AC 72 ms
71,512 KB
testcase_03 AC 72 ms
71,180 KB
testcase_04 AC 73 ms
71,300 KB
testcase_05 AC 73 ms
71,240 KB
testcase_06 AC 88 ms
76,292 KB
testcase_07 AC 115 ms
77,128 KB
testcase_08 AC 72 ms
71,256 KB
testcase_09 AC 73 ms
71,116 KB
testcase_10 AC 77 ms
71,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    s = [list(input()) for i in range(N)]

    ans = N
    A = []
    for i in range(N):
        for j in range(i):
            if s[j][i] == '-':
                A.append((j, i))

    for i in range(1 << len(A)):
        for j in range(len(A)):
            s[A[j][0]][A[j][1]] = 'o' if i & (1 << j) else 'x'
            s[A[j][1]][A[j][0]] = 'x' if i & (1 << j) else 'o'

        z = [a.count('o') for a in s]
        k = sorted(set(z), reverse=True)
        ans = min(ans, k.index(z[0])+1)

    print(ans)


if __name__ == '__main__':
    main()
0