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):



def n_snuke(n):
    return n /sum(map(int,str(n)))


# (100o+10x+y)/(o+x+y) > (100o+99)/(o+9+9)
#  100o*18+(10x+y)(o+18) > 100o(x+y) +99(o+x+y)


#
#1 - 10 , 19,29,39,49,59,69,79,89,99


#    print(i,n_snuke(i))


K = int(input())
tmp =0

tmp_list = []
for i in range(K*3):
    tmp = tmp+ 10**(len(str(tmp+1))-1)
    tmp_list.append(tmp)
    #print(tmp,n_snuke(tmp))
r_list = [tmp_list[-1]]
for i in reversed(range(len(tmp_list)-1)):
    if n_snuke(r_list[-1]) >= n_snuke(tmp_list[i]):
        r_list.append(tmp_list[i])

for i in reversed(r_list[-K:]):
    print(i)


import math
N, K = list(map(int, input().split()))
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):
n,k=map(int,input().split())
print((n-k)//(k-1) +1)

n,k=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):
N, K = map(int, input().split())
A = list(map(int, input().split()))

if A.index(1) + N - A.index(1) - 1 < K:
    print(1)
else:
    print(int(np.ceil(A.index(1)/(K-1))+np.ceil((N - A.index(1) - 1)/(K-1))))

N, K = map(int, input().split())
A = list(map(int, input().split()))
 
print((N-2)//(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

N,K = map(int,input().split(" "))

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

import math

N,K = 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()))

if K >= N:
  print(1)
  exit()

idx = A.index(1)
R = (N - 1 - idx) // (K - 1) if (N - 1 - idx) % (K - 1) == 0 else (N -1 - idx) // (K - 1) + 1 
L = (idx - 0) // (K - 1) if (idx - 0) % (K - 1) == 0 else (idx - 0) // (K - 1)
print(R, L)
print(R + L)

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

if K >= N:
  print(1)
  exit()

idx = A.index(1)
if 0 <= idx <= K - 1 or N - 1 - (K - 1) <= idx <= N - 1:
  ans = N // (K - 1) if N % (K - 1) == 0 else N // (K - 1) + 1
  print(ans)
  exit()

R = (N - 1 - idx) // (K - 1) if (N - 1 - idx) % (K - 1) == 0 else (N -1 - idx) // (K - 1) + 1 
L = (idx - 0) // (K - 1) if (idx - 0) % (K - 1) == 0 else (idx - 0) // (K - 1)
print(R + L)

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=[int(i) for in input().split()]
if n==k:
    print(1)
else:
    k-=1
    print((n+k-1)//k)

n,k=map(int, input().split())
a=[int(i) for i in input().split()]
if n==k:
    print(1)
else:
    k-=1
    print((n+k-2)//k)

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):
from math import ceil
def myAnswer(N:int,K:int,A:list) -> int:
   return ceil(N-1 + K -1)

def modelAnswer():
   return
def main():
   N,K = map(int,input().split())
   A = list(map(int,input().split()))
   print(myAnswer(N,K,A[:]))
if __name__ == '__main__':
   main()

from math import ceil
def myAnswer(N:int,K:int,A:list) -> int:
   return ceil((N - 1)/(K - 1))


def modelAnswer():
   return
def main():
   N,K = map(int,input().split())
   A = list(map(int,input().split()))
   print(myAnswer(N,K,A[:]))
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):
import math

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

m=min(A)
a=A.index(m)
tmp=0
tmp+=math.ceil(a/(K-1))
tmp+=math.ceil((N-a-1)/(K-1))

import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = math.ceil((N-K) / (K - 1)) + 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 sys

N, K = map(int, input().split())
A = list(map(int, sys.stdin.readline().rsplit()))

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


import sys, math

