結果
問題 |
No.5002 stick xor
|
ユーザー |
|
提出日時 | 2018-05-26 12:20:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,056 bytes |
コンパイル時間 | 46,548 ms |
スコア | 0 |
最終ジャッジ日時 | 2018-05-26 12:21:21 |
ジャッジサーバーID (参考情報) |
judge8 / |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 32 |
ソースコード
def main(): a = A for l in L: case1 = challenge(l, a) grid = list(map(list, zip(*a))) case2 = challenge(l, grid) if case1[0] < case2[0]: _, col1, row1, col2, row2 = case2 invert = grid[row1-1][col1-1:col2] grid[row1-1][col1-1:col2] = list(map(lambda x: int(not x), invert)) a = list(map(list, zip(*grid))) else: _, row1, col1, row2, col2 = case1 invert = a[row1-1][col1-1:col2] a[row1-1][col1-1:col2] = list(map(lambda x: int(not x), invert)) print(row1, col1, row2, col2) def challenge(l, grid): maxb = -1 ret = [] for i, r in enumerate(grid): for j in range(N + 1 - l): black = r[j:j+l].count(1) if maxb < black: maxb = black row = i + 1 ret = [maxb, row, j + 1, row, j + l] return ret N, K = map(int, input().split()) L = tuple(map(int, input().split())) A = [list(map(int, list(input()))) for _ in [0] * N] main()