AtCoder Regular Contest 025

Submission #2867552

Source codeソースコード

H,W = map(int,input().split())
C = [[int(i) for i in input().split()] for i in range(H)]
bl,wh = [[0 for i in range(W+2)] for i in range(H+2)],[[0 for i in range(W+2)] for i in range(H+2)]
for i in range(1,H+1):
    for j in range(1,W+1):
        if (i+j)%2==0:
            bl[i][j] = C[i-1][j-1]+bl[i-1][j]+bl[i][j-1]-bl[i-1][j-1]
            wh[i][j] = wh[i-1][j]+wh[i][j-1]-wh[i-1][j-1]
        else:
            bl[i][j] = bl[i-1][j]+bl[i][j-1]-bl[i-1][j-1]
            wh[i][j] = C[i-1][j-1]+wh[i-1][j]+wh[i][j-1]-wh[i-1][j-1]
ans = 0
for i in range(1,H+1):
    for j in range(1,W+1):
        for k in range(i,H+1):
            for l in range(j,W+1):
                white = wh[k][l]-wh[i-1][j+1]-wh[i+1][j-1]+wh[i-1][j-1]
                black = bl[k][l]-bl[i-1][j+1]-bl[i+1][j-1]+bl[i-1][j-1]
                if white==black:
                    ans = max(ans, (k-i+1)*(l-j+1))
print(ans)

Submission

Task問題 B - チョコレート
User nameユーザ名 mahiro346
Created time投稿日時
Language言語 PyPy3 (2.4.0)
Status状態 WA
Score得点 0
Source lengthソースコード長 915 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_sample-01.txt,subtask0_sample-02.txt,subtask0_sample-03.txt,subtask0_sample-04.txt,subtask0_sample-05.txt
All 0 / 100 subtask0_sample-01.txt,subtask0_sample-02.txt,subtask0_sample-03.txt,subtask0_sample-04.txt,subtask0_sample-05.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_20.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_sample-01.txt AC 164 ms 38384 KB
subtask0_sample-02.txt AC 162 ms 38256 KB
subtask0_sample-03.txt AC 164 ms 38256 KB
subtask0_sample-04.txt AC 164 ms 38256 KB
subtask0_sample-05.txt AC 165 ms 38256 KB
subtask1_01.txt WA
subtask1_02.txt AC 165 ms 38384 KB
subtask1_03.txt WA
subtask1_04.txt WA
subtask1_05.txt WA
subtask1_06.txt WA
subtask1_07.txt WA
subtask1_08.txt AC 180 ms 39664 KB
subtask1_09.txt WA
subtask1_10.txt WA
subtask1_11.txt WA
subtask1_12.txt WA
subtask1_13.txt WA
subtask1_14.txt AC 1060 ms 43100 KB
subtask1_15.txt WA
subtask1_16.txt WA
subtask1_17.txt WA
subtask1_18.txt AC 163 ms 38256 KB
subtask1_19.txt WA
subtask1_20.txt AC 958 ms 42860 KB