結果
問題 | No.43 野球の試合 |
ユーザー |
![]() |
提出日時 | 2022-08-03 00:41:43 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,106 bytes |
コンパイル時間 | 378 ms |
コンパイル使用メモリ | 82,264 KB |
実行使用メモリ | 76,840 KB |
最終ジャッジ日時 | 2024-07-23 18:55:40 |
合計ジャッジ時間 | 1,664 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 2 WA * 5 |
ソースコード
N = int(input())S = [list(input()) for _ in range(N)]l = [i for i in range(N)]from itertools import combinationsl = combinations(l,2)l = list(l)all = N*(N-1)//2now = 1for s in range(2**all):d = [0 for _ in range(N)]p = Truefor i in range(all):p,q = l[i]w = 0if S[p][q] == "-":if s>>i & 1:w = 0else:w = 1elif (S[p][q] == "o" and s>>i & 1) or (S[p][q] == "x" and s>>i & 1 == 0):if S[p][q] == "o":w = 0else:w = 1else:p = Falsebreakif w == 0:d[p] += 1else:d[q] += 1if not p:continuell = []for i in range(len(d)):ll.append((d[i],i))ll.sort(key=lambda x:(-x[0],x[1]))a = ll[0][0]b = 1if ll[0][1] == 0:now = 1breakfor i in range(1,N):if ll[i-1][0] != ll[i][0]:b += 1if ll[i][1] == 0:now = min(now,b)breakprint(now)