Question: Problem 3 Input specification: The input consists of three lines. The first line contains two integers p and a r , separated by space. The

Problem 3
Input specification: The input consists of three lines. The first line contains two integers p and a r, separated by space. The second line contains integers s1, s2,..., sp, separated by spaces. The third line contains integers t1, t2,..., tr, separated by spaces. You may assume that the integers are positive and fit in int. You may also assume that p and r are non-negative and not larger than 2,500,000.
Output specification: The output contains a single line with the word YES or NO, depending on whether the replanting is possible or not.
Sample input: input-1.1, input-1.2, input-1.3, input-1.4, input-1.5, input-1.6, input-1.7, input-1.8
Sample output: answer-1.1, answer-1.2, answer-1.3, answer-1.4, answer-1.5, answer-1.6, answer-1.7, answer-1.8
How to submit: Name your files Planters.java or Planters.cpp
Your programs must be written in Java
Do not use any Java packages other than java.math, java.io and java.util.Scanner. In particular, note the absence of any data structures and algorithms from java.util in this list!
All input will be from standard input and output to standard output, as described in each assignment. In particular, the input/output does not come from/go to a file! You must not provide any prompting or print anything else on standard output. Note that on most operating systems, you can redirect the contents of a file to appear on standard input, such as java MyProg inputfile.txt or a.out inputfile.txt. This way you can test your code by including your input in a file and having it appear as if someone typed it on their keyboard (the sign is very important here - it does the redirecting). If you want to store the output of your code in a file, you can also use redirect: java MyProg inputfile.txt > myoutput.txt or a.out inputfile.txt > myoutput.txt.Your algorithm's running time should be independent of the bounds we state in the html specification of the input/output.(A bit more on this: in homeworks 1-6 we will provide a pdf description of the problem statements, and an html description of the input/output specifications and bounds. If in the pdf, as part of the problem statement, we say that, for example, the input consists only of values 1,2,3, you can (and probably will need to) rely on this to get the required running time. On the other hand, the bounds in the html descriptions are merely to help you with coding, to estimate the size of the needed data structures, time limits, and so on. Do not rely on these in the design of your algorithm.)
You do not have to check for the correctness of the input - it will always follow the described specification.
Write your programs neatly - imagine yourself grading your program and see if it is easy to read and understand. Comment your programs reasonably: there is no need to comment lines like "i++" but do include brief comments describing the main purpose of a specific block of lines (e.g.,"// merging two sorted arrays" if implementing the merge function in MergeSort).
Problem 3 Input specification: The input consists

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!