Submission #4078739


Source Code Expand

#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def IIR(n): return [II() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
mod = 1000000007

#A
"""
a,b = LS()
c = int(a+b)
for i in range(1,1000):
    if i * i == c:
        print("Yes")
        quit()
print("No")
"""

#B
"""
a,b = LI()
if a*b <= 0:
    print("Zero")
else:
    if b < 0:
        if (a-b) %2 == 1:
            print("Positive")
        else:
            print("Negative")
    else:
        print("Positive")
"""

#C
"""
n = II()
s = SR(n)
march = [[] for i in range(5)]
ch = list("MARCH")
for i in s:
    for j in range(5):
        if i[0] == ch[j]:
            march[j].append(i)
ans = 0
for i in range(5):
    for j in range(i):
        for k in range(j):
            if len(march[i])*len(march[j])*len(march[k]) == 0:
                break
            ans += len(march[i])*len(march[j])*len(march[k])
print(ans)
"""

#D
n = II()
d = LIR(n)
q = II()
p = IIR(q)
d.insert(0,[0 for i in range(n+1)])
for i in range(n):
    d[i+1].insert(0,0)
for i in range(n):
    for j in range(n):
        d[i+1][j+1] += d[i+1][j]+d[i][j+1]-d[i][j]
ans = [0 for i in range(n*3+1)]

for a in range(n+1):
    for b in range(n+1):
        for c in range(a):
            for e in range(b):
                ans[(a-c)*(b-e)] = max(ans[(a-c)*(b-e)],d[a][b]-d[c][b]-d[a][e]+d[c][e])
for i in p:
    an = 0
    for a in range(i+1):
        an = max(an, ans[a])
    print(an)

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission Info

Submission Time
Task D - おいしいたこ焼きの焼き方
User dn6049949
Language Python (3.4.3)
Score 0
Code Size 1806 Byte
Status RE
Exec Time 37 ms
Memory 3564 KB

Judge Result

Set Name Subtask1 Subtask2
Score / Max Score 0 / 50 0 / 50
Status
AC × 4
RE × 14
AC × 3
RE × 17
Set Name Test Cases
Subtask1 sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt, s1.txt, s2.txt, sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt
Subtask2 rand0.txt, rand1.txt, rand2.txt, rand3.txt, rand4.txt, rand_max0.txt, rand_max1.txt, rand_max2.txt, rand_max3.txt, rand_max4.txt, s1.txt, s2.txt, sub0.txt, sub1.txt, sub2.txt, sub_rand_max0.txt, sub_rand_max1.txt, sub_rand_max2.txt, sub_rand_max3.txt, sub_rand_min0.txt
Case Name Status Exec Time Memory
rand0.txt RE 31 ms 3436 KB
rand1.txt RE 29 ms 3436 KB
rand2.txt RE 32 ms 3436 KB
rand3.txt RE 26 ms 3316 KB
rand4.txt RE 22 ms 3316 KB
rand_max0.txt RE 36 ms 3564 KB
rand_max1.txt RE 37 ms 3564 KB
rand_max2.txt RE 37 ms 3564 KB
rand_max3.txt RE 37 ms 3564 KB
rand_max4.txt RE 36 ms 3564 KB
s1.txt AC 22 ms 3316 KB
s2.txt AC 22 ms 3316 KB
sub0.txt RE 22 ms 3316 KB
sub1.txt RE 22 ms 3316 KB
sub2.txt RE 22 ms 3316 KB
sub_rand_max0.txt RE 22 ms 3316 KB
sub_rand_max1.txt RE 22 ms 3316 KB
sub_rand_max2.txt RE 22 ms 3316 KB
sub_rand_max3.txt RE 22 ms 3316 KB
sub_rand_min0.txt AC 21 ms 3316 KB