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

Автор fcspartakm, 6 лет назад, По-русски
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Разбор задач Codeforces Round 481 (Div. 3)
  • Проголосовать: нравится
  • +22
  • Проголосовать: не нравится

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

Very fast! Thank you

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

Thanks for quick explanation. Is there any solution which works faster than "brute solution" for problem D?

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

For G you don't need to iterate all the exams every day.

38195700 complexity is O(n*logm) insted of O(n*m)

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится +4 Проголосовать: не нравится

A simple way of understanding 978E - Bus Video System:

Define pre[i]  = 

Let's take an arbitrary variable initial which could hold all possible initial values.

It is easy to see this inequality holds true:

0  ≤  initial + pre[i]  ≤  w,

Which implies:

 - pre[i]  ≤  initial  ≤  w - pre[i]

We can reduce this to:

max(0,  - pre[i])  ≤  initial  ≤  min(w, w - pre[i])

Solving this inequality and finding the range gives us the final answer.

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

For F instead of using vectors with quarrels another nice way is to process the quarrels by incrementing an array containing the "number of quarrels with less skilled programmers". Then we can just directly subtract the number in that array at the end.

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

My solution 38178463 to problem 978E - Bus Video System is O(n).

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

My solution 38166452 to problem 978B - File Name was similar to the one in the tutorial, but easiest, it's how many ocurrences have the string "xxx" in the string s.

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

fcspartakm I think there was a typo in the tutorial of problem F: "we can user array of pairs" for "we can use array of pairs".

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

Regexp solution is very easy to write for B :P

print sum(map(lambda x : len(x) - 3 + 1, re.findall('x{3,}', raw_input())))