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

Автор Shayan, 12 часов назад, По-английски

Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, not as a substitute for the text editorial.

2070A — FizzBuzz Remixed

Video

2070B — Robot Program

Video

2070C — Limited Repainting

Video

2070D — Tree Jumps

Video

2070E — Game with Binary String

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

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

Am I the only one who thought that in C you need to find the SUM of penalties?

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

    me also bro and wasted almost one hour

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

    -100 elo or so just because I forgot to read

  • »
    »
    4 часа назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится

    If you think like this, you need to use simulated cost flow, wqs binary, and use line segment trees to prevent running timeouts, which is a bit difficult for a C problem.

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

    also do i ^.^

  • »
    »
    3 часа назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    no, you are not alone... π π

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

I initially thought D was a combinatorics problem and got WA several times, but now I see it's actually DP.

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

D is easier than usual and I'm completely stuck by the problem E. I try to guess the conclusion, but failed finally.

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

In problem C, after reading the problem statement Minimum Maximum Penalty I thought of using Binary Search because I just remembered it XD. However, during the contest, I was unable to prove the monotonicity. Can someone please explain the monotonicity before applying binary search to me?

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

FOR 2070D — Tree Jumps

I know it's a DP question, but I approached it more like a combinatorial problem and got a WA as a result. I want to understand why I got WA. Can anyone provide a test case where my approach fails or explain the reason behind it?

308241176

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

When could the text editorial be visible awa?

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

I can not think of a way to understand A intuitively, except when I use chines remainder theorem that for a system of congruent (in this case 2 equations) with co-prime moduli (3 and 5), then we always have a unique solution mod 3*5 = 15. Then we can think of if we traverse i from 0 -> 14 and for each i, we have a = i mod 3 and b = i mod 5 then the pair(a, b) will be unique in range [0, 14] and this pair only repeat each interval of 15.

=> We just need to find the pairs of form (a, a) in the first interval from 0 -> 14 (only 3 of those which are 0,0 1,1 and 2,2), and for each pair (a,a) it will repeat each 15 based on the theorem.

»
24 минуты назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Problem B doubt

def s_extend(s, n, k):

quo = k // n 
rem = k % n 
return s * quo + s[:rem]

t = int(input())
for i in range(t):

n, x, k = map(int, input().split()) 
s = input() 

s_n = s_extend(s, n, k) 

pos = x
cnt = 0
rp = 0

while k > 0:
    if s_n[rp] == 'L':
        pos -= 1
    elif s_n[rp] == 'R':
        pos += 1

    if pos == 0:
        cnt += 1
        rp = -1

    rp += 1
    if rp == len(s_n):
        rp = 0

    k -= 1

print(cnt)

For problem B, how can you optimise further ?? Got TLE on Test 1 last input.