結果

問題 No.43 野球の試合
ユーザー 12354865271235486527
提出日時 2019-12-23 15:03:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 11,924 KB
実行使用メモリ 10,216 KB
最終ジャッジ日時 2023-10-17 11:23:48
合計ジャッジ時間 1,269 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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