結果
問題 | No.43 野球の試合 |
ユーザー | _KingdomOfMoray |
提出日時 | 2020-01-16 11:39:39 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,316 bytes |
コンパイル時間 | 322 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-06-23 13:25:37 |
合計ジャッジ時間 | 2,822 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 29 ms
11,136 KB |
testcase_02 | AC | 30 ms
11,136 KB |
testcase_03 | AC | 31 ms
11,136 KB |
testcase_04 | AC | 34 ms
11,136 KB |
testcase_05 | WA | - |
testcase_06 | AC | 167 ms
11,008 KB |
testcase_07 | WA | - |
testcase_08 | AC | 153 ms
11,008 KB |
testcase_09 | AC | 157 ms
11,136 KB |
testcase_10 | AC | 156 ms
11,136 KB |
ソースコード
# coding: utf-8 # Your code here! import copy n = int(input()) score_list = [] for i in range(n): score_list.append(list(input())) super_list = [] sum_all = sum([e for e in range(1, n)]) count = 0 border_list = list(range(n - 1, 0, -1)) cumu_list = [] rank_list = [] for i in range(n): cur_list = score_list[i][i + 1 :] super_list.extend(cur_list) for j in range(len(border_list)): if j == 0: cumu_list.append(border_list[0]) else: cumu_list.append(cumu_list[j - 1] + border_list[j]) for i in range(2 ** sum_all): cur_list = [] flag = 1 for j in range(sum_all): if (i >> j) & 1 == 1: cur_list.append('o') else: cur_list.append('x') for j in range(sum_all): if super_list[j] == 'x' and cur_list[j] == 'o': flag = 0 break if super_list[j] == 'o' and cur_list[j] == 'x': flag = 0 break # prediction equals given if flag == 1: res_list = [[] for j in range(n - 1)] map_list = copy.copy(score_list) for j in range(len(cur_list)): for k in range(len(border_list)): if j < cumu_list[k]: res_list[k].append(cur_list[j]) break for l in range(n - 1): begin = l + 1 for j in range(n - (l + 1)): right = res_list[l][j] wrong = None if right == 'o': wrong = 'x' elif right == 'x': wrong = 'o' elif right == '-': right = 'o' wrong = 'x' map_list[l][begin] = right map_list[begin][l] = wrong begin += 1 # for i in range(n): # print(map_list[i]) # print('---------------') win_count_list = [] for i in range(n): win_count_list.append(map_list[i].count('o')) k_rank = sorted(set(win_count_list), \ key=win_count_list.index, reverse=True).index(win_count_list[0]) + 1 rank_list.append(k_rank) res = min(rank_list) print(res)