Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

LQDFARM - FARMER

Hiện tại, bài tập này đã có trên online judge chính thức của VNOI, bạn có thể truy cập ở đây: https://oj.vnoi.info/problem/lqdfarm


A farmer has a set of fields, each of which is surrounded by cypress trees. Also, the farmer has a set of strips of land, each of which has a row of cypress trees. In both fields and strips, between every two consecutive  cypress trees is a single olive tree. All of the farmer’s cypress trees either surround a field or are in a strip and all of the farmer’s olive trees are between two consecutive cypress trees in a field or in a strip.

One day the farmer became very ill and he felt that he was going to die. A few days before he passed away he called his eldest son and told him, “I give you any Q cypress trees of your choice and all the olive trees which are between any two consecutive cypress trees you have chosen.”  >From each field and from each strip the son can pick any combination of cypress trees. Since the eldest son loves olives he wants to pick the Q cypress trees which will allow him to inherit as many olive trees as possible.

In Figure 1, assume that the son is given Q=17 cypress trees. To maximize his olive inheritance he should choose all the cypress trees in Field 1 and Field 2, inheriting 17 olive trees. 

You are to write a program which, given the information about the fields and the strips and the number of cypress trees the son can pick, determines the largest possible number of olive trees the son may inherit. 

INPUT 

The input file name is farmer.in. The first line contains first the integer Q: the number 

of cypress trees the son is to select; then the integer M, the number of fields; and then the integer K, the number of strips. The second line contains M integers N1, N2,… NM, : the numbers of cypress trees in  fields. The third line contains K integers R1, R2,… RK: the numbers of cypress trees in strips. (0≤Q≤150000, 3≤ Ni≤150, 2<= Ri<= 150)

OUTPUT 

The output file name is farmer.out. The file is to contain one line with one integer: the largest possible number of olive trees the son may inherit. 

EXAMPLE INPUTS AND OUTPUTS 

Input                                    Output

17 3 3                                   17

13 4 8

4 8 6

 

 

 



Được gửi lên bởi:Tmbao
Ngày:2011-06-11
Thời gian chạy:0.100s-1s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:Tất cả ngoại trừ: ASM32-GCC GAWK MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PERL6 PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SED SQLITE SWIFT UNLAMBDA VB.NET
Nguồn bài:IOI 04

hide comments
2020-02-19 06:45:42
ai cho e xin code bai nay voi duoc khong a
2013-05-27 13:51:51 Cottontail Tee
Giới hạn N,M là bao nhiêu nhỉ để mình còn khai báo mảng :v
2013-05-27 02:05:16 BTi-ÐMH
QHĐ Q*max(Ni,Mi)
2011-06-13 17:12:35 Thỏ con làm bánh
Mỗi lần nhìn bảng điểm là một lần đau lòng. Hình như test càng ngày càng hiểm =.= PS ơi, cho time rộng tí thì chít ai đâu nào :((

Last edit: 2011-06-13 18:28:28
2011-06-13 14:32:15 Tmbao
Đề tiếng Việt đã được Post lên diễn đàn, các bạn có thể tham khảo:
http://vnoi.info/index.php?option=com_content&task=view&id=79&Itemid=103
2011-06-13 14:14:39 HaiZ
VOJ dao nay toan de tieng Anh the ++
2011-06-13 02:04:49 Tmbao
Quá nhiều bạn AC nên đã hạ Time xuống, một số bài sẽ mất AC.
---
Chú ý: Một số bài chép Code đã bị mình Disqualify , mong các bạn nghiêm túc hơn.

Last edit: 2011-06-13 02:08:47
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.