Submission #4078671
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] for i in p: ans = 0 for a in range(n+1): for b in range(n+1): for c in range(a): for e in range(b): if (a-c)*(b-e) <= i: ans = max(ans, d[a][b]-d[c][b]-d[a][e]+d[c][e]) print(ans) #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 | 50 |
Code Size | 1758 Byte |
Status | TLE |
Exec Time | 5256 ms |
Memory | 3564 KB |
Judge Result
Set Name | Subtask1 | Subtask2 | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 50 / 50 | 0 / 50 | ||||||
Status |
|
|
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 | TLE | 5256 ms | 3436 KB |
rand1.txt | TLE | 5256 ms | 3436 KB |
rand2.txt | TLE | 5256 ms | 3436 KB |
rand3.txt | TLE | 5256 ms | 3316 KB |
rand4.txt | AC | 205 ms | 3316 KB |
rand_max0.txt | TLE | 5256 ms | 3564 KB |
rand_max1.txt | TLE | 5256 ms | 3564 KB |
rand_max2.txt | TLE | 5256 ms | 3564 KB |
rand_max3.txt | TLE | 5256 ms | 3564 KB |
rand_max4.txt | TLE | 5256 ms | 3564 KB |
s1.txt | AC | 22 ms | 3316 KB |
s2.txt | AC | 22 ms | 3316 KB |
sub0.txt | AC | 24 ms | 3316 KB |
sub1.txt | AC | 25 ms | 3316 KB |
sub2.txt | AC | 25 ms | 3316 KB |
sub_rand_max0.txt | AC | 26 ms | 3316 KB |
sub_rand_max1.txt | AC | 27 ms | 3316 KB |
sub_rand_max2.txt | AC | 26 ms | 3316 KB |
sub_rand_max3.txt | AC | 26 ms | 3316 KB |
sub_rand_min0.txt | AC | 22 ms | 3316 KB |