Блог пользователя CherryTree

Автор CherryTree, история, 8 лет назад, По-английски

Hello CodeForces Community!

CodeChef’s 44th edition of LunchTime programming contest — the January LunchTime 2017 coming your way with 4 savory problems to munch on. Aimed at School students, the LunchTime contest promises some fun programming action to all. So, in school or not, it’s time to bring out the programming wizard in you and join in the 3 hour contest.

So, go ahead, enjoy the start of the weekend and have a great week ahead!

We have the following on the problem setting panel:

  • Problem Setter and Russian Translator: CherryTree (Sergey Kulik)
  • Problem Tester: Errichto (Kamil Debowski)
  • Editorialist: pkacprzak (Pawel Kacprzak)
  • Mandarin Translator: huzecong (Hu Zecong)
  • Vietnamese Translator: VNOI Team
  • Contest Admin PraveenDhinwa (Praveen Dhinwa)

Hope you will enjoy solving them. Please give your feedbacks on the problem set in the comments below after the contest.

Please find the rest of the details about the contest below.

Time: 28th January 2017 (1930 hrs) to 28th January 2017 (2230 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.

Details: https://www.codechef.com/LTIME44

Registration: You just need to have a CodeChef handle to participate. For all those, who are interested and do not have a CodeChef handle, are requested to register in order to participate.

Prizes: Top 10 school students each from Global and Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: https://www.codechef.com/laddu. (For those who have not yet got their previous winning, please send an email to winners@codechef.com).

Good Luck! Hope to see you participating!!

  • Проголосовать: нравится
  • +27
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

A gentle reminder, contest starts under a minute !!

»
8 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Good day to you,

For(;task;) "Segment Queries" I was able to do subtask (2) [Subtask #2 (41 point): 1 ≤ N, Q ≤ 10^5] with linear algorithm per query(1) [and logarithmic time per query(0)] — was it intended?

Here is the solution.

Basically:

Q(1): Update of Fenwick (to get fast sum) and iterate over all segments (which are still alive), possibly deleting them (in O(1)) — finding how many I've deleted.

Q(0): Get sum of FW (to know how many remaining) and insert to array in O(1)

Good Luck & Have Nice day!