ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1491. Unreal Story

Hint
Posted by basuki 25 Mar 2019 08:32
Segment Tree/ Fenwick Tree with range update and point query
Re: Hint
Posted by Apkawa 24 Apr 2022 11:50
Too expensive for this problem. You can just add c to some array[a] and add -c to array[b + 1]. So when you need to print the answer, you just do loop through all knights from 1 to n and firstly add value from array[i] to some variable, then print this variable.