Submission #1188622

#TimeUsernameProblemLanguageResultExecution timeMemory
1188622krittaphotRabbit Carrot (LMIO19_triusis)Pypy 3
0 / 100
135 ms48800 KiB
def min_modifications(n, m, heights):
    current_height = 0
    changes = 0

    for h in heights:
        if h - current_height > m:
            # ต้องลดเสานี้ลงมาให้อยู่ในระยะกระโดด
            changes += 1
            current_height = current_height + m
        else:
            # ไม่ต้องแก้ เพราะกระโดดถึง (ขึ้นไม่เกิน M หรือ ลง)
            current_height = h
    return changes

Compilation message (stdout)

Compiling 'triusis.py'...

=======
  adding: __main__.pyc (deflated 28%)

=======
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...