結果
問題 | No.452 横着者のビンゴゲーム |
ユーザー | matsu7874 |
提出日時 | 2016-12-02 03:39:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 486 ms / 3,000 ms |
コード長 | 1,292 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,472 KB |
実行使用メモリ | 77,832 KB |
最終ジャッジ日時 | 2024-11-28 21:18:19 |
合計ジャッジ時間 | 7,710 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 33 ms
53,388 KB |
testcase_01 | AC | 34 ms
54,052 KB |
testcase_02 | AC | 39 ms
57,848 KB |
testcase_03 | AC | 56 ms
71,464 KB |
testcase_04 | AC | 39 ms
59,588 KB |
testcase_05 | AC | 59 ms
72,732 KB |
testcase_06 | AC | 37 ms
59,056 KB |
testcase_07 | AC | 47 ms
65,148 KB |
testcase_08 | AC | 54 ms
68,364 KB |
testcase_09 | AC | 36 ms
58,404 KB |
testcase_10 | AC | 42 ms
59,648 KB |
testcase_11 | AC | 50 ms
66,468 KB |
testcase_12 | AC | 41 ms
61,216 KB |
testcase_13 | AC | 32 ms
53,368 KB |
testcase_14 | AC | 117 ms
77,132 KB |
testcase_15 | AC | 115 ms
77,148 KB |
testcase_16 | AC | 105 ms
76,988 KB |
testcase_17 | AC | 103 ms
76,360 KB |
testcase_18 | AC | 110 ms
76,508 KB |
testcase_19 | AC | 119 ms
76,648 KB |
testcase_20 | AC | 113 ms
76,608 KB |
testcase_21 | AC | 169 ms
77,200 KB |
testcase_22 | AC | 112 ms
75,672 KB |
testcase_23 | AC | 253 ms
77,116 KB |
testcase_24 | AC | 112 ms
75,744 KB |
testcase_25 | AC | 87 ms
75,756 KB |
testcase_26 | AC | 187 ms
76,940 KB |
testcase_27 | AC | 175 ms
76,752 KB |
testcase_28 | AC | 125 ms
76,644 KB |
testcase_29 | AC | 118 ms
76,552 KB |
testcase_30 | AC | 210 ms
76,800 KB |
testcase_31 | AC | 88 ms
76,332 KB |
testcase_32 | AC | 94 ms
75,928 KB |
testcase_33 | AC | 143 ms
76,536 KB |
testcase_34 | AC | 128 ms
76,380 KB |
testcase_35 | AC | 134 ms
76,648 KB |
testcase_36 | AC | 99 ms
75,736 KB |
testcase_37 | AC | 106 ms
75,636 KB |
testcase_38 | AC | 486 ms
77,832 KB |
testcase_39 | AC | 374 ms
77,100 KB |
testcase_40 | AC | 354 ms
77,100 KB |
testcase_41 | AC | 364 ms
77,092 KB |
testcase_42 | AC | 359 ms
76,996 KB |
testcase_43 | AC | 368 ms
77,220 KB |
ソースコード
n,m = map(int, input().split()) players = [[] for i in range(m)] def rowize(matrix): size = len(matrix) rows = [matrix[i][:] for i in range(size)] for i in range(size): column = [] for j in range(size): column.append(matrix[j][i]) rows.append(column[:]) diagonal = [] for i in range(size): diagonal.append(matrix[i][i]) rows.append(diagonal[:]) diagonal = [] for i in range(size): diagonal.append(matrix[i][size-i-1]) rows.append(diagonal[:]) return rows def count_duplicated(a, b): cnt = 0 i = 0 j = 0 while i<n and j<n: if a[i] < b[j]: i += 1 elif a[i] == b[j]: cnt += 1 i += 1 j += 1 else: j += 1 return cnt def max_x(duplicated): return 2*(n-duplicated) + (duplicated-1) for p in range(m): card = [] for i in range(n): card.append(list(map(int, input().split()))) for row in rowize(card): players[p].append(sorted(row)) max_duplicated = 0 for i in range(m-1): for j in range(i+1, m): for p in players[i]: for q in players[j]: max_duplicated = max(max_duplicated, count_duplicated(p, q)) print(max_x(max_duplicated))