結果
問題 |
No.43 野球の試合
|
ユーザー |
![]() |
提出日時 | 2014-10-20 00:23:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 990 bytes |
コンパイル時間 | 322 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,760 KB |
最終ジャッジ日時 | 2024-12-30 09:54:45 |
合計ジャッジ時間 | 7,276 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 4 WA * 2 TLE * 1 |
ソースコード
def dfs(depth): if depth == len(yet_coor): count = 0 k_win = win_count[0] + w_list[0] for i, j in list(zip(win_count, w_list))[1:]: if k_win < i + j: count += 1 return count + 1 r, c = yet_coor[depth] w_list[r] += 1 tmp_rank = dfs(depth + 1) w_list[r] -= 1 w_list[c] += 1 tmp_rank = min(tmp_rank, dfs(depth + 1)) w_list[c] -= 1 return tmp_rank n = int(input()) table = [input() for i in range(n)] win_count = [] yet_coor = [] for i, row in enumerate(table): win = 0 # print(i, row) for j, cell in enumerate(row): if i >= j: pass if i == 0 and cell == '-': win += 1 # table[j][i] = 'x' else: if cell == 'o': win += 1 elif cell == '-': yet_coor.append([i, j]) win_count.append(win) w_list = [0] * n # print(yet_coor) print(dfs(0))