F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Mystery ET

Time Limit: 60000/30000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 260    Accepted Submission(s): 41


Problem Description
In the year 3890, we ALPCs find that the army of another planet is going to attack the earth, and we have to stop this attack to save our human beings, save the earth.
ALPC2587 has captured an ET, and he starts research this ET. Several days later he draws a conclusion that an ET¡¯s living on the earth depends on a parameter named DR. DR measures the dangerousness of an ET. If an ET has a larger DR, it¡¯s more dangerous. Now ALPCs have to find the maximum value of DR.
But there¡¯s a problem that ET keeps growing: in an experience, first of all, we randomly put a cell of an ET in to box with N*N grids, every grid has a value, which is the value of DR (may be negative) of that grid. Then the cell grows freely and then constructs a creature. The creature¡¯s DR is the total DR of all the girds it captured. In a unit time, the creature can choose one of its cell (grid) to grow to a adjacent grid.
Here¡¯s an example:

ALPC2587 has experienced a lot but he is not clever enough to calculate the maximum DR, and all other ALPCs are busy with other tasks, so he comes to you for help. Please help him to calculate the maximum DR value the creature can gain in an experience.
 

Input
  There are multiple test cases, please process to the end of file.
  In each the first line contains N (N<=9), the size of the box. Then comes N lines, each has N integers Aij (|Aij| < 32768), indicates the DR value of each grid.
 

Output
For each case output the maximum DR value the creature can be.
 

Sample Input
4 2 -1 -1 -1 5 -5 -1 -5 3 2 -1 3 2 -2 -3 2
 

Sample Output
18
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 18:40:14, Gzip enabled