結果
問題 | No.43 野球の試合 |
ユーザー | _KingdomOfMoray |
提出日時 | 2020-01-16 11:47:52 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 997 ms / 5,000 ms |
コード長 | 2,217 bytes |
コンパイル時間 | 105 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-06-23 13:58:56 |
合計ジャッジ時間 | 2,566 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
11,136 KB |
testcase_01 | AC | 32 ms
11,136 KB |
testcase_02 | AC | 33 ms
11,136 KB |
testcase_03 | AC | 31 ms
11,008 KB |
testcase_04 | AC | 36 ms
11,008 KB |
testcase_05 | AC | 35 ms
11,008 KB |
testcase_06 | AC | 159 ms
11,136 KB |
testcase_07 | AC | 997 ms
11,392 KB |
testcase_08 | AC | 149 ms
11,008 KB |
testcase_09 | AC | 158 ms
11,008 KB |
testcase_10 | AC | 155 ms
11,008 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]) win_count_list = [] for i in range(n): win_count_list.append(map_list[i].count('o')) k_rank = sorted(set(win_count_list), reverse=True).index(win_count_list[0]) + 1 rank_list.append(k_rank) res = min(rank_list) print(res)