Jonas is a very lover history understudy. He lives in the province of Winden and is captivated by its history. One night he was meandering in the timberlands of Winden and coincidentally he found the Widen Caves. Which undoubtedly were a Time Machine! He realized that verifiably Winden was an exceptionally helpless state, yet on the off chance that he can go to the past and give the gold that he found in the caverns to the individuals, at that point Winden can be a rich state in the present. 
There were consistently N houses in Winden directly from its origin. Information the rundown of unique riches Hi of these N family units, where Hi speaks to the abundance of ith house, which is unaltered from the earliest starting point right up ’til today. 
Presently you have to deal with Q inquiries of two sorts 
past W I : In this question, Jonas goes to the past and gives W riches to the Ith family unit. No compelling reason to print any yield here. 
present L R : In this inquiry, Jonas computes the complete abundance of houses from list L to R (both comprehensive). You have to print this incentive on another line. 
First line contains N the quantity of houses. 
Second line contain N separated whole numbers, where Hi speaks to the abundance of ith family 
Third line contains Q the all out number of inquiries 
At that point, Q lines follow. Every one of these lines contains one of the two questions referenced previously. 
For each inquiry of the subsequent sort, print a solitary line containing one number ― the riches which Jonas determined. 
Test Input: 
2 5 8 7 1 
past 5 2 
present 1 3 
past 10 5 
present 1 5 
Test Output: 
In first inquiry he adds 5 riches to second house, presently second house complete riches gets 5+5=10. 
In second inquiry he figures riches from house 1 to 3, which is 2+10+8=20. 
In third inquiry he adds 10 riches to fifth house, presently fifth house complete riches gets 1+10=11. 
In last question he ascertains riches from house 1 to 5, which is 2+10+8+7+11=38.

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here