Submission #6121292


Source Code Expand

Copy
import numpy as np
H,W = map(int,input().split())

# 1列ずつ入れておく
C = np.zeros((H+1, W+1), dtype=np.int32)
C[1:, 1:] = [input().split() for _ in range(H)]

# 白を負に
C[1::2, ::2] *= (-1)
C[::2, 1::2] *= (-1)

# 2次元累積和
C_cum = C.cumsum(axis = 0).cumsum(axis = 1)

answer = 0
for j in range(1,W+1):
  # j列目から使い始める場合
  a = C_cum[:,j:] - C_cum[:,j-1][:,None]
  for i in range(1,H+1):
    X,Y = (a[i:] == a[i-1]).nonzero()
    if len(X) > 0:
      answer = max(answer, np.max((X+1)*(Y+1)))

print(answer)

Submission Info

Submission Time
Task B - チョコレート
User maspy
Language Python (3.4.3)
Score 100
Code Size 574 Byte
Status AC
Exec Time 834 ms
Memory 22324 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 5
AC × 25
Set Name Test Cases
Sample subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask0_sample-05.txt
All 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
Case Name Status Exec Time Memory
subtask0_sample-01.txt AC 317 ms 22324 KB
subtask0_sample-02.txt AC 148 ms 12468 KB
subtask0_sample-03.txt AC 149 ms 12468 KB
subtask0_sample-04.txt AC 148 ms 12428 KB
subtask0_sample-05.txt AC 149 ms 12424 KB
subtask1_01.txt AC 147 ms 12424 KB
subtask1_02.txt AC 148 ms 12424 KB
subtask1_03.txt AC 148 ms 12428 KB
subtask1_04.txt AC 149 ms 12472 KB
subtask1_05.txt AC 152 ms 12428 KB
subtask1_06.txt AC 165 ms 12428 KB
subtask1_07.txt AC 150 ms 12428 KB
subtask1_08.txt AC 154 ms 12424 KB
subtask1_09.txt AC 626 ms 12796 KB
subtask1_10.txt AC 276 ms 12536 KB
subtask1_11.txt AC 526 ms 12872 KB
subtask1_12.txt AC 538 ms 12872 KB
subtask1_13.txt AC 539 ms 12832 KB
subtask1_14.txt AC 624 ms 12796 KB
subtask1_15.txt AC 631 ms 12796 KB
subtask1_16.txt AC 535 ms 12764 KB
subtask1_17.txt AC 559 ms 12792 KB
subtask1_18.txt AC 148 ms 12424 KB
subtask1_19.txt AC 151 ms 12472 KB
subtask1_20.txt AC 834 ms 13052 KB