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

Oil on the Mars

Time Limit: 15000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 463    Accepted Submission(s): 85


Problem Description
According to top-secret mars sensor transition, a big oil field was founded on the Mars. The field is divided into N*M equal square, and each square contains some oil resources. Our army want to occupy all the territory of the field, but the UN (United Nations) will allow us to occupy only K squares. Of course, we want to get control over as many oil as possible, but, we will have to guard all our territory. So, they need our territory to be easy-controlled, i.e. from any square to any it must be possible to get moving only along two directions (selected from the next list: left, right, up, down; for different squares pairs of directions may differ).
You are to write a program, which determines, how many oil will be occupied by us.
 

Input
There are several test cases. On the first line of input there are 3 integer numbers N,M,K (1<=N,M<=15, 0<=K<=N*M). The next N lines contain M integers each, which are the number of oil resource on that square. Each of this numbers lies in range of 0 to 1000.
 

Output
One line for a case, write string "Oil : X", where integer number X --- the maximal number of oil which can be controlled.
 

Sample Input
2 3 4 10 20 30 40 2 3
 

Sample Output
Oil : 100
 

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 13:04:49, Gzip enabled