結果

問題 No.43 野球の試合
コンテスト
ユーザー ABKZ
提出日時 2023-09-16 13:11:56
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 907 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 87 ms
コンパイル使用メモリ 65,084 KB
実行使用メモリ 54,692 KB
最終ジャッジ日時 2026-10-13 13:06:04
合計ジャッジ時間 1,997 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 8 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
s = [[x for x in input()] for _ in range(N)]

a = [i for i,x in enumerate(s[0]) if x == '-']
s[0] = [x if x != '-' else 'o' for x in s[0]]
for i in range(1,N):
    s[i][0] = s[i][0] if s[i][0] != '-' else 'x'

for i in range(1,N):
    if s[i].count('o') > s[0].count('o'):
        s[i] = [x if x != '-' else 'o' for x in s[i]]
        for j in range(N):
            s[j][i] = s[j][i] if s[j][i] != '-' else 'x'

for c in range(N):
    for i in range(1, N):
        if s[i].count('o') == c and '-' in s[i]:
            j = s[i].index('-')
            s[i][j] = 'o'
            s[j][i] = 'x'

wc0 = [x.count('o') for x in s]
for i in a:
    if wc0[0] < wc0[i] and wc0[i] + 1 in wc0:
        s[0][i] = 'x'
        s[i][0] = 'o'

wc = [x.count('o') for x in s]
on = []
ans = 1
for i in range(1, N):
    if wc[i] > wc[0] and not wc[i] in on:
        on.append(wc[i])
        ans += 1
print(ans)
0