TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input().split())
a = list(map(int, input().split()))

if n == k:
    print(1)
    exit()

idx = a.index(1)

if idx < (n//2):
    a = idx//(k-1)
else:
    a = (n-idx-1)//(k-1)

m = n - k - (k-1)*a

if m // (k-1):
    b = m//(k-1)+1
else:
    b = m//(k-1)

print(a+1+b)



from collections import deque
k = int(input())

digsum = lambda x: sum(map(int, list(str(x))))
dignorm = lambda x: x/digsum(x)

n = 1
order = 1
while k > 0:
    print(n)
    k -= 1
    if dignorm(n+10**(order-1)) > dignorm(n+10**order):
        order += 1
    n += 10**(order-1)



from math import ceil
n, k = map(int, input().split())
a = list(map(int, input().split()))

print(ceil((n-k)/(k-1)) + 1)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
info = list(map(int, input().split(' ')))
array = list(map(int, input().split(' ')))

print((info[0]-1)//(info[1]-1))

info = list(map(int, input().split(' ')))
array = list(map(int, input().split(' ')))

if info[1] == info[0]:
    print(1)
elif info[1] == 2:
    print(info[0]-1)
elif info[0]//(info[1]-1)==1:
    print(2)
else:
    print((info[0]-1)//(info[1]-1))

info = list(map(int, input().split(' ')))
array = list(map(int, input().split(' ')))

print((info[0]-1+info[1]-2)//(info[1]-1))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
N,K = map(int , input().split())
A = list(map(int , input().split()))

left_num = A.index(1)
right_num = N-left_num-1
print(left_num)
print(right_num)

ans = math.ceil(left_num/(K-1))+math.ceil(right_num/(K-1))
print(ans)

import math
N,K = map(int , input().split())
A = list(map(int , input().split()))

ans = math.ceil((N-1)/(K-1))
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
N,K = [int(i) for i in input().split()]
a = list(input().split())
m = a.index('1')
if m == 0 or m == N-1:
    print(math.ceil((N-1)/(K-1)))
else:
    res = (K - m%K)%K
    print(math.ceil((m)/(K-1)) + math.ceil((N-m-1-res)/(K-1)))

import math
N,K = [int(i) for i in input().split()]
a = list(input().split())
m = a.index('1')
if m == 0 or m == N-1:
    print(math.ceil((N-1)/(K-1)))
else:
    res = ((K-1) - m%(K-1))%(K-1)
    print(math.ceil((m)/(K-1)) + math.ceil((N-m-1-res)/(K-1)))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math

N, K = map(int, input().split())
A = list(map(int, input().split() ))
math.ceil( (N-1)/(K-1) )

import math

N, K = map(int, input().split())
A = list(map(int, input().split() ))
print(math.ceil( (N-1)/(K-1) ))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

minpos = 0
for i in range(0, n):
  if a[i] == 1: minpos = i
print((minpos + k - 2) / (k - 1) + (n - minpos - 1 + k - 2) / (k - 1))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

print((n - 1 + k - 2) // (k - 1))


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input().split())
lst = list(map(int, input().split()))
a = lst.index(1)
print(math.ceil(a/2) + math.ceil((n-a-1)/2))

import math
n, k = map(int, input().split())
lst = list(map(int, input().split()))
a = lst.index(1)
print(math.ceil((n - 1) / (k-1)))

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math

def calc_manipulate_times(Klen,len):
    if len == 0:
        return 0
    elif Klen>=len:
        return 1
    else:
        return math.ceil((len - Klen)/(Klen-1)) + 1

N,K = map(int,input('').split())
A = list(input().split(' '))

left_count = A.index('1')+1
right_count = len(A)-A.index('1')
# print(A)
print(left_count)
print(right_count)

#


print(calc_manipulate_times(K,left_count) )
print(calc_manipulate_times(K,right_count))

ans = calc_manipulate_times(K,left_count) + calc_manipulate_times(K,right_count)
print(ans)


import math

N,K = map(int,input('').split())
A = list(input().split(' '))

count = A.index('1') + len(A)-A.index('1')-1
print(math.ceil(count/(K-1)))


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = map(int,input().split())
A = list(map(int,input().split()))


#         if A[i] == 1:
#             return i
# n = search(A)
#

print((N-1) // (K-1))

N,K = map(int,input().split())
A = list(map(int,input().split()))


#         if A[i] == 1:
#             return i
# n = search(A)
#

print(-((-N+1) // (K-1)))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
8 3
7 3 1 8 4 6 2 5

N, K = map(int,input().split())
A = list(map(int, input().split()))
if (N-1) % (K-1) == 0:
	print((N-1)//(K-1))
else:
  	print((N-1)//(K-1)+1)

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    print(math.ceil((n -1) // (k - 1)))

    
if __name__ == '__main__':
    main()

import math


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    print(math.ceil((n -1) / (k - 1)))

    
if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = map(int,input().split())
A = list(map(int,input().split()))

N -= 1
K -= 1
print(N // K)


import math

N,K = map(int,input().split())
A = list(map(int,input().split()))

N -= K
K -= 1
C = math.ceil(N/K)

print(C+1)


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
from math import floor
nk = input()
n, k = nk.split()
n = int(n)
k = int(k)

an = input()
an_list = an.split()
min = min(an_list)

min_ind = an_list.index(min) + 1
after = (n - min_ind) / (k-1)
before = (min_ind - 1) / (k-1)

res = floor((n-1)/(k-1))


print(int(res))


from math import floor
nk = input()
n, k = nk.split()
n = int(n)
k = int(k)

an = input()
an_list = an.split()
min = min(an_list)

min_ind = an_list.index(min) + 1
after = (n - min_ind) / (k-1)
before = (min_ind - 1) / (k-1)

res = 0

if min_ind < k or (n - min_ind) > (k-1):
    res = floor(n/(k-1)) 

else:
    if after.is_integer():
    res = res + after
    else:
    res = res + floor(after) + 1

    if before.is_integer():
    res = res + before
    else:
    res = res + floor(before) + 1


print(int(res))

from math import floor
nk = input()
n, k = nk.split()
n = int(n)
k = int(k)

an = input()
an_list = an.split()
min = min(an_list)

min_ind = an_list.index(min) + 1
after = (n - min_ind) / (k-1)
before = (min_ind - 1) / (k-1)

res = 0



if min_ind < k or (n - min_ind) > (k-1):
    res = floor(n/(k-1))



else:
    if after.is_integer():
        res = res + after
    else:
        res = res + floor(after) + 1

    if before.is_integer():
        res = res + before
    else:
        res = res + floor(before) + 1


print((n-1)/(k-1))

from math import floor
nk = input()
n, k = nk.split()
n = int(n)
k = int(k)

an = input()
an_list = an.split()
min = min(an_list)

min_ind = an_list.index(min) + 1
after = (n - min_ind) / (k-1)
before = (min_ind - 1) / (k-1)



if (n-1)%(k-1):
    res = (n-1)/(k-1)
else:
    res = (n-1)//(k-1) + 1

print(res)



nk = input()
n, k = nk.split()
n = int(n)
k = int(k)

an = input()
an_list = an.split()
min = min(an_list)





if (n-1)%(k-1)==0:
    res = (n-1)//(k-1)
else:
    res = (n-1)//(k-1) + 1

print(res)


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k = map(int,input().split())
a = list(map(int,input().split()))

if n == k:
    print(1)
    exit()

l = 0
r = 0
one = False
for i in range(n):
    if a[i] == 1:
        one = True
        continue
    if one == False:
        l += 1
    else:
        r += 1

if k >= min(l+1,r+1):
    n -= k
    if n%(k-1) == 0:
        n //= k-1
    else:
        n //= k-1
        n += 1
    pritn(n+1)
else:
    if l % (k-1) == 0:
        l //= k-1
    else:
        l //= k-1
        l += 1
        
    if r % (k-1) == 0:
        r //= k-1
    else:
        r //= k-1
        r += 1
    print(l+r)

import math

n,k = map(int,input().split())
a = list(map(int,input().split()))

n -= k
print(math.ceil(n/(k-1)) + 1)


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k = list(map(int,input().split()))
a = lsit(map(int,input().split()))
print((n-1+k-2)//(k-1))

n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
print((n-1+k-2)//(k-1))

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = map(int, input().split())
A = list(map(int, input().split()))

i = A.index(1)
ans1 = ans2 = ans3 = 1000010
if N<=K:
    print(1)
    exit()
if len(A[:i]) < K-1:
    ans1 = -(-len(A[:i])//(K-1)) + -(-(len(A[i+1:]) - (K-len(A[:i])))//(K-1))
if len(A[i+1:]) < K-1:
    ans2 = -(-(len(A[:i]) - (K-len(A[i+1:])))//(K-1)) + -(-len(A[i+1:]))//(K-1)
if len(A[:i]) >= K-1 and len(A[i+1:]) >= K-1:
    ans3 = -(-len(A[:i])//(K-1)) + -(-len(A[i+1:])//(K-1))

ans = min(ans1,ans2,ans3)
print(ans)


N,K = map(int, input().split())
print(1 + -( -(N-K)//(K-1) ) )


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):



import sys
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


N, K = read_ints()
if N == K:
    print(1)
    exit()
A = read_ints()
K -= 1
i = A.index(1)

# if i < K and i >= (N - K):
#     print(2)
#     exit()




right = (i - 1) // K + 1
left = (N - 1 - i) // K




print(right + left)





import sys
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


N, K = read_ints()
if N == K:
    print(1)
    exit()
A = read_ints()

K -= 1
i = A.index(1)


ans = 0
for j in range(0, N - 1, K):
    ans += 1

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
from math import ceil
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

print (int(ceil((N-1)/(K-1))))


from math import ceil
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

print (ceil((N-1)//(K-1)))


from math import ceil
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

print (ceil((N-1)/(K-1)))


from math import ceil
N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

print (ceil(N - 1 // K - 1))

import math
N, K = map(int, input().split())
input()
     
print(math.ceil((N-1)/(K-1)))


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k = map(int,input().split())
a = list(map(int,input().split()))
print((n-1) // (k-1))

import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
print(math.ceil((n-1) / (k-1)))



Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, c = map(int, input().split())
import math
print(math.ceil((n-1)//(c-1)))


import math
n, c = map(int, input().split())

a = input()
print(math.ceil((n-1)//(c-1)))


n, c = map(int, input().split())
print((n-1)//(c-1))


import math
N,K = map(int,input().split())
print(math.ceil((N-1)/(K-1)))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
lena = len(a)
index = a.index(1) + 1
lenb = lena - index
if lena / 2 > index:
    front = math.ceil((index-1) / (k-1))
    if k == n :opt = 0
    elif k - index >  0 :opt = k - index
    else :opt = 0
    back = math.ceil((lenb - opt) / (k-1))

else:
    back = math.ceil((lenb-1) / (k-1))
    if k - lenb >  0 :opt = k - lenb
    else :opt = 0
    front = math.ceil((index - opt) % (k-1))

ans = front + back
print(ans)


import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
print(math.ceil((n-1) / (k-1)))


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K = map(int, input().split())
input()
judge = (N-1)%(K-1) == 0
if judge:
    print(int((N-1)/(K-1))
else:
    print(int((N-1)//(K-1)+1)


N,K = map(int, input().split())
input()
judge = (N-1)%(K-1) == 0
if judge:
    print(int((N-1)/(K-1)))
else:
    print(int((N-1)//(K-1)+1))


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k=map(int,input().split())
a=input().split()
m=a.index("1")
a,b=m,n-m-1
ans=((a+1)//(k-1))+1
b-=a%(k-1)
ans+=((b+1)//(k-1))+1
print(ans)

n,k=map(int,input().split());print(((n+2)//(k-1))+1)

n,k=map(int,input().split())
a=list(map(int,input().split()))
print(((n-2)//(k-1))+1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N , K = (int(i) for i in input().split())
A = list(int(i) for i in range(input().split(),N))

count = 1
s  = K

while s < N:
    s = s + (K - 1)
    count = count + 1
    print(s)
print(count)


N , K = (int(i) for i in input().split())
A = list(int(i) for i in input().split())

count = 1
s  = K

while s < N:
    s = s + (K - 1)
    count = count + 1
    print(s)
print(count)


N , K = (int(i) for i in input().split())
A = list(int(i) for i in input().split())
 
count = 1
s  = K
 
while s < N:
    s = s + (K - 1)
    count = count + 1
    #print(s)
print(count)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K=map(int,input().split())
A=list(map(int,input().split()))

N,K=map(int,input().split())
A=list(map(int,input().split()))
print((N-2)//(K-1)+1)

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
n,k = map(int,input().split())
ls = list(map(int,input().split()))
a = min(ls)
i = ls.index(a)
l = i
r = n - i - 1
if r < l:
    l,r = r,l
print(l,r)
if n == k:
    print("1")
elif l < k-1:
    print(int(math.ceil((r-k+1+l)/(k-1)))+1)
else:
    print(int(math.ceil(l/(k-1))+math.ceil(r/(k-1))))


import math
n,k = map(int,input().split())
ls = list(map(int,input().split()))
print(math.ceil((n-1)/(k-1)))


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k=map(int,input().split())
A=list(map(int,input().split()))
r=n-A.index(1)-1
l=A.index(1)
print(r//(k-1)+l//(k-1) if n>k else 1)

n,k=map(int,input().split())
A=list(map(int,input().split()))
r=n-A.index(1)-1
l=A.index(1)
print(min(-(-r//(k-1))-(-l//(k-1)),-(-(n-1)//(k-1))))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k=map(int,input().split())
a=list(map(int,input().split()))
ichi=a.index(1) 

ans=float("inf")


import math
for i in range(k):
  left=math.ceil((ichi-i)/(k-1)) 
  right=math.ceil((n-ichi-(k-i))/(k-1)) 
  print(ichi-i,left,right)
  ans=min(ans,1+left+right)
print(ans)


n,k=map(int,input().split())
a=list(map(int,input().split()))
ichi=a.index(1) 

ans=float("inf")


import math
for i in range(k):
  if ichi-i<0 or ichi+k-i>n:
    break
  left=math.ceil((ichi-i)/(k-1)) 
  right=math.ceil((n-ichi-(k-i))/(k-1)) 
  
  ans=min(ans,1+left+right)
print(ans)


n,k=map(int,input().split())
a=list(map(int,input().split()))
ichi=a.index(1) 

ans=float("inf")


import math
for i in range(k):
  if ichi-i<0 or ichi+k-i>n-1:
    break
  left=math.ceil((ichi-i)/(k-1)) 
  right=math.ceil((n-ichi-(k-i))/(k-1)) 
  
  ans=min(ans,1+left+right)
print(ans)


n,k=map(int,input().split())
a=list(map(int,input().split()))
ichi=a.index(1) 

ans=float("inf")


import math
for i in range(k):
  if ichi-i<0 or ichi+k-i>n: 
    
    continue
  left=math.ceil((ichi-i)/(k-1)) 
  right=math.ceil((n-ichi-(k-i))/(k-1)) 
  
  ans=min(ans,1+left+right)
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N,K=map(int, input().split())
A=input()
if (N-1)%(K-1):
    print((N-1)//(K-1))
else:
    print((N-1)//(K-1)+1)

N,K=map(int, input().split())
A=input()
if (N-1)%(K-1):
    print((N-1)//(K-1)+1)
else:
    print((N-1)//(K-1))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
from math import ceil
N, K = map(int, input().split)
nums = list(map(int, input().split))
index = nums.index(1)
print(ceil(index / (K - 1)) + ceil((N - index - 1) / (K - 1)))

import math
N, K = map(int, input().split())
nums = input()
print(math.ceil((N - 1) / (K - 1)))

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
# your code goes here

N,K = map(int,input().split())
li = list(map(int,input().split()))	
if N == K:
	print(1)
	quit()
i = 1
N = N-K

while N >= K:
	N = N - K +1
	i = i + 1

print()

import sys
input = sys.stdin.readline

n,k = map(int,input().split())
a = list(map(int,input().split()))

res = 1
cnt = k

if n <= cnt:
    print(res)
else:
    if (n-k)%(k-1) == 0:
        print(1 + (n-k)//(k-1))
    else:
        print(1 + (n-k)//(k-1)+1)

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
N, K = [int(t) for t in input().split()]
A = [int(t) for t in input().split()]

idx = A.index(1)
left = A[:idx+1]
right = A[idx:]


def get_cnt(L):
    return math.ceil((len(L) - 1) / (K-1))


if left + 1 < K or N - right < K:
    print(get_cnt(A))
else:
    print(get_cnt(left) + get_cnt(right))


import math
N, K = [int(t) for t in input().split()]
A = [int(t) for t in input().split()]

idx = A.index(1)
left = A[:idx+1]
right = A[idx:]

print(idx)
print(left)
print(right)


def get_cnt(L):
    return math.ceil((len(L) - 1) / (K-1))


if idx + 1 < K or N - idx < K:
    print(get_cnt(A))
else:
    print(get_cnt(left) + get_cnt(right))


import math
N, K = [int(t) for t in input().split()]
A = [int(t) for t in input().split()]

print(math.ceil((N - 1) / (K-1)))


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k =map(int, input().split())
print( (n-1) / (k-1) + ((n-1)%(k-1) != 0))

n, k =map(int, input().split())
print( (n-1) // (k-1) + ((n-1)%(k-1) != 0))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
print((int(input()) - 2) / (int(input()) - 1) + 1)

[print((n[0] - 2) / (n[1] - 1) + 1) for n in [list(map(int, input().split()))]]

[print(int((n[0] - 2) / (n[1] - 1) + 1)) for n in [list(map(int, input().split()))]]

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
min_number = min(A)
left = A.index(min_number)
right =  A.index(min_number)
count = 0

while len(list(set(A))) > 1:
  if left > 0:
    next_left = left-K+1 if left-K+1 >= 0 else 0
    A[next_left:left+1] = [min_number]*len(A[next_left:left+1])
    left = left-K+1
    count+=1
    print(A)
  
  if right < len(A)-1:
    next_right = right+K-1 if right+K-1 <= len(A)-1 else len(A)-1
    A[right:next_right+1] = [min_number]*len(A[right:next_right+1])
    right = right+K-1
    count+=1
    print(A)

print(count)

import math

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(math.ceil((N-1)/(K-1)))

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
n, k = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]

print( 1 + math.ceil((n-k) // (k-1)) )

n, k = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]

print(n // k)

import math
n, k = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]

print( 1 + math.ceil((n-k) / (k-1)) )

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
N, K = list(map(int, input().split()))
A = list(map(int, input().split())) 

m = min(A)
answer = N

for i in range(N-K+1): 
  if not k in A[i:i+K]:
    continue
  answer = min(answer,
              (1 + math.ceil(i/(K-1)) + math.ceil((N-K-i)/(K-1))))
print(answer)

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

print((N-1)//(K-1) + bool((N-1)%(K-1)))

Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n,k=map(int,input().split())
A=list(map(int,input().split()))

m=A.index(1)

le=m
ri=n-m
if le//(k-1)!=0 :
    ri-=(k-1)-le%(k-1)

print(le//(k-1)+ri//(k-1))


n,k=map(int,input().split())
A=list(map(int,input().split()))

#m=A.index(1)

#le=m
#ri=n-m
#if le//(k-1)!=0 :
#    ri-=(k-1)-le%(k-1)

#print(le//(k-1)+ri//(k-1))

print(int((n-1-0.1)//(k-1)+1))


Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input().split())
A = input()
ans = (n-1)//(k-1)
print(ans if (n-1) % (k-1) == 

n, k = map(int, input().split())
A = input()
ans = (n-1)//(k-1)
print(ans if (n-1) % (k-1) == 0 else ans + 1)


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input().split())
x = [map(int, input().split())]

for i in range(n):
	l=k*i-(i-1)
	if i==0:
		l=k
	if l>=n:
		print(i+1)
		break

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

for i in range(1,n+1):
	l=k*i-(i-1)
	if l>=n:
		print(i)
		break

Verdicts: Wrong Answer

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
N, K = map(int,input().split())
Alist = list(map(int,input().split()))
print(-(-N-1//K-1))

N, K = map(int,input().split())
Alist = list(map(int,input().split()))
print(-(-N-1//k-1))

N, K = map(int,input().split())
Alist = list(map(int,input().split()))
n = 0
l = 0
r = o
for i in range(N):
    if Alist[i] == 1:
        p = i
n = n -(-p//(K-1))
n = n -(-(N-p-1)//(K-1))
print(-(-N-1//k-1))

N, K = map(int,input().split())
Alist = list(map(int,input().split()))
print(-(-(N-1)//(K-1)))

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
n, k = map(int, input())
print(((n - 1) + (k - 2)) // (k - 1))


n, k = map(int, input().split())
print(((n - 1) + (k - 2)) // (k - 1))


Verdicts: Runtime Error

Accepted
Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):
import math
n, k = map(int, input().split())
a = input()
print(math.celi(n-1/k-1))

import math
n, k = map(int, input().split())
a = input()
print(math.ceil((n-1)/(k-1)))

Verdicts: Runtime Error

Accepted