subject

You are provided with a vector of N integers. Then, you are given 2 queries. For the first query, you are provided with 1 integer, which denotes a position in the vector. The value at this position in the vector needs to be erased. The next query consists of 2 integers denoting a range of the positions in the vector. The elements which fall under that range should be removed. The second query is performed on the updated vector which we get after performing the first query.

Input Format

The first line of the input contains an integer N. The next line contains N space separated integers(1-based index).The third line contains a single integer x, denoting the position of an element that should be removed from the vector. The fourth line contains two integers a and b denoting the range that should be erased from the vector inclusive of a and exclusive of b.

Constraints:

1 <= N <= 10^5

1 <= x <= N

1 <= a <= b <= N

Output Format

Print the size of the vector in the first line and the elements of the vector after the two erase operations in the second line separated by space.

Sample Input

6
1 4 6 2 8 9
2
2 4
Sample Output

3
1 8 9
Explanation

The first query is to erase the 2nd element in the vector, which is 4. Then, modifed vector is {1 6 2 8 9}, we want to remove the range of 2~4, which means the 2nd and 3rd elements should be removed. Then 6 and 2 in the modified vector are removed and we finally get {1 8 9}

Code:

#include

#include

#include

#include

#include

using namespace std;

int main() {

/* Enter your code here. Read input from STDIN. Print output to STDOUT */

return 0;

}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:30
An endless cycle of creation and response on the internet is called
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
This first part of the film shows the early history of motion pictures. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theatre productions? explain. in the scene where don is going to the party (starting at time code 14: 51), we see a street scene as he first rides with cosmo and then with kathy. what aspects did the filmmaker include to make the scene look and feel like don, cosmo, and kathy are riding in a car on a street? think about elements such as scenery, sound, props, lighting, and so on. a "talkie" picture is shown starting around time code 21: 15. how does the audience in the film react to the "talkie"? what influence do audiences have on film and theatre performances? how do film and theatre actors influence audiences? in the musical scene with cosmo (starting at time code 27: 00), how does the actor use props? what is the result? do you think the use of props effectively fulfilled the artistic vision for this musical number? why or why not?
Answers: 1
question
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
You know the right answer?
You are provided with a vector of N integers. Then, you are given 2 queries. For the first query, yo...
Questions
Questions on the website: 13722361