Computers and Technology, 06.04.2020 18:19 solphiafischer
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;
}
Answers: 1
Computers and Technology, 22.06.2019 06:30
This technology is used to produce high-quality documents that look good on the computer screen and in print. wiki presentation paint desktop publishing
Answers: 3
Computers and Technology, 24.06.2019 12:30
Why does the pc send out a broadcast arp prior
Answers: 1
Computers and Technology, 25.06.2019 04:00
Use the wrap text icon to modify which graphic appears in the front of layered images modify the picture effects change the way text is wrapped around an object apply wordart to the text
Answers: 1
Computers and Technology, 25.06.2019 08:00
What are good colleges to apply to if you got like a 2.5 as a gpa? already got a call back from gcu at least its a start rt
Answers: 2
You are provided with a vector of N integers. Then, you are given 2 queries. For the first query, yo...
Mathematics, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10
Physics, 30.03.2021 23:10
Biology, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10
Arts, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10
Biology, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10
English, 30.03.2021 23:10
English, 30.03.2021 23:10
Mathematics, 30.03.2021 23:10