結果
| 問題 |
No.43 野球の試合
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-09-06 23:04:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 114 ms / 5,000 ms |
| コード長 | 649 bytes |
| コンパイル時間 | 363 ms |
| コンパイル使用メモリ | 82,452 KB |
| 実行使用メモリ | 76,404 KB |
| 最終ジャッジ日時 | 2024-11-29 07:47:24 |
| 合計ジャッジ時間 | 1,618 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 |
ソースコード
pending = []
n = int(input())
s = [input() for _ in range(n)]
for i in range(n):
for j in range(i):
if s[i][j] == '-':
pending.append((i, j))
def calc_score(s):
wincnt = [si.count('o') for si in s]
t = wincnt[0]
ret = 1
for x in set(wincnt):
if x > t:
ret += 1
return ret
if not pending:
print(calc_score(s))
exit(0)
ans = n
for b in range(1 << len(pending)):
stmp = [list(si) for si in s]
for k, (i, j) in enumerate(pending):
if b >> k & 1:
stmp[i][j] = 'o'
else:
stmp[j][i] = 'o'
ans = min(ans, calc_score(stmp))
print(ans)
Kude