結果
| 問題 |
No.43 野球の試合
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2021-02-10 01:02:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 579 bytes |
| コンパイル時間 | 530 ms |
| コンパイル使用メモリ | 82,468 KB |
| 実行使用メモリ | 76,872 KB |
| 最終ジャッジ日時 | 2024-07-07 06:17:40 |
| 合計ジャッジ時間 | 1,479 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 5 WA * 2 |
ソースコード
from itertools import product
from copy import deepcopy
N=int(input())
S=[]
R=[]
for i in range(N):
S.append(list(input()))
for j in range(i+1,N):
if S[-1][j]=="-":
R.append((i,j))
A=N+1
for t in product([0,1],repeat=len(R)):
for k,(i,j) in enumerate(R):
if t[k]==1:
S[i][j],S[j][i]="o","x"
else:
S[i][j],S[j][i]="x","o"
p=S[0].count("o")
rank=1
for m in range(1,N):
if S[m].count("o")>p:
rank+=1
A=min(rank,A)
for i,j in R:
S[i][j]=S[j][i]="-"
print(A)
Kazun