結果
問題 | No.43 野球の試合 |
ユーザー | 👑 Kazun |
提出日時 | 2021-02-10 01:02:57 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 579 bytes |
コンパイル時間 | 901 ms |
コンパイル使用メモリ | 87,128 KB |
実行使用メモリ | 77,776 KB |
最終ジャッジ日時 | 2023-09-21 12:27:48 |
合計ジャッジ時間 | 2,615 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 84 ms
71,668 KB |
testcase_01 | AC | 84 ms
71,676 KB |
testcase_02 | AC | 83 ms
71,668 KB |
testcase_03 | AC | 82 ms
71,572 KB |
testcase_04 | AC | 83 ms
71,600 KB |
testcase_05 | AC | 85 ms
71,908 KB |
testcase_06 | AC | 91 ms
76,688 KB |
testcase_07 | AC | 130 ms
77,776 KB |
testcase_08 | WA | - |
testcase_09 | AC | 82 ms
71,456 KB |
testcase_10 | WA | - |
ソースコード
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)