N, K = map(int, input().split())
A = list(map(int, sys.stdin.readline().rsplit()))

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())
print((n - 2) // (k - 2) + 1)


n, k = map(int, input().split())
print((n - 2) // (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

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

ans = (N-1)//(K-1)
if K != N:
    print(ans)
else:
    print(1)


pos_1 = 0 
for i in range(N):
    if A_list[i] == 1:
        pos_1 = i

ans1 = math.ceil((pos_1)/(K-1)) + math.ceil((N-1-pos_1)/(K-1))
ans2 = math.ceil((pos_1-1)/(K-1)) + math.ceil((N-1-pos_1+1)/(K-1))
ans3 = math.ceil((pos_1+1)/(K-1)) + math.ceil((N-1-pos_1-1)/(K-1))

if K != N:
    print(min(ans1, ans2, ans3))
else:
    print(1)

import math

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

ans = (N-1)//(K-1)
if K != N:
    print(ans)
else:
    print(1)

import math

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

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

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 = map(int,input().split())
l = list(map(int,input().split()))

a = l.index(min(l))
b = a

count = 0
while b>0:
    b -= k-1
    count += 1
    print('a')

while a<n-1:
    a += k-1
    count += 1
    print('b')

print(count)


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

a = l.index(min(l))
b = a

p = n//2
count = 0
if p>a:
    while b>0:
        b -= k-1
        count += 1

    while a<n-1+b:
        a += k-1
        count += 1

else:
    while a<n-1:
        a += k-1
        count += 1

    while b>a-n+1:
        b -= k-1
        count += 1

print(count)


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().split()
count = 0
if N = K:
    print(1)
else:
    count += 1
    rem = N-K
    add = 1 if (N-K)%(K-1) else 0
    count += (N-K)//(K-1) + add
    print(count)

import math

N, K = map(int, input().split())
A = 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):
from math import ceil
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=A.index(1)
if N==2:
    print(1)
else:
    print(min(ceil(a/(K-1))+ceil((N-1-a)/(K-1)),1+ceil((a-1)/(K-1))+ceil((N-1-(a+1))/(K-1))),ceil((N-1)/(K-1)))

from math import ceil
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=A.index(1)
print(min(ceil(a/(K-1))+ceil((N-1-a)/(K-1)),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 = int(input().split())
print((n+k-3)/(k-1))


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


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


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

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


Verdicts: Runtime Error

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().split())
a = list(map(int, input().split()))

import math

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


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

import math

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())
lis = list(map(int, input().split()))
l = lis.index(1)
i = 0
j = 0
r = (l + 1) % K
R = (N - l) % K

if r >= R:
  while l - i * K + i > 0:
    i += 1

  while l + r + j * K - j < N - 1:
    j += 1
  
  print(i + j)
  
else:
  while l - R - i * K + i > 0:
    i += 1

  while l + j * K - j < N - 1:
    j += 1
  
  print(i + j)

N, K = map(int, input().split())
lis = list(map(int, input().split()))
l = lis.index(1)
Lis = list(reversed(lis))
L = Lis.index(1)
i = 0
j = 0

if l + 1 >= K:
  r = (l + 1 - K) % (K - 1)
  if r != 0:
    r = K - 1 - r
else:
  r = K - l - 1
  
if L + 1 >= K:
  R = K - (L + 1 - K) % (K - 1)
  if R != 0:
    R = K - 1 - R
else:
  R = K - L - 1


if r >= R:
  if r == K - 1:
    r = 0
    
  while l - i * K + i > 0:
    i += 1

  while l + r + j * K - j < N - 1:
    j += 1
  
else:
  if R == K - 1:
    R = 0
    
  while L - i * K + i > 0:
    i += 1

  while L + R + j * K - j < N - 1:
    j += 1
  
print(max(1, i + j))


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 = A.index(min(A))
n2 = N-1-n
a,b = divmod(n,K-1)
c,d = divmod(n2,K-1)
if b == d == 0:
    print(a+c)
elif b+d < K
    print(a+c+1)
else:
    print(a+c+2)

N, K = map(int,input().split())
A = list(map(int,input().split()))
n = A.index(min(A))
n2 = N-1-n
a,b = divmod(n,K-1)
c,d = divmod(n2,K-1)
if b == d == 0:
    print(a+c)
elif b+d < K:
    print(a+c+1)
else:
    print(a+c+2)

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):
args = int(input().rstrip())

