結果

問題 No.43 野球の試合
ユーザー DialBirdDialBird
提出日時 2017-03-13 18:51:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 968 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 7,944 KB
最終ジャッジ日時 2023-09-12 12:14:39
合計ジャッジ時間 1,076 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,804 KB
testcase_01 AC 17 ms
7,920 KB
testcase_02 AC 16 ms
7,812 KB
testcase_03 AC 16 ms
7,928 KB
testcase_04 AC 16 ms
7,944 KB
testcase_05 AC 17 ms
7,848 KB
testcase_06 AC 17 ms
7,844 KB
testcase_07 AC 58 ms
7,820 KB
testcase_08 AC 17 ms
7,888 KB
testcase_09 AC 16 ms
7,824 KB
testcase_10 AC 16 ms
7,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
score_board = [0]*N
results = []
candidate_orders = set([])

def calc():
    point = score_board[0]
    sort_borad = sorted(score_board)
    cnt = 1
    for i in sort_borad:
        if point < i:
            cnt += 1
            point = i
    candidate_orders.add(cnt)

def check(x, y):
    if x == N:
        y += 1
        if y == N:
            return calc()
        x = y
    if results[y][x] == '#':
        check(x + 1, y)
    elif results[y][x] == 'o':
        score_board[y] += 1
        check(x + 1, y)
        score_board[y] -= 1
    elif results[y][x] == 'x':
        score_board[x] += 1
        check(x + 1, y)
        score_board[x] -= 1
    elif results[y][x] == '-':
        score_board[x] += 1
        check(x + 1, y)
        score_board[x] -= 1
        score_board[y] += 1
        check(x + 1, y)
        score_board[y] -= 1

for i in range(N):
    row = list(input())
    results.append(row)

check(0,0)

print(min(candidate_orders))
0