結果

問題 No.43 野球の試合
ユーザー 1235486527
提出日時 2019-12-23 15:03:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-17 09:41:07
合計ジャッジ時間 1,129 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

N = int(input())
S = [[0, 0, None] for _ in range(N)]
for i in range(N):
    S[i][2] = i
    for j, s in enumerate(input()):
        if s == 'o':
            S[i][1] += 1
        elif s == '-':
            if j == 0:
                S[0][1] += 1
                S[0][0] -= 1
            else:
                S[i][0] += 1
while True:
    tmp1, tmp2 = sorted(S)[-2:]
    if tmp1[0] == 0:
        break
    tmp1[0] -= 1
    tmp2[0] -= 1
    if tmp1[1] < tmp2[1]:
        tmp1[1] += 1
    else:
        tmp2[1] += 1
    S[tmp1[2]] = tmp1
    S[tmp2[2]] = tmp2
a = sorted(list(set(x[1] for x in S)))
print(len(a) - bisect.bisect_left(a, S[0][1]))
0