def snuke(number):
    temp = list(str(number))
    arr = [ int(t) for t in temp] 
    return sum(arr)

def find_snuke(args):
    result = []
    i = 1
    while len(result) < args:
        push = True
        for power in range(0,len(str(i))):
            if((i+10**power)/snuke(i+10**power))<(i/snuke(i)):
                push = False
                break
        if push:
            result.append(i)
        i=i+1
            
    return result

arr = find_snuke(args)
for a in arr:
   print(a)

import math
def find_min(length, window_size):
    return math.ceil((length-window_size)/(window_size-1)) + 1

args = input().split(" ")
length = int(args[0])
window_size = int(args[1].rstrip())
array = input().split(" ")

print(find_min(length, window_size))

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()))

if K == 1:
    print(N - 1)
elif N == K:
    print(1)
else:
    if (N - K) % (K - 1) != 0:
        print((N - K) // (K - 1) + 1)
    else:
        print((N - K) // (K - 1))


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: 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(-(-(N-1)//(K-1)))

N,K = map(int, input().split())
print(-(-(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()))

mini = min(A)
idx = N + 1
mid = N / 2

for i, a in enumerate(A):
  if a == mini and abs(idx - mid) > abs(i - mid):
    idx = i

ans = i // (K - 1)
rem = i % (K - 1)
if rem:
  ans += 1
  if (N - i - 1 - (K - rem)) // (K - 1) > 0:
    ans += (N - i - 1 - (K - rem)) // (K - 1)
    if (N - i - 1 - (K - rem)) % (K - 1) != 0:
      ans += 1
else:
  if (N - i - 1) // (K - 1) > 0:
    ans += (N - i - 1) // (K - 1)
    if (N - i - 1) % (K - 1) != 0::
        ans += 1
print(ans)

N,K=map(int,input().split())
print((N-1)//(K-1)+1)if(N-1)%(K-1)else print((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())
print((n-1)//(k-1))

n,k=map(int,input().split())
print(-1*((1-n)//(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()))
x = A.index(1)+1
left = x//K + 1 if x % K != 0 else 0
right = (N-x+1)//K + 1 if (N-x+1) % K != 0 else 0
print(left+right)


from math import ceil

N, K = map(int, input().split())
A = list(map(int, input().split()))
print(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()))
for i in range(n):
  if a[i]==1:
    x=i
    y=n-1-i
import math

print(math.ceil(n-1,k))

n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  if a[i]==1:
    x=i
    y=n-1-i
import math

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

n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  if a[i]==1:
    x=i
    y=n-1-i
import math

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 - 2) / (k - 1) + 1)

n, k = 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):
N,K = map(int,input().split())
A = list(map(int,input().split()))

one = A.index(1)

ans = None
if one == 0 or one == N-1:
  ans = -(-(N-1) // (K-1))
else:
  left = -(-i // (K-1))
  right = -(-(N - i - 1 - (i % (K-1)))//(K-1))
  ans = left + right
  
print(ans)
  
  

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

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


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()))

ni = a.index(1)

ans = ni//(k-1)+1 +(n-ni-1 + (ni-1)%(k-1))//(k-1)
print(ans)

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

ni = a.index(1)

ans = ni//(k-1) +(n-ni-1 + ni%(k-1))//(k-1)
print(ans)

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

ni = a.index(1)

ans = ni//(k-1)+1 +(n-ni-1 + ni%(k-1))//(k-1)+1
print(ans)

n,k = map(int,input().split())
a = list(map(int,input().split()))
print((n+(k-1)-1-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):
n,k = map(int,input().split())
a = list(map(int,input().split()))
if k == n:
    print(1)
else:
    print(1+math.ceil((n-k)/(k-1)))

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

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()))
print((n+1)//k)

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

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()))
import numpy as np
a=np.array(a)
temp=np.argmin(a)
import math
if n==k:
  print(1)
else:
  print(math.ceil(temp/(k-1))+math.ceil((n-temp-1-(temp+1)%(k-1))/(k-1)))


n,k=map(int,input().split())
a=list(map(int,input().split()))
import numpy as np
a=np.array(a)
temp=np.argmin(a)
import math
if n==k:
  print(1)
else:
  print(math.ceil(temp/(k-1))+math.ceil((n-temp-k+temp%(k-1))/(k-1)))


n,k=map(int,input().split())
a=list(map(int,input().split()))
import numpy as np
a=np.array(a)
temp=np.argmin(a)
import math
if n==k:
  print(1)
else:
  print(math.ceil(temp/(k-1))+math.ceil((n-temp-1-(k-temp-1)%(k-1))/(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
k, m = map(int, input().split())
x = math.ceil((k-1)/(n-1))

print(x)

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

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 = list(map(int, input().split()))


idx = a.index(min(a))
right = n - idx - 1
left = idx

q1,r1 = divmod(left, k-1)
q2,r2 = divmod(right, k-1)
print(q1, q2, r1, r2)
print(q1 + q2 + min(r1,1) + min(r2,1))

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


idx = a.index(min(a))

ans = 10**12
for i in range(k):
    right = n - idx - 1 - i
    left = max(idx - k + 1 + i, 0)
    
    q1,r1 = divmod(left, k-1)
    q2,r2 = divmod(right, k-1)
    ans = min(ans, q1 + q2 + min(r1,1) + min(r2,1))

print(ans+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):
index = a.index(1)
cnt = 0

if (n==k):
    print(1)
else:
    if index <= (k - 1):
        cnt += 1
        i = k - 1
        while i <= (len(a) - 2):
            i += (k-1)
            cnt += 1
    elif index >= (n - k):
        cnt += 1
        i = n - k
        while i >= 1:
            i -= (k-1)
            cnt += 1
    else:
        i = index
        while i >= 1:
            i -= (k-1)
            cnt += 1

        i = index
        while i <= (len(a) - 2):
            i += (k-1)
            cnt += 1

    print(cnt)

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

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):
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = int((N-1)/(K-1))

if (N-1)%(K-1) == 0:
    print(ans+1)
else:
    print(ans)

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

ans = int((N-1)/(K-1))

if (N-1)%(K-1) == 0:
    print(ans)
else:
    print(ans+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()))
 
print((N-1)//(K-1))

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

print(N//K)

N, K = map(int, input().split())
A = list(map(int, input().split()))
import math
print(math.ceil((N-1)/(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):
a,b=map(int,input().split())
print((a-b)//(b-1)+(1 if a%b > 0 else 0))

import math;a,b=map(int,input().split());print(math.ceil((a-1)/(b-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 = [0] + list(map(int, input().split()))


zero_index = 0
for i in range(len(A)):
    if A[i] == 1:
        zero_index = i
        break

count = 0


zero_left_index = len(A)

zero_left_index -= K
count += 1
while zero_left_index > zero_index:
    zero_left_index -= (K - 1)
    count += 1




if zero_index != 1 and zero_left_index > 0:
    zero_left_index -= K
    count += 1
    while zero_left_index > 0:
        zero_left_index -= (K - 1)
        count += 1

N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))


zero_index = 0
for i in range(len(A)):
    if A[i] == 1:
        zero_index = i
        break

count = 0


zero_left_index = len(A)

zero_left_index -= K
count += 1
while zero_left_index > zero_index:
    zero_left_index -= (K - 1)
    count += 1




if zero_index != 1 and zero_left_index > 1:
    
    # count += 1
    while zero_left_index > 1:
        zero_left_index -= (K - 1)
        count += 1
print(count)

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()))
if K >= N:
    print(1)
else:
    from math import ceil
    one = Alist.index(1)
    left = N
    right = N - one - 1
    print(ceil(left / K) + ceil(right / K))


N, K = map(int, input().split())
Alist = list(map(int, input().split()))
if K >= N:
    print(1)
else:
    from math import ceil
    one = Alist.index(1)
    left = N
    right = N - one - 1
    print(ceil(left / K) + ceil(right / K))


from math import ceil
N, K = map(int, input().split())
Alist = list(map(int, input().split()))
print(ceil((N-1)/(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 = map(int, input().split())
A = list(map(int, input().split()))

one = A.index(1)

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


from math import ceil

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

if K >= N:
    print(1)
    exit()

one = A.index(1)
print(one)
print(ceil((one)/(K-1)) + ceil((N-one-1)/(K-1)))


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

i = A.index(1)
print(i // K + (N - i + 1) // K)


from math import ceil

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

one = A.index(1)
print(ceil((one+1)/(K-1)) + ceil((N-one)/(K-1)))


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

i = A.index(1)
print(i // (K - 1) + (N - i - 1) // (K - 1))


from math import ceil

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

one = A.index(1)
print(ceil((N-1)/(K-1)))


Verdicts: Wrong Answer

Wrong Answer

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=list(map(int,input().split(' ')))
ans=0
position=0
while True:
	if ans==0:
		position+=K
		ans+=1
	else:
		if position>=N-1:
			break
		else:
			position+=K-1
			ans+=1
print(ans)


N,K=map(int,input().split(' '))
A=list(map(int,input.split(' ')))
count=0
sum=0
while sum<N:
	if count==0:
		sum+=K
	else:
		sum+=(K-1)
	count+=1
print(count)

N,K=map(int,input().split(' '))
A=list(map(int,input().split(' ')))
count=0
sum=0
while sum<N:
	if count==0:
		sum+=K
	else:
		sum+=(K-1)
	count+=1
print(count)

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):
N,K=map(int,input().split())
A=list(map(int,input().split()))

if N<=K:
    print(1)
elif (N-3)%(K-1)==0:
    print((N-3)//(K-1))
else:
    print((N-3)//(K-1)+1)

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

if N<=K:
    print(1)
elif (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):
ar = list(map(int,input().split(" ")))
i = ar.index(1)
count = 0
am = 0
if i % (m - 1) == 0:
    count += i // (m - 1)
else:
    count += i // (m - 1) + 1
    am += i % (m - 1)
if (n - 1 - i) % (m - 1) == 0:
    count += (n - 1 - i) // (m - 1)
else:
    count += (n - 1 - i) // (m - 1) + 1
    am += (n - 1 - i) % (m - 1)
if am >= m - 1:
    count -= 1
print(count)

n,m = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
i = ar.index(1)
if n <= m:
    print(1)
    exit()
count = 0
am = 0
count += i // (m - 1)
am += i % (m - 1)
count += (n - 1 - i) // (m - 1)
am += (n - 1 - i) % (m - 1)
if am <= m - 1 and am > 0:
    count += 1
if am > m - 1:
    count += 2
print(count)

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 numpy as np
n, k = map(int, input().split())
a_list = list(map(int, input().split()))

if n == k:
    ans = 1
else:
    m = int(n / (k - 1))
    s = k
    for i in range(1, m+2):
        s += (k - 1) 
        print(s)
        if s >= n:
            ans = i + 1
            break
        else:
            pass

print(ans)


import numpy as np
n, k = map(int, input().split())
a_list = list(map(int, input().split()))


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


Verdicts: Wrong Answer

Accepted