AtCoder Regular Contest 025

Submission #1365390

Source codeソースコード

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

class Ruiwa():
    def __init__(self, a):
        self.H = h = len(a)
        self.W = w = len(a[0])
        self.R = r = [_[:] for _ in a]
        for i in range(h):
            for j in range(1,w):
                r[i][j] += r[i][j-1]

        for i in range(1,h):
            for j in range(w):
                r[i][j] += r[i-1][j]


def main():
    h,w = LI()
    a = []
    for i in range(h):
        t = LI()
        a.append([t[j] if (i+j)%2 == 0 else -t[j] for j in range(w)])

    r = 0
    for i in range(h):
        rui = Ruiwa(a[i:])
        for j in range(h-i):
            d = collections.defaultdict(list)
            for k in range(w):
                if k > 0:
                    d[rui.R[j][k]].append(k)
                if rui.R[j][k] == 0 and (j+1) * (k+1) > r:
                    r = (j+1) * (k+1)
            for l in d.values():
                if len(l) < 2:
                    continue
                t = l[-1] - l[0] + 1
                if r < t * (j+1):
                    r = t * (j+1)

    return r


print(main())

Submission

Task問題 B - チョコレート
User nameユーザ名 iehn
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 WA
Score得点 0
Source lengthソースコード長 1622 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 42 ms 5404 KB
subtask0_sample-02.txt AC 41 ms 5404 KB
subtask0_sample-03.txt AC 41 ms 5408 KB
subtask0_sample-04.txt AC 42 ms 5408 KB
subtask0_sample-05.txt AC 41 ms 5404 KB
subtask1_01.txt WA
subtask1_02.txt AC 41 ms 5400 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 41 ms 5404 KB
subtask1_09.txt WA
subtask1_10.txt WA
subtask1_11.txt WA
subtask1_12.txt WA
subtask1_13.txt WA
subtask1_14.txt WA
subtask1_15.txt WA
subtask1_16.txt WA
subtask1_17.txt WA
subtask1_18.txt WA
subtask1_19.txt AC 54 ms 5404 KB
subtask1_20.txt AC 343 ms 5660 KB