Submission #679469
Source Code Expand
N = gets.to_i mat = (1..N).map{ gets.split.map(&:to_i)} ruiseki = Array.new(N+1){Array.new(N+1){0}} for i in 1..N for j in 1..N ruiseki[i][j] = mat[i-1][j-1] + ruiseki[i][j-1] + ruiseki[i-1][j] - ruiseki[i-1][j-1] end end ans = Array.new(N * N + 1){0}; for x in 0..N for y in 0..N for z in x..N for w in y..N area = (w-y) * (z-x) ans[area] = [ans[area], ruiseki[z][w] - ruiseki[z][y] - ruiseki[x][w] + ruiseki[x][y] ].max end end end end gets.to_i.times.each{ puts ans[0..gets.to_i].max }
Submission Info
Submission Time | |
---|---|
Task | D - おいしいたこ焼きの焼き方 |
User | tokoharu |
Language | Ruby (1.9.3) |
Score | 100 |
Code Size | 542 Byte |
Status | AC |
Exec Time | 2422 ms |
Memory | 4328 KB |
Judge Result
Set Name | Subtask1 | Subtask2 | ||||
---|---|---|---|---|---|---|
Score / Max Score | 50 / 50 | 50 / 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 | AC | 1211 ms | 4196 KB |
rand1.txt | AC | 745 ms | 4200 KB |
rand2.txt | AC | 1247 ms | 4200 KB |
rand3.txt | AC | 280 ms | 4200 KB |
rand4.txt | AC | 54 ms | 4200 KB |
rand_max0.txt | AC | 2409 ms | 4200 KB |
rand_max1.txt | AC | 2418 ms | 4200 KB |
rand_max2.txt | AC | 2403 ms | 4204 KB |
rand_max3.txt | AC | 2422 ms | 4304 KB |
rand_max4.txt | AC | 2413 ms | 4328 KB |
s1.txt | AC | 46 ms | 4308 KB |
s2.txt | AC | 49 ms | 4200 KB |
sub0.txt | AC | 48 ms | 4196 KB |
sub1.txt | AC | 48 ms | 4200 KB |
sub2.txt | AC | 46 ms | 4200 KB |
sub_rand_max0.txt | AC | 48 ms | 4196 KB |
sub_rand_max1.txt | AC | 46 ms | 4112 KB |
sub_rand_max2.txt | AC | 47 ms | 4116 KB |
sub_rand_max3.txt | AC | 52 ms | 4192 KB |
sub_rand_min0.txt | AC | 52 ms | 4236 KB |