結果

問題 No.5002 stick xor
ユーザー GrayCoderGrayCoder
提出日時 2018-05-26 12:27:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 862 ms / 1,000 ms
コード長 706 bytes
コンパイル時間 27,676 ms
実行使用メモリ 5,920 KB
スコア 36,841
最終ジャッジ日時 2018-05-26 12:27:49
ジャッジサーバーID
(参考情報)
judge9 /
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 827 ms
5,916 KB
testcase_01 AC 862 ms
5,916 KB
testcase_02 AC 820 ms
5,920 KB
testcase_03 AC 740 ms
5,916 KB
testcase_04 AC 698 ms
5,920 KB
testcase_05 AC 829 ms
5,920 KB
testcase_06 AC 725 ms
5,916 KB
testcase_07 AC 753 ms
5,920 KB
testcase_08 AC 720 ms
5,916 KB
testcase_09 AC 712 ms
5,920 KB
testcase_10 AC 723 ms
5,916 KB
testcase_11 AC 739 ms
5,912 KB
testcase_12 AC 794 ms
5,920 KB
testcase_13 AC 712 ms
5,916 KB
testcase_14 AC 773 ms
5,920 KB
testcase_15 AC 698 ms
5,920 KB
testcase_16 AC 750 ms
5,916 KB
testcase_17 AC 719 ms
5,916 KB
testcase_18 AC 782 ms
5,916 KB
testcase_19 AC 730 ms
5,920 KB
testcase_20 AC 781 ms
5,916 KB
testcase_21 AC 804 ms
5,916 KB
testcase_22 AC 836 ms
5,916 KB
testcase_23 AC 765 ms
5,916 KB
testcase_24 AC 799 ms
5,916 KB
testcase_25 AC 732 ms
5,920 KB
testcase_26 AC 778 ms
5,920 KB
testcase_27 AC 780 ms
5,920 KB
testcase_28 AC 783 ms
5,916 KB
testcase_29 AC 787 ms
5,916 KB
testcase_30 AC 705 ms
5,916 KB
testcase_31 AC 746 ms
5,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    a = A
    for l in L:
        case1 = challenge(l, a)
        _, 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()